|
@@ -1478,13 +1478,28 @@ void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
|
|
qobject_unref(args);
|
|
qobject_unref(args);
|
|
}
|
|
}
|
|
|
|
|
|
-#ifndef _WIN32
|
|
|
|
void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd)
|
|
void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd)
|
|
{
|
|
{
|
|
QDict *resp;
|
|
QDict *resp;
|
|
|
|
|
|
|
|
+#ifdef WIN32
|
|
|
|
+ WSAPROTOCOL_INFOW info;
|
|
|
|
+ g_autofree char *info64 = NULL;
|
|
|
|
+ SOCKET s;
|
|
|
|
+
|
|
|
|
+ assert(fd_is_socket(fd));
|
|
|
|
+ s = _get_osfhandle(fd);
|
|
|
|
+ if (WSADuplicateSocketW(s, GetProcessId((HANDLE)qts->qemu_pid), &info) == SOCKET_ERROR) {
|
|
|
|
+ g_autofree char *emsg = g_win32_error_message(WSAGetLastError());
|
|
|
|
+ g_error("WSADuplicateSocketW failed: %s", emsg);
|
|
|
|
+ }
|
|
|
|
+ info64 = g_base64_encode((guchar *)&info, sizeof(info));
|
|
|
|
+ resp = qtest_qmp(qts, "{'execute': 'get-win32-socket',"
|
|
|
|
+ "'arguments': {'fdname': 'fdname', 'info': %s}}", info64);
|
|
|
|
+#else
|
|
resp = qtest_qmp_fds(qts, &fd, 1, "{'execute': 'getfd',"
|
|
resp = qtest_qmp_fds(qts, &fd, 1, "{'execute': 'getfd',"
|
|
"'arguments': {'fdname': 'fdname'}}");
|
|
"'arguments': {'fdname': 'fdname'}}");
|
|
|
|
+#endif
|
|
g_assert(resp);
|
|
g_assert(resp);
|
|
g_assert(!qdict_haskey(resp, "event")); /* We don't expect any events */
|
|
g_assert(!qdict_haskey(resp, "event")); /* We don't expect any events */
|
|
g_assert(!qdict_haskey(resp, "error"));
|
|
g_assert(!qdict_haskey(resp, "error"));
|
|
@@ -1498,7 +1513,6 @@ void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd)
|
|
g_assert(!qdict_haskey(resp, "error"));
|
|
g_assert(!qdict_haskey(resp, "error"));
|
|
qobject_unref(resp);
|
|
qobject_unref(resp);
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
* Generic hot-unplugging test via the device_del QMP command.
|
|
* Generic hot-unplugging test via the device_del QMP command.
|