From: Thomas Huth <thuth@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Michael Labiuk <michael.labiuk@virtuozzo.com>
Subject: [PULL 04/16] tests/x86: Add subtest with 'q35' machine type to device-plug-test
Date: Wed, 12 Oct 2022 16:33:04 +0200 [thread overview]
Message-ID: <20221012143316.988561-5-thuth@redhat.com> (raw)
In-Reply-To: <20221012143316.988561-1-thuth@redhat.com>
From: Michael Labiuk <michael.labiuk@virtuozzo.com>
Configure pci bridge setting to plug pci device and unplug.
Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com>
Message-Id: <20220929223547.1429580-3-michael.labiuk@virtuozzo.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/device-plug-test.c | 41 ++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index 3841de1b8c..3f44f731d1 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -79,6 +79,19 @@ static void test_pci_unplug_request(void)
qtest_quit(qtest);
}
+static void test_q35_pci_unplug_request(void)
+{
+
+ QTestState *qtest = qtest_initf("-machine q35 "
+ "-device pcie-root-port,id=p1 "
+ "-device pcie-pci-bridge,bus=p1,id=b1 "
+ "-device virtio-mouse-pci,bus=b1,id=dev0");
+
+ process_device_remove(qtest, "dev0");
+
+ qtest_quit(qtest);
+}
+
static void test_pci_unplug_json_request(void)
{
const char *arch = qtest_get_arch();
@@ -97,6 +110,27 @@ static void test_pci_unplug_json_request(void)
qtest_quit(qtest);
}
+static void test_q35_pci_unplug_json_request(void)
+{
+ const char *port = "-device '{\"driver\": \"pcie-root-port\", "
+ "\"id\": \"p1\"}'";
+
+ const char *bridge = "-device '{\"driver\": \"pcie-pci-bridge\", "
+ "\"id\": \"b1\", "
+ "\"bus\": \"p1\"}'";
+
+ const char *device = "-device '{\"driver\": \"virtio-mouse-pci\", "
+ "\"bus\": \"b1\", "
+ "\"id\": \"dev0\"}'";
+
+ QTestState *qtest = qtest_initf("-machine q35 %s %s %s",
+ port, bridge, device);
+
+ process_device_remove(qtest, "dev0");
+
+ qtest_quit(qtest);
+}
+
static void test_ccw_unplug(void)
{
QTestState *qtest = qtest_initf("-device virtio-balloon-ccw,id=dev0");
@@ -176,5 +210,12 @@ int main(int argc, char **argv)
test_spapr_phb_unplug_request);
}
+ if (!strcmp(arch, "x86_64") && qtest_has_machine("q35")) {
+ qtest_add_func("/device-plug/q35-pci-unplug-request",
+ test_q35_pci_unplug_request);
+ qtest_add_func("/device-plug/q35-pci-unplug-json-request",
+ test_q35_pci_unplug_json_request);
+ }
+
return g_test_run();
}
--
2.31.1
next prev parent reply other threads:[~2022-10-12 14:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 14:33 [PULL 00/16] qtest patches (and one unit test and one avocado fix) Thomas Huth
2022-10-12 14:33 ` [PULL 01/16] qtest: "-display none" is set in qtest_init() Thomas Huth
2022-10-12 14:33 ` [PULL 02/16] tests/migration: remove the unused local variable Thomas Huth
2022-10-12 14:33 ` [PULL 03/16] tests/x86: add helper qtest_qmp_device_del_send() Thomas Huth
2022-10-12 14:33 ` Thomas Huth [this message]
2022-10-12 14:33 ` [PULL 05/16] tests/x86: Refactor hot unplug hd-geo-test Thomas Huth
2022-10-12 14:33 ` [PULL 06/16] tests/x86: Add 'q35' machine type to override-tests in hd-geo-test Thomas Huth
2022-10-12 14:33 ` [PULL 07/16] tests/x86: Add 'q35' machine type to hotplug hd-geo-test Thomas Huth
2022-10-12 14:33 ` [PULL 08/16] tests/x86: Fix comment typo in drive_del-test Thomas Huth
2022-10-12 14:33 ` [PULL 09/16] tests/x86: replace snprint() by g_strdup_printf() " Thomas Huth
2022-10-12 14:33 ` [PULL 10/16] tests/x86: Add 'q35' machine type to drive_del-test Thomas Huth
2022-10-12 14:33 ` [PULL 11/16] tests/x86: Add 'q35' machine type to ivshmem-test Thomas Huth
2022-10-12 14:33 ` [PULL 12/16] tests/avocado: Add missing require_netdev('user') checks Thomas Huth
2022-10-12 14:33 ` [PULL 13/16] qtest: start a VNC test Thomas Huth
2022-10-12 14:33 ` [PULL 14/16] tests/qtest: migration-test: Avoid using hardcoded /tmp Thomas Huth
2022-10-12 14:33 ` [PULL 15/16] tests/qtest: libqtest: Install signal handler via signal() Thomas Huth
2022-10-12 14:33 ` [PULL 16/16] tests/unit/test-image-locking: Fix handling of temporary files Thomas Huth
2022-10-13 20:29 ` [PULL 00/16] qtest patches (and one unit test and one avocado fix) Stefan Hajnoczi
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=20221012143316.988561-5-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=michael.labiuk@virtuozzo.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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).