qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, lvivier@redhat.com, mreitz@redhat.com
Subject: [Qemu-devel] [PULL 05/13] tests/numa-test: Use qtest_init() instead of qtest_start()
Date: Tue, 21 May 2019 12:53:36 +0200	[thread overview]
Message-ID: <20190521105344.11637-6-thuth@redhat.com> (raw)
In-Reply-To: <20190521105344.11637-1-thuth@redhat.com>

qtest_start() + qtest_end() should be avoided, since they use the
global_qtest variable that we want to get rid of in the long run.
Use qtest_init() and qtest_quit() instead.

Message-Id: <20190515174328.16361-4-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/numa-test.c | 53 +++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/tests/numa-test.c b/tests/numa-test.c
index 9824fdd587..8de8581231 100644
--- a/tests/numa-test.c
+++ b/tests/numa-test.c
@@ -23,18 +23,19 @@ static void test_mon_explicit(const void *data)
 {
     char *s;
     char *cli;
+    QTestState *qts;
 
     cli = make_cli(data, "-smp 8 "
                    "-numa node,nodeid=0,cpus=0-3 "
                    "-numa node,nodeid=1,cpus=4-7 ");
-    qtest_start(cli);
+    qts = qtest_init(cli);
 
-    s = hmp("info numa");
+    s = qtest_hmp(qts, "info numa");
     g_assert(strstr(s, "node 0 cpus: 0 1 2 3"));
     g_assert(strstr(s, "node 1 cpus: 4 5 6 7"));
     g_free(s);
 
-    qtest_end();
+    qtest_quit(qts);
     g_free(cli);
 }
 
@@ -42,16 +43,17 @@ static void test_mon_default(const void *data)
 {
     char *s;
     char *cli;
+    QTestState *qts;
 
     cli = make_cli(data, "-smp 8 -numa node -numa node");
-    qtest_start(cli);
+    qts = qtest_init(cli);
 
-    s = hmp("info numa");
+    s = qtest_hmp(qts, "info numa");
     g_assert(strstr(s, "node 0 cpus: 0 2 4 6"));
     g_assert(strstr(s, "node 1 cpus: 1 3 5 7"));
     g_free(s);
 
-    qtest_end();
+    qtest_quit(qts);
     g_free(cli);
 }
 
@@ -59,24 +61,25 @@ static void test_mon_partial(const void *data)
 {
     char *s;
     char *cli;
+    QTestState *qts;
 
     cli = make_cli(data, "-smp 8 "
                    "-numa node,nodeid=0,cpus=0-1 "
                    "-numa node,nodeid=1,cpus=4-5 ");
-    qtest_start(cli);
+    qts = qtest_init(cli);
 
-    s = hmp("info numa");
+    s = qtest_hmp(qts, "info numa");
     g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7"));
     g_assert(strstr(s, "node 1 cpus: 4 5"));
     g_free(s);
 
-    qtest_end();
+    qtest_quit(qts);
     g_free(cli);
 }
 
-static QList *get_cpus(QDict **resp)
+static QList *get_cpus(QTestState *qts, QDict **resp)
 {
-    *resp = qmp("{ 'execute': 'query-cpus' }");
+    *resp = qtest_qmp(qts, "{ 'execute': 'query-cpus' }");
     g_assert(*resp);
     g_assert(qdict_haskey(*resp, "return"));
     return qdict_get_qlist(*resp, "return");
@@ -88,10 +91,11 @@ static void test_query_cpus(const void *data)
     QDict *resp;
     QList *cpus;
     QObject *e;
+    QTestState *qts;
 
     cli = make_cli(data, "-smp 8 -numa node,cpus=0-3 -numa node,cpus=4-7");
-    qtest_start(cli);
-    cpus = get_cpus(&resp);
+    qts = qtest_init(cli);
+    cpus = get_cpus(qts, &resp);
     g_assert(cpus);
 
     while ((e = qlist_pop(cpus))) {
@@ -115,7 +119,7 @@ static void test_query_cpus(const void *data)
     }
 
     qobject_unref(resp);
-    qtest_end();
+    qtest_quit(qts);
     g_free(cli);
 }
 
@@ -125,6 +129,7 @@ static void pc_numa_cpu(const void *data)
     QDict *resp;
     QList *cpus;
     QObject *e;
