aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Labiuk <michael.labiuk@virtuozzo.com>2022-09-30 01:35:40 +0300
committerThomas Huth <thuth@redhat.com>2022-10-11 14:06:52 +0200
commita12f1a7e56b7f21fee49f419dd4220c4b9e0ee7f (patch)
tree47d23c9def4847b31b38db758d70aef78212bc33 /tests
parentea42a6c405269229d0923719854637425be07b31 (diff)
downloadqemu-a12f1a7e56b7f21fee49f419dd4220c4b9e0ee7f.zip
qemu-a12f1a7e56b7f21fee49f419dd4220c4b9e0ee7f.tar.gz
qemu-a12f1a7e56b7f21fee49f419dd4220c4b9e0ee7f.tar.bz2
tests/x86: Add subtest with 'q35' machine type to device-plug-test
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/device-plug-test.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index 3841de1..3f44f73 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();
}