qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, pbonzini@redhat.com, eduardo@habkost.net,
	mst@redhat.com, thuth@redhat.com, berrange@redhat.com,
	quintela@redhat.com
Subject: [PATCH 2/3] tests/x86: Use 'pc' machine type for hotplug tests
Date: Tue, 15 Feb 2022 16:25:36 +0000	[thread overview]
Message-ID: <20220215162537.605030-7-dgilbert@redhat.com> (raw)
In-Reply-To: <20220215162537.605030-1-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Hotplug tests need a bridge setting up on q35, for now
keep them on 'pc'.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 tests/qtest/device-plug-test.c | 20 +++++++++++++++++--
 tests/qtest/drive_del-test.c   | 35 +++++++++++++++++++++++++++++-----
 tests/qtest/hd-geo-test.c      |  4 ++--
 tests/qtest/ivshmem-test.c     |  7 ++++++-
 4 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index ad79bd4c14..404a92e132 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -63,7 +63,15 @@ static void wait_device_deleted_event(QTestState *qtest, const char *id)
 
 static void test_pci_unplug_request(void)
 {
-    QTestState *qtest = qtest_initf("-device virtio-mouse-pci,id=dev0");
+    const char *arch = qtest_get_arch();
+    const char *machine_addition = "";
+
+    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);
 
     /*
      * Request device removal. As the guest is not running, the request won't
@@ -79,8 +87,16 @@ static void test_pci_unplug_request(void)
 
 static void test_pci_unplug_json_request(void)
 {
+    const char *arch = qtest_get_arch();
+    const char *machine_addition = "";
+
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        machine_addition = "-machine pc";
+    }
+
     QTestState *qtest = qtest_initf(
-        "-device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'");
+        "%s -device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'",
+        machine_addition);
 
     /*
      * Request device removal. As the guest is not running, the request won't
diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index 8d08ee9995..0cc18dfa4a 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -235,14 +235,21 @@ static void test_drive_del_device_del(void)
 static void test_cli_device_del(void)
 {
     QTestState *qts;
+    const char *arch = qtest_get_arch();
+    const char *machine_addition = "";
+
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        machine_addition = "-machine pc";
+    }
 
     /*
      * -drive/-device and device_del.  Start with a drive used by a
      * device that unplugs after reset.
      */
