[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 34/54] tests/qtest: libqtest: Exclude the *_fds APIs for win32
From: |
Bin Meng |
Subject: |
[PATCH v3 34/54] tests/qtest: libqtest: Exclude the *_fds APIs for win32 |
Date: |
Sun, 25 Sep 2022 19:30:12 +0800 |
From: Bin Meng <bin.meng@windriver.com>
libqmp.c::qmp_fd_vsend_fds() is not available on Windows, hence any
APIs in libqtest that call libqmp.c::qmp_fd_vsend_fds() should be
excluded for win32 too. This includes the following:
* qtest_qmp_vsend_fds()
* qtest_vqmp_fds()
* qtest_qmp_fds()
* qtest_qmp_add_client()
Note qtest_qmp_vsend() was wrongly written to call qmp_fd_vsend_fds()
previously, but it should call the non fds version API qmp_fd_vsend().
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
(no changes since v1)
tests/qtest/libqtest.h | 8 ++++++++
tests/qtest/libqtest.c | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
index 94b187837d..3abc75964d 100644
--- a/tests/qtest/libqtest.h
+++ b/tests/qtest/libqtest.h
@@ -94,6 +94,7 @@ void qtest_kill_qemu(QTestState *s);
*/
void qtest_quit(QTestState *s);
+#ifndef _WIN32
/**
* qtest_qmp_fds:
* @s: #QTestState instance to operate on.
@@ -108,6 +109,7 @@ void qtest_quit(QTestState *s);
QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, ...)
G_GNUC_PRINTF(4, 5);
+#endif /* _WIN32 */
/**
* qtest_qmp:
@@ -152,6 +154,7 @@ void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
*/
int qtest_socket_server(const char *socket_path);
+#ifndef _WIN32
/**
* qtest_vqmp_fds:
* @s: #QTestState instance to operate on.
@@ -167,6 +170,7 @@ int qtest_socket_server(const char *socket_path);
QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, va_list ap)
G_GNUC_PRINTF(4, 0);
+#endif /* _WIN32 */
/**
* qtest_vqmp:
@@ -181,6 +185,7 @@ QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t
fds_num,
QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
G_GNUC_PRINTF(2, 0);
+#ifndef _WIN32
/**
* qtest_qmp_vsend_fds:
* @s: #QTestState instance to operate on.
@@ -196,6 +201,7 @@ QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list
ap)
void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, va_list ap)
G_GNUC_PRINTF(4, 0);
+#endif /* _WIN32 */
/**
* qtest_qmp_vsend:
@@ -743,6 +749,7 @@ void qtest_qmp_device_add_qdict(QTestState *qts, const char
*drv,
void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
const char *fmt, ...) G_GNUC_PRINTF(4, 5);
+#ifndef _WIN32
/**
* qtest_qmp_add_client:
* @qts: QTestState instance to operate on
@@ -752,6 +759,7 @@ void qtest_qmp_device_add(QTestState *qts, const char
*driver, const char *id,
* Call QMP ``getfd`` followed by ``add_client`` with the given @fd.
*/
void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd);
+#endif /* _WIN32 */
/**
* qtest_qmp_device_del:
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 0dfe630373..269d622fe3 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -592,17 +592,20 @@ int qtest_socket_server(const char *socket_path)
return sock;
}
+#ifndef _WIN32
void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, va_list ap)
{
qmp_fd_vsend_fds(s->qmp_fd, fds, fds_num, fmt, ap);
}
+#endif
void qtest_qmp_vsend(QTestState *s, const char *fmt, va_list ap)
{
- qmp_fd_vsend_fds(s->qmp_fd, NULL, 0, fmt, ap);
+ qmp_fd_vsend(s->qmp_fd, fmt, ap);
}
+#ifndef _WIN32
QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, va_list ap)
{
@@ -611,6 +614,7 @@ QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t
fds_num,
/* Receive reply */
return qtest_qmp_receive(s);
}
+#endif
QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
{
@@ -620,6 +624,7 @@ QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list
ap)
return qtest_qmp_receive(s);
}
+#ifndef _WIN32
QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, ...)
{
@@ -631,6 +636,7 @@ QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t
fds_num,
va_end(ap);
return response;
}
+#endif
QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
{
@@ -1327,6 +1333,7 @@ void qtest_qmp_device_add(QTestState *qts, const char
*driver, const char *id,
qobject_unref(args);
}
+#ifndef _WIN32
void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd)
{
QDict *resp;
@@ -1346,6 +1353,7 @@ void qtest_qmp_add_client(QTestState *qts, const char
*protocol, int fd)
g_assert(!qdict_haskey(resp, "error"));
qobject_unref(resp);
}
+#endif
/*
* Generic hot-unplugging test via the device_del QMP command.
--
2.34.1
- [PATCH v3 24/54] tests: vhost-user-bridge: Avoid using hardcoded /tmp, (continued)
- [PATCH v3 24/54] tests: vhost-user-bridge: Avoid using hardcoded /tmp, Bin Meng, 2022/09/25
- [PATCH v3 22/54] tests/unit: test-image-locking: Avoid using hardcoded /tmp, Bin Meng, 2022/09/25
- [PATCH v3 18/54] tests/qtest: vhost-user-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/25
- [PATCH v3 30/54] tests/qtest: qmp-test: Skip running test_qmp_oob for win32, Bin Meng, 2022/09/25
- [PATCH v3 32/54] tests/qtest: libqtest: Adapt global_qtest declaration for win32, Bin Meng, 2022/09/25
- [PATCH v3 33/54] tests/qtest: Use send/recv for socket communication, Bin Meng, 2022/09/25
- [PATCH v3 34/54] tests/qtest: libqtest: Exclude the *_fds APIs for win32,
Bin Meng <=
- [PATCH v3 36/54] tests/qtest: Support libqtest to build and run on Windows, Bin Meng, 2022/09/25
- [PATCH v3 42/54] chardev/char-file: Add FILE_SHARE_WRITE when opening the file for win32, Bin Meng, 2022/09/25
[PATCH v3 35/54] tests/qtest: libqtest: Install signal handler via signal(), Bin Meng, 2022/09/25
[PATCH v3 40/54] tests/qtest: ide-test: Open file in binary mode, Bin Meng, 2022/09/25
[PATCH v3 44/54] tests/qtest: microbit-test: Fix socket access for win32, Bin Meng, 2022/09/25