tests/qtest/migration: Fix cpr-tests in case the machine is not available
PATCH 1/1 tests/qtest/migration: Fix cpr-tests in case the machine is not available
From: Thomas Huth <[email protected]>
When QEMU has been compiled with "--without-default-devices", the migration cpr-tests are currently failing since the first test leaves a socket file behind that avoids that the second test can be initialized correctly. Make sure that we delete the socket file in case that the migrate_start() failed due to the missing machine.
--- tests/qtest/migration/framework.h | 2 +- tests/qtest/migration/cpr-tests.c | 5 ++++- tests/qtest/migration/framework.c | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-)
tests/qtest/migration/framework.h +1 -1
@@ -227,7 +227,7 @@ void migrate_end(QTestState *from, QTestState *to, bool test_dest);void test_postcopy_common (MigrateCommon *args);void test_postcopy_recovery_common (MigrateCommon *args); -void test_precopy_common (MigrateCommon *args); +int test_precopy_common (MigrateCommon *args);void test_file_common (MigrateCommon *args,bool stop_src); void *migrate_hook_start_precopy_tcp_multifd_common(QTestState *from, QTestState *to,
tests/qtest/migration/cpr-tests.c +4 -1
@@ -97,7 +97,10 @@ static void test_mode_transfer_common(bool incoming_defer) .start_hook = test_mode_transfer_start, }; -test_precopy_common (&args); +if (test_precopy_common (&args) <0 ) { +close (cpr_sockfd); +unlink (cpr_path); + } }static void test_mode_transfer (void )
tests/qtest/migration/framework.c +4 -2
@@ -736,7 +736,7 @@ void test_postcopy_recovery_common(MigrateCommon *args)migrate_postcopy_complete (from, to, args); } -void test_precopy_common (MigrateCommon *args) +int test_precopy_common (MigrateCommon *args) {QTestState *from, *to;void *data_hook =NULL ;
@@ -746,7 +746,7 @@ void test_precopy_common(MigrateCommon *args)g_assert (!args->cpr_channel || args->connect_channels);if (migrate_start (&from, &to, args->listen_uri, &args->start)) { -return ; +return -1 ; }if (args->start_hook) {
@@ -869,6 +869,8 @@ finish: }migrate_end (from, to, args->result ==MIG_TEST_SUCCEED ); + +return 0 ; }static void file_dirty_offset_region (void )
Signature · 1 line
2.51.0
Peter Xu
AppliedQuoted 9 lines · Thomas Huth
From: Thomas Huth <[email protected]>
When QEMU has been compiled with "--without-default-devices", the migration cpr-tests are currently failing since the first test leaves a socket file behind that avoids that the second test can be initialized correctly. Make sure that we delete the socket file in case that the
migrate_start()failed due to the missing machine.Signed-off-by Thomas Huth <[email protected]>
queued, thanks.
Signature · 1 line
Peter Xu