[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v4 17/29] vhost-user-test: extract read-guest-mem tes
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v4 17/29] vhost-user-test: extract read-guest-mem test from main loop |
Date: |
Thu, 18 Jan 2018 22:45:45 +0200 |
From: Maxime Coquelin <address@hidden>
This patch makes read-guest-test consistent with other tests,
i.e. create the test server in the test function.
Reviewed-by: Marc-André Lureau <address@hidden>
Signed-off-by: Maxime Coquelin <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
tests/vhost-user-test.c | 41 +++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 43c6528..df56724 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -617,6 +617,28 @@ GSourceFuncs test_migrate_source_funcs = {
.check = test_migrate_source_check,
};
+static void test_read_guest_mem(void)
+{
+ TestServer *server = NULL;
+ char *qemu_cmd = NULL;
+ QTestState *s = NULL;
+
+ server = test_server_new("test");
+ test_server_listen(server);
+
+ qemu_cmd = GET_QEMU_CMD(server);
+
+ s = qtest_start(qemu_cmd);
+ g_free(qemu_cmd);
+
+ init_virtio_dev(server);
+
+ read_guest_mem(server);
+
+ qtest_quit(s);
+ test_server_free(server);
+}
+
static void test_migrate(void)
{
TestServer *s = test_server_new("src");
@@ -919,10 +941,7 @@ static void test_multiqueue(void)
int main(int argc, char **argv)
{
- QTestState *s = NULL;
- TestServer *server = NULL;
const char *hugefs;
- char *qemu_cmd = NULL;
int ret;
char template[] = "/tmp/vhost-test-XXXXXX";
GMainLoop *loop;
@@ -947,20 +966,11 @@ int main(int argc, char **argv)
root = tmpfs;
}
- server = test_server_new("test");
- test_server_listen(server);
-
loop = g_main_loop_new(NULL, FALSE);
/* run the main loop thread so the chardev may operate */
thread = g_thread_new(NULL, thread_function, loop);
- qemu_cmd = GET_QEMU_CMD(server);
-
- s = qtest_start(qemu_cmd);
- g_free(qemu_cmd);
- init_virtio_dev(server);
-
- qtest_add_data_func("/vhost-user/read-guest-mem", server, read_guest_mem);
+ qtest_add_func("/vhost-user/read-guest-mem", test_read_guest_mem);
qtest_add_func("/vhost-user/migrate", test_migrate);
qtest_add_func("/vhost-user/multiqueue", test_multiqueue);
@@ -978,12 +988,7 @@ int main(int argc, char **argv)
ret = g_test_run();
- if (s) {
- qtest_quit(s);
- }
-
/* cleanup */
- test_server_free(server);
/* finish the helper thread and dispatch pending sources */
g_main_loop_quit(loop);
--
MST
- [Qemu-devel] [PULL v4 07/29] virtio: postpone the execution of event_notifier_cleanup function, (continued)
- [Qemu-devel] [PULL v4 07/29] virtio: postpone the execution of event_notifier_cleanup function, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 05/29] contrib/vhost-user-blk: introduce a vhost-user-blk sample application, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 09/29] pci/shpc: Move function to generic header file, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 10/29] vhost-user: fix multiple queue specification, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 11/29] intel-iommu: Redefine macros to enable supporting 48 bit address width, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 13/29] hw/pci-bridge: fix QEMU crash because of pcie-root-port, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 14/29] ACPI/unit-test: Add a testcase for RAM allocation in numa node, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 12/29] intel-iommu: Extend address width to 48 bits, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 15/29] hw/acpi-build: Make next_base easy to follow, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 16/29] vhost-user-test: fix features mask, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 17/29] vhost-user-test: extract read-guest-mem test from main loop,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v4 18/29] vhost-user-test: setup virtqueues in all tests, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 19/29] vhost-user-test: make features mask an init_virtio_dev() argument, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 20/29] vhost-user-test: use init_virtio_dev in multiqueue test, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 21/29] x86_iommu: Move machine check to x86_iommu_realize(), Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 24/29] tests: acpi: init table descriptor in test_dst_table(), Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 25/29] tests: acpi: rename test_acpi_tables()/test_dst_table() to reflect its usage, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 26/29] tests: acpi: add comments to fetch_rsdt_referenced_tables/data->tables usage, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 22/29] x86_iommu: check if machine has PCI bus, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 23/29] tests: acpi: move tested tables array allocation outside of test_acpi_dsdt_table(), Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 27/29] vhost-user: factor out msg head and payload, Michael S. Tsirkin, 2018/01/18