From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Juan Quintela" <quintela@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Ani Sinha" <ani@anisinha.ca>,
"Igor Mammedov" <imammedo@redhat.com>,
"Jens Freimann" <jfreimann@redhat.com>
Subject: [PATCH v3 5/5] tests/libqtest: update virtio-net failover test
Date: Thu, 18 Nov 2021 14:32:25 +0100 [thread overview]
Message-ID: <20211118133225.324937-6-lvivier@redhat.com> (raw)
In-Reply-To: <20211118133225.324937-1-lvivier@redhat.com>
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 | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c
index 576d4454c3c3..7cc276e6ffc1 100644
--- a/tests/qtest/virtio-net-failover.c
+++ b/tests/qtest/virtio-net-failover.c
@@ -478,6 +478,7 @@ static void test_outmigrate(gconstpointer opaque)
QTestState *qts;
QDict *resp, *args, *data;
g_autofree gchar *uri = g_strdup_printf("exec: cat > %s", (gchar *)opaque);
+ struct timeval timeout;
qts = machine_start(BASE_MACHINE
"-netdev user,id=hs0 "
@@ -525,11 +526,19 @@ static void test_outmigrate(gconstpointer opaque)
qobject_unref(resp);
- qtest_outl(qts, ACPI_PCIHP_ADDR_ICH9 + PCI_EJ_BASE, 1);
+ /*
+ * The migration cannot start if the card is not ejected,
+ * so we check it cannot end ("STOP") before the card is ejected
+ */
+ /* 10s is enough for ACPI, PCIe native would need at least 30s */
+ timeout.tv_sec = 10;
+ timeout.tv_usec = 0;
+ resp = qtest_qmp_eventwait_timeout(qts, &timeout, "STOP");
+ g_assert_null(resp);
- resp = qtest_qmp_eventwait_ref(qts, "STOP");
- qobject_unref(resp);
+ qtest_outl(qts, ACPI_PCIHP_ADDR_ICH9 + PCI_EJ_BASE, 1);
+ qtest_qmp_eventwait(qts, "STOP");
/*
* in fact, the card is ejected from the point of view of kernel
* but not really from QEMU to be able to hotplug it back if
--
2.33.1
prev parent reply other threads:[~2021-11-18 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-18 13:32 [PATCH v3 0/5] tests/qtest: add some tests for virtio-net failover Laurent Vivier
2021-11-18 13:32 ` [PATCH v3 1/5] qtest/libqos: add a function to initialize secondary PCI buses Laurent Vivier
2021-11-18 13:32 ` [PATCH v3 2/5] tests/qtest: add some tests for virtio-net failover Laurent Vivier
2021-11-18 13:32 ` [PATCH v3 3/5] failover: fix unplug pending detection Laurent Vivier
2021-11-18 13:32 ` [PATCH v3 4/5] libqtest: add a function to use a timeout when waiting for an event Laurent Vivier
2021-11-18 13:32 ` Laurent Vivier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211118133225.324937-6-lvivier@redhat.com \
--to=lvivier@redhat.com \
--cc=ani@anisinha.ca \
--cc=berrange@redhat.com \
--cc=imammedo@redhat.com \
--cc=jfreimann@redhat.com \
--cc=kraxel@redhat.com \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).