All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: ehabkost@redhat.com
Subject: [Qemu-devel] [PULL 04/14] tests/qmp-cmd-test: Use qtest_init() instead of qtest_start()
Date: Thu,  9 May 2019 10:19:20 +0200	[thread overview]
Message-ID: <20190509081930.19081-5-thuth@redhat.com> (raw)
In-Reply-To: <20190509081930.19081-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
(since global_qtest can not be used in tests that have to track
multiple QEMU states, like migration tests). Use qtest_init() and
qtest_quit() instead.

Message-Id: <20190409085245.31548-4-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/qmp-cmd-test.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/qmp-cmd-test.c b/tests/qmp-cmd-test.c
index d12cac539c..9f5228cd99 100644
--- a/tests/qmp-cmd-test.c
+++ b/tests/qmp-cmd-test.c
@@ -61,10 +61,11 @@ static void test_query(const void *data)
     int expected_error_class = query_error_class(cmd);
     QDict *resp, *error;
     const char *error_class;
+    QTestState *qts;
 
-    qtest_start(common_args);
+    qts = qtest_init(common_args);
 
-    resp = qmp("{ 'execute': %s }", cmd);
+    resp = qtest_qmp(qts, "{ 'execute': %s }", cmd);
     error = qdict_get_qdict(resp, "error");
     error_class = error ? qdict_get_str(error, "class") : NULL;
 
@@ -78,7 +79,7 @@ static void test_query(const void *data)
     }
     qobject_unref(resp);
 
-    qtest_end();
+    qtest_quit(qts);
 }
 
 static bool query_is_blacklisted(const char *cmd)
@@ -118,16 +119,18 @@ static void qmp_schema_init(QmpSchema *schema)
     QDict *resp;
     Visitor *qiv;
     SchemaInfoList *tail;
+    QTestState *qts;
 
-    qtest_start(common_args);
-    resp = qmp("{ 'execute': 'query-qmp-schema' }");
+    qts = qtest_init(common_args);
+
+    resp = qtest_qmp(qts, "{ 'execute': 'query-qmp-schema' }");
 
     qiv = qobject_input_visitor_new(qdict_get(resp, "return"));
     visit_type_SchemaInfoList(qiv, NULL, &schema->list, &error_abort);
     visit_free(qiv);
 
     qobject_unref(resp);
-    qtest_end();
+    qtest_quit(qts);
 
     schema->hash = g_hash_table_new(g_str_hash, g_str_equal);
 
-- 
2.21.0



  parent reply	other threads:[~2019-05-09  8:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09  8:19 [Qemu-devel] [PULL 00/14] qtests, copyright statement clarifications and misc patches Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 01/14] tests: Force Python I/O encoding for check-qapi-schema Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 02/14] tests/tco: Make test independent of global_qtest Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 03/14] tests/megasas: " Thomas Huth
2019-05-09  8:19 ` Thomas Huth [this message]
2019-05-09  8:19 ` [Qemu-devel] [PULL 05/14] tests/test-hmp: Use qtest_init() instead of qtest_start() Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 06/14] tests/ide-test: Make test independent of global_qtest Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 07/14] tests/tpm-tests: Use g_test_skip() to mark skipped tests Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 08/14] tests/Makefile: Remove unused test-obj-y variable Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 09/14] tests/drive_del-test: Use qtest_init() instead of qtest_start() Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 10/14] tests: qpci_unplug_acpi_device_test() should not rely on global_qtest Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 11/14] hw/i2c/smbus_ich9: Fix the confusing contributions-after-2012 statement Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 12/14] target/openrisc: Fix LGPL information in the file headers Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 13/14] target/sh4: " Thomas Huth
2019-05-09  8:19 ` [Qemu-devel] [PULL 14/14] include/exec/poison: Mark TARGET_FMT_lu as poisoned, too Thomas Huth
2019-05-09 15:30 ` [Qemu-devel] [PULL 00/14] qtests, copyright statement clarifications and misc 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=20190509081930.19081-5-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=ehabkost@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.