-    qts = qtest_initf("-drive if=none,id=drive0,file=null-co://,"
+    qts = qtest_initf("%s -drive if=none,id=drive0,file=null-co://,"
                       "file.read-zeroes=on,format=raw"
                       " -device virtio-blk-%s,drive=drive0,id=dev0",
+                      machine_addition,
                       qvirtio_get_dev_type());
 
     device_del(qts, true);
@@ -266,13 +273,19 @@ static void test_empty_device_del(void)
 static void test_device_add_and_del(void)
 {
     QTestState *qts;
+    const char *arch = qtest_get_arch();
+    const char *machine_addition = "";
+
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        machine_addition = "-machine pc";
+    }
 
     /*
      * -drive/device_add and device_del.  Start with a drive used by a
      * device that unplugs after reset.
      */
-    qts = qtest_init("-drive if=none,id=drive0,file=null-co://,"
-                     "file.read-zeroes=on,format=raw");
+    qts = qtest_initf("%s -drive if=none,id=drive0,file=null-co://,"
+                     "file.read-zeroes=on,format=raw", machine_addition);
 
     device_add(qts);
     device_del(qts, true);
@@ -284,8 +297,14 @@ static void test_device_add_and_del(void)
 static void test_drive_add_device_add_and_del(void)
 {
     QTestState *qts;
+    const char *arch = qtest_get_arch();
+    const char *machine_addition = "";
+
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        machine_addition = "-machine pc";
+    }
 
-    qts = qtest_init("");
+    qts = qtest_init(machine_addition);
 
     /*
      * drive_add/device_add and device_del.  The drive is used by a
@@ -302,8 +321,14 @@ static void test_drive_add_device_add_and_del(void)
 static void test_blockdev_add_device_add_and_del(void)
 {
     QTestState *qts;
+    const char *arch = qtest_get_arch();
+    const char *machine_addition = "";
+
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        machine_addition = "-machine pc";
+    }
 
-    qts = qtest_init("");
+    qts = qtest_init(machine_addition);
 
     /*
      * blockdev_add/device_add and device_del.  The it drive is used by a
diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c
index 3554b5d500..64023c0574 100644
--- a/tests/qtest/hd-geo-test.c
+++ b/tests/qtest/hd-geo-test.c
@@ -839,7 +839,7 @@ static void test_override_scsi_hot_unplug(void)
 
     joined_args = g_strjoinv(" ", args->argv);
 
-    qts = qtest_init(joined_args);
+    qts = qtest_initf("-machine pc %s", joined_args);
     fw_cfg = pc_fw_cfg_init(qts);
 
     read_bootdevices(fw_cfg, expected);
@@ -899,7 +899,7 @@ static void test_override_virtio_hot_unplug(void)
 
     joined_args = g_strjoinv(" ", args->argv);
 
-    qts = qtest_init(joined_args);
+    qts = qtest_initf("-machine pc %s", joined_args);
     fw_cfg = pc_fw_cfg_init(qts);
 
     read_bootdevices(fw_cfg, expected);
diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c
index fe94dd3b96..4e8af42a9d 100644
--- a/tests/qtest/ivshmem-test.c
+++ b/tests/qtest/ivshmem-test.c
@@ -385,7 +385,12 @@ static void test_ivshmem_hotplug(void)
     QTestState *qts;
     const char *arch = qtest_get_arch();
 
-    qts = qtest_init("-object memory-backend-ram,size=1M,id=mb1");
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        qts = qtest_init("-object memory-backend-ram,size=1M,id=mb1"
+                         " -machine pc");
+    } else {
+        qts = qtest_init("-object memory-backend-ram,size=1M,id=mb1");
+    }
 
     qtest_qmp_device_add(qts, "ivshmem-plain", "iv1",
                          "{'addr': %s, 'memdev': 'mb1'}",
-- 
2.35.1



  parent reply	other threads:[~2022-02-15 16:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 16:25 [PATCH 0/3] x86: Switch over to q35 as the default machine type Dr. David Alan Gilbert (git)
2022-02-15 16:25 ` [PATCH 1/3] tests/x86: Use 'pc' machine type for old hardware tests Dr. David Alan Gilbert (git)
2022-02-17  8:04   ` Thomas Huth
2022-02-17  8:18   ` Michael S. Tsirkin
2022-02-15 16:25 ` [PATCH 2/3] tests/x86: Use 'pc' machine type for hotplug tests Dr. David Alan Gilbert (git)
2022-02-17  8:09   ` Thomas Huth
2022-02-17  8:18   ` Michael S. Tsirkin
2022-02-15 16:25 ` [PATCH 3/3] x86: Switch to q35 as the default machine type Dr. David Alan Gilbert (git)
2022-02-15 18:13   ` Daniel P. Berrangé
2022-02-15 18:29     ` Dr. David Alan Gilbert
2022-02-16 10:58     ` Gerd Hoffmann
2022-02-16 11:01       ` Dr. David Alan Gilbert
2022-02-16 11:23         ` Daniel P. Berrangé
2022-02-16 11:24         ` Thomas Huth
2022-02-16 17:40           ` Dr. David Alan Gilbert
2022-02-16 17:48             ` Daniel P. Berrangé
2022-02-16 17:57               ` Dr. David Alan Gilbert
2022-02-17  7:46                 ` Thomas Huth
2022-02-17  7:52                   ` Michael S. Tsirkin
2022-02-17  9:29                 ` Daniel P. Berrangé
2022-02-17  9:43                   ` Dr. David Alan Gilbert
2022-02-17  7:57             ` Thomas Huth
2022-02-17  8:08               ` Gerd Hoffmann
2022-02-17  8:17                 ` Michael S. Tsirkin
2022-02-17  9:16                   ` Daniel P. Berrangé
2022-02-17  9:35                   ` Igor Mammedov
2022-02-17  9:19               ` Kashyap Chamarthy
2022-02-15 16:25 ` [PATCH 0/3] x86: Switch over " Dr. David Alan Gilbert (git)
2022-02-15 16:25 ` [PATCH 1/3] tests/x86: Use 'pc' machine type for old hardware tests Dr. David Alan Gilbert (git)
2022-02-15 16:25 ` Dr. David Alan Gilbert (git) [this message]
2022-02-15 16:25 ` [PATCH 3/3] x86: Switch to q35 as the default machine type Dr. David Alan Gilbert (git)

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=20220215162537.605030-7-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eduardo@habkost.net \
    --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).