diff options
author | Thomas Huth <thuth@redhat.com> | 2019-07-22 17:10:55 +0200 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2019-08-15 19:24:10 +0200 |
commit | e5758de4e836c3b2edc2befd904651fc6967d74f (patch) | |
tree | 324827884570aa10cb22024f8735e43178e3a947 /tests/cpu-plug-test.c | |
parent | 17de4741296af8ed3361b14feda130a7d7102987 (diff) |
tests/libqtest: Make qtest_qmp_device_add/del independent from global_qtest
Generic library functions like qtest_qmp_device_add() and _del()
should not depend on the global_qtest variable. Pass the test
state via parameter instead.
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20190813093047.27948-6-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/cpu-plug-test.c')
-rw-r--r-- | tests/cpu-plug-test.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c index 668f00144e..3049620854 100644 --- a/tests/cpu-plug-test.c +++ b/tests/cpu-plug-test.c @@ -77,18 +77,19 @@ static void test_plug_with_device_add_x86(gconstpointer data) const PlugTestData *td = data; char *args; unsigned int s, c, t; + QTestState *qts; args = g_strdup_printf("-machine %s -cpu %s " "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u", td->machine, td->cpu_model, td->sockets, td->cores, td->threads, td->maxcpus); - qtest_start(args); + qts = qtest_init(args); for (s = 1; s < td->sockets; s++) { for (c = 0; c < td->cores; c++) { for (t = 0; t < td->threads; t++) { char *id = g_strdup_printf("id-%i-%i-%i", s, c, t); - qtest_qmp_device_add(td->device_model, id, + qtest_qmp_device_add(qts, td->device_model, id, "{'socket-id':%u, 'core-id':%u," " 'thread-id':%u}", s, c, t); @@ -97,7 +98,7 @@ static void test_plug_with_device_add_x86(gconstpointer data) } } - qtest_end(); + qtest_quit(qts); g_free(args); } @@ -106,20 +107,22 @@ static void test_plug_with_device_add_coreid(gconstpointer data) const PlugTestData *td = data; char *args; unsigned int c; + QTestState *qts; args = g_strdup_printf("-machine %s -cpu %s " "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u", td->machine, td->cpu_model, td->sockets, td->cores, td->threads, td->maxcpus); - qtest_start(args); + qts = qtest_init(args); for (c = 1; c < td->cores; c++) { char *id = g_strdup_printf("id-%i", c); - qtest_qmp_device_add(td->device_model, id, "{'core-id':%u}", c); + qtest_qmp_device_add(qts, td->device_model, id, + "{'core-id':%u}", c); g_free(id); } - qtest_end(); + qtest_quit(qts); g_free(args); } |