+    QTestState *qts;
 
     cli = make_cli(data, "-cpu pentium -smp 8,sockets=2,cores=2,threads=2 "
         "-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -132,8 +137,8 @@ static void pc_numa_cpu(const void *data)
         "-numa cpu,node-id=0,socket-id=1,core-id=0 "
         "-numa cpu,node-id=0,socket-id=1,core-id=1,thread-id=0 "
         "-numa cpu,node-id=1,socket-id=1,core-id=1,thread-id=1");
-    qtest_start(cli);
-    cpus = get_cpus(&resp);
+    qts = qtest_init(cli);
+    cpus = get_cpus(qts, &resp);
     g_assert(cpus);
 
     while ((e = qlist_pop(cpus))) {
@@ -168,7 +173,7 @@ static void pc_numa_cpu(const void *data)
     }
 
     qobject_unref(resp);
-    qtest_end();
+    qtest_quit(qts);
     g_free(cli);
 }
 
@@ -178,6 +183,7 @@ static void spapr_numa_cpu(const void *data)
     QDict *resp;
     QList *cpus;
     QObject *e;
+    QTestState *qts;
 
     cli = make_cli(data, "-smp 4,cores=4 "
         "-numa node,nodeid=0 -numa node,nodeid=1 "
@@ -185,8 +191,8 @@ static void spapr_numa_cpu(const void *data)
         "-numa cpu,node-id=0,core-id=1 "
         "-numa cpu,node-id=0,core-id=2 "
         "-numa cpu,node-id=1,core-id=3");
-    qtest_start(cli);
-    cpus = get_cpus(&resp);
+    qts = qtest_init(cli);
+    cpus = get_cpus(qts, &resp);
     g_assert(cpus);
 
     while ((e = qlist_pop(cpus))) {
@@ -213,7 +219,7 @@ static void spapr_numa_cpu(const void *data)
     }
 
     qobject_unref(resp);
-    qtest_end();
+    qtest_quit(qts);
     g_free(cli);
 }
 
@@ -223,13 +229,14 @@ static void aarch64_numa_cpu(const void *data)
     QDict *resp;
     QList *cpus;
     QObject *e;
+    QTestState *qts;
 
     cli = make_cli(data, "-smp 2 "
         "-numa node,nodeid=0 -numa node,nodeid=1 "
         "-numa cpu,node-id=1,thread-id=0 "
         "-numa cpu,node-id=0,thread-id=1");
-    qtest_start(cli);
-    cpus = get_cpus(&resp);
+    qts = qtest_init(cli);
+    cpus = get_cpus(qts, &resp);
     g_assert(cpus);
 
     while ((e = qlist_pop(cpus))) {
@@ -256,7 +263,7 @@ static void aarch64_numa_cpu(const void *data)
     }
 
     qobject_unref(resp);
-    qtest_end();
+    qtest_quit(qts);
     g_free(cli);
 }
 
-- 
2.21.0



  parent reply	other threads:[~2019-05-21 11:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 10:53 [Qemu-devel] [PULL 00/13] qtests and some iotest patches Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 01/13] tests/libqtest: Remove unused global_qtest-related wrapper functions Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 02/13] tests/libqtest: Fix description of qtest_vinitf() and qtest_initf() Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 03/13] tests/libqos: Get rid of global_qtest dependency in qvring_init() Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 04/13] tests/q35-test: Make test independent of global_qtest Thomas Huth
2019-05-21 10:53 ` Thomas Huth [this message]
2019-05-21 10:53 ` [Qemu-devel] [PULL 06/13] tests/qom-test: Use qtest_init() instead of qtest_start() Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 07/13] tests/device-introspect: " Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 08/13] tests/hd-geo-test: " Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 09/13] tests/qemu-iotests/005: Add a sanity check for large sparse file support Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 10/13] tests/qemu-iotests/check: Pick a default machine if necessary Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 11/13] tests/qemu-iotests: Do not hard-code the path to bash Thomas Huth
2019-05-24  8:12   ` Ed Maste
2019-05-21 10:53 ` [Qemu-devel] [PULL 12/13] cirrus / travis: Add gnu-sed and bash for macOS and FreeBSD Thomas Huth
2019-05-21 10:53 ` [Qemu-devel] [PULL 13/13] tests/qemu-iotests: Remove the "_supported_os Linux" line from many tests Thomas Huth
2019-05-24  8:11   ` Ed Maste
2019-05-21 13:56 ` [Qemu-devel] [PULL 00/13] qtests and some iotest patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190521105344.11637-6-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).