qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/qtest/migration: Fix cpr-tests in case the machine is not available
@ 2025-09-30  9:09 Thomas Huth
  2025-09-30 15:02 ` Peter Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2025-09-30  9:09 UTC (permalink / raw)
  To: Fabiano Rosas, Peter Xu, qemu-devel; +Cc: Steve Sistare

From: Thomas Huth <thuth@redhat.com>

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 <thuth@redhat.com>
---
 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(-)

diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/framework.h
index 01e425e64e2..744040d53a1 100644
--- a/tests/qtest/migration/framework.h
+++ b/tests/qtest/migration/framework.h
@@ -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,
diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-tests.c
index 5e764a67876..c4ce60ff66b 100644
--- a/tests/qtest/migration/cpr-tests.c
+++ b/tests/qtest/migration/cpr-tests.c
@@ -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)
diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
index 407c9023c05..a044b354658 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -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)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests/qtest/migration: Fix cpr-tests in case the machine is not available
  2025-09-30  9:09 [PATCH] tests/qtest/migration: Fix cpr-tests in case the machine is not available Thomas Huth
@ 2025-09-30 15:02 ` Peter Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Xu @ 2025-09-30 15:02 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Fabiano Rosas, qemu-devel, Steve Sistare

On Tue, Sep 30, 2025 at 11:09:32AM +0200, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> 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 <thuth@redhat.com>

queued, thanks.

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-30 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30  9:09 [PATCH] tests/qtest/migration: Fix cpr-tests in case the machine is not available Thomas Huth
2025-09-30 15:02 ` Peter Xu

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).