aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/device-plug-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qtest/device-plug-test.c')
-rw-r--r--tests/qtest/device-plug-test.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index 5a6afa2b57..01cecd6e20 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -64,15 +64,21 @@ static void process_device_remove(QTestState *qtest, const char *id)
static void test_pci_unplug_request(void)
{
+ QTestState *qtest;
const char *arch = qtest_get_arch();
const char *machine_addition = "";
+ if (!qtest_has_device("virtio-mouse-pci")) {
+ g_test_skip("Device virtio-mouse-pci not available");
+ return;
+ }
+
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
machine_addition = "-machine pc";
}
- QTestState *qtest = qtest_initf("%s -device virtio-mouse-pci,id=dev0",
- machine_addition);
+ qtest = qtest_initf("%s -device virtio-mouse-pci,id=dev0",
+ machine_addition);
process_device_remove(qtest, "dev0");
@@ -81,11 +87,17 @@ static void test_pci_unplug_request(void)
static void test_q35_pci_unplug_request(void)
{
+ QTestState *qtest;
+
+ if (!qtest_has_device("virtio-mouse-pci")) {
+ g_test_skip("Device virtio-mouse-pci not available");
+ return;
+ }
- 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");
+ 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");
@@ -94,14 +106,20 @@ static void test_q35_pci_unplug_request(void)
static void test_pci_unplug_json_request(void)
{
+ QTestState *qtest;
const char *arch = qtest_get_arch();
const char *machine_addition = "";
+ if (!qtest_has_device("virtio-mouse-pci")) {
+ g_test_skip("Device virtio-mouse-pci not available");
+ return;
+ }
+
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
machine_addition = "-machine pc";
}
- QTestState *qtest = qtest_initf(
+ qtest = qtest_initf(
"%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"",
machine_addition);
@@ -112,6 +130,7 @@ static void test_pci_unplug_json_request(void)
static void test_q35_pci_unplug_json_request(void)
{
+ QTestState *qtest;
const char *port = "-device \"{'driver': 'pcie-root-port', "
"'id': 'p1'}\"";
@@ -123,8 +142,12 @@ static void test_q35_pci_unplug_json_request(void)
"'bus': 'b1', "
"'id': 'dev0'}\"";
- QTestState *qtest = qtest_initf("-machine q35 %s %s %s",
- port, bridge, device);
+ if (!qtest_has_device("virtio-mouse-pci")) {
+ g_test_skip("Device virtio-mouse-pci not available");
+ return;
+ }
+
+ qtest = qtest_initf("-machine q35 %s %s %s", port, bridge, device);
process_device_remove(qtest, "dev0");