[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 4/6] tests/libqtest: update virtio-net failover test
From: |
Laurent Vivier |
Subject: |
[PATCH v6 4/6] tests/libqtest: update virtio-net failover test |
Date: |
Mon, 6 Dec 2021 23:20:38 +0100 |
Update the migration test to check we correctly wait the end
of the card unplug before doing the migration.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
tests/qtest/virtio-net-failover.c | 34 +++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tests/qtest/virtio-net-failover.c
b/tests/qtest/virtio-net-failover.c
index f8f5fbb3c7fe..c88f8ddec39a 100644
--- a/tests/qtest/virtio-net-failover.c
+++ b/tests/qtest/virtio-net-failover.c
@@ -560,6 +560,40 @@ static void test_migrate_out(gconstpointer opaque)
qobject_unref(resp);
+ /* wait the end of the migration setup phase */
+ while (true) {
+ ret = migrate_status(qts);
+
+ status = qdict_get_str(ret, "status");
+ if (strcmp(status, "wait-unplug") == 0) {
+ break;
+ }
+
+ /* The migration must not start if the card is not ejected */
+ g_assert_cmpstr(status, !=, "active");
+ g_assert_cmpstr(status, !=, "completed");
+ g_assert_cmpstr(status, !=, "failed");
+ g_assert_cmpstr(status, !=, "cancelling");
+ g_assert_cmpstr(status, !=, "cancelled");
+
+ qobject_unref(ret);
+ }
+ qobject_unref(ret);
+
+ if (g_test_slow()) {
+ /* check we stay in wait-unplug while the card is not ejected */
+ int i;
+
+ for (i = 0; i < 10; i++) {
+ sleep(1);
+ ret = migrate_status(qts);
+ status = qdict_get_str(ret, "status");
+ g_assert_cmpstr(status, ==, "wait-unplug");
+ qobject_unref(ret);
+ }
+ }
+
+ /* OS unplugs the cards, QEMU can move from wait-unplug state */
qtest_outl(qts, ACPI_PCIHP_ADDR_ICH9 + PCI_EJ_BASE, 1);
while (true) {
--
2.33.1