summary refs log tree commit diff stats
path: root/tests/qtest/migration-test.c
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2023-04-21 18:14:06 +0100
committerThomas Huth <thuth@redhat.com>2023-05-16 09:14:18 +0200
commit855436dbf756014a024f3e415001ead37301ef95 (patch)
treedf16140537c80af620907679b358c65cdad3ce4f /tests/qtest/migration-test.c
parenteb96660507ecbe479c6a38639861f65b23d067d7 (diff)
downloadfocaccia-qemu-855436dbf756014a024f3e415001ead37301ef95.tar.gz
focaccia-qemu-855436dbf756014a024f3e415001ead37301ef95.zip
tests/qtest: replace qmp_discard_response with qtest_qmp_assert_success
The qmp_discard_response method simply ignores the result of the QMP
command, merely unref'ing the object. This is a bad idea for tests
as it leaves no trace if the QMP command unexpectedly failed. The
qtest_qmp_assert_success method will validate that the QMP command
returned without error, and if errors occur, it will print a message
on the console aiding debugging.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230421171411.566300-2-berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/migration-test.c')
-rw-r--r--tests/qtest/migration-test.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 8a5df84624..b99b49a314 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -40,9 +40,6 @@
 #include "linux/kvm.h"
 #endif
 
-/* TODO actually test the results and get rid of this */
-#define qtest_qmp_discard_response(...) qobject_unref(qtest_qmp(__VA_ARGS__))
-
 unsigned start_address;
 unsigned end_address;
 static bool uffd_feature_thread_id;
@@ -766,7 +763,7 @@ static void test_migrate_end(QTestState *from, QTestState *to, bool test_dest)
             usleep(1000 * 10);
         } while (dest_byte_a == dest_byte_b);
 
-        qtest_qmp_discard_response(to, "{ 'execute' : 'stop'}");
+        qtest_qmp_assert_success(to, "{ 'execute' : 'stop'}");
 
         /* With it stopped, check nothing changes */
         qtest_memread(to, start_address, &dest_byte_c, 1);