qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/7] tests/x86: Add subtest with 'q35' machine type to dev


From: Thomas Huth
Subject: Re: [PATCH v4 2/7] tests/x86: Add subtest with 'q35' machine type to device-plug-test
Date: Tue, 27 Sep 2022 12:40:08 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

On 20/09/2022 12.48, Michael Labiuk wrote:
Configure pci bridge setting to plug pci device and unplug.

Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.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 e595b45b66..d66c386ef4 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -90,6 +90,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();
@@ -108,6 +121,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");
@@ -187,5 +221,12 @@ int main(int argc, char **argv)
                         test_spapr_phb_unplug_request);
      }
+ if (!strcmp(arch, "x86_64")) {

We should maybe also add a qtest_has_machine("q35") after the strcmp here (there have recently been some efforts to make the qtests also run right if one of the x86 machines has been disabled in the build)

 Thomas


+        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();
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]