qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 6/9] tests/qtest: replace wait_command() with qtest_qmp_as


From: Thomas Huth
Subject: Re: [PATCH v3 6/9] tests/qtest: replace wait_command() with qtest_qmp_assert_success
Date: Thu, 1 Jun 2023 11:37:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

On 31/05/2023 15.23, Daniel P. Berrangé wrote:
Most usage of wait_command() is followed by qobject_unref(), which
is just a verbose re-implementation of qtest_qmp_assert_success().

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
  tests/qtest/migration-helpers.c |  53 +---------
  tests/qtest/migration-helpers.h |   8 --
  tests/qtest/migration-test.c    | 170 +++++++++++++-------------------
  3 files changed, 74 insertions(+), 157 deletions(-)
...
@@ -1759,7 +1741,6 @@ static void 
test_precopy_tcp_tls_x509_reject_anon_client(void)
  static void *test_migrate_fd_start_hook(QTestState *from,
                                          QTestState *to)
  {
-    QDict *rsp;
      int ret;
      int pair[2];
@@ -1768,22 +1749,19 @@ static void *test_migrate_fd_start_hook(QTestState *from,
      g_assert_cmpint(ret, ==, 0);
/* Send the 1st socket to the target */
-    rsp = wait_command_fd(to, pair[0],
-                          "{ 'execute': 'getfd',"
-                          "  'arguments': { 'fdname': 'fd-mig' }}");
-    qobject_unref(rsp);
+    qtest_qmp_fds_assert_success(to, &(pair[0]), 1,

Matter of taste, but I think I'd prefer &pair[0] without the parentheses.

+                                 "{ 'execute': 'getfd',"
+                                 "  'arguments': { 'fdname': 'fd-mig' }}");
      close(pair[0]);
/* Start incoming migration from the 1st socket */
-    rsp = wait_command(to, "{ 'execute': 'migrate-incoming',"
-                           "  'arguments': { 'uri': 'fd:fd-mig' }}");
-    qobject_unref(rsp);
+    qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming',"
+                             "  'arguments': { 'uri': 'fd:fd-mig' }}");
/* Send the 2nd socket to the target */
-    rsp = wait_command_fd(from, pair[1],
-                          "{ 'execute': 'getfd',"
-                          "  'arguments': { 'fdname': 'fd-mig' }}");
-    qobject_unref(rsp);
+    qtest_qmp_fds_assert_success(from, &(pair[1]), 1,

&pair[1] ?

Anyway,
Reviewed-by: Thomas Huth <thuth@redhat.com>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]