thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-virtio-net-test-accept-variable-length-argument-in-p.patch

26ba25
From 40e52779c8876bc453e5d23e6b36e6f0d7302fa4 Mon Sep 17 00:00:00 2001
26ba25
From: Xiao Wang <jasowang@redhat.com>
26ba25
Date: Fri, 11 Jan 2019 07:59:02 +0000
26ba25
Subject: [PATCH 07/11] virtio-net-test: accept variable length argument in
26ba25
 pci_test_start()
26ba25
MIME-Version: 1.0
26ba25
Content-Type: text/plain; charset=UTF-8
26ba25
Content-Transfer-Encoding: 8bit
26ba25
26ba25
RH-Author: Xiao Wang <jasowang@redhat.com>
26ba25
Message-id: <20190111075904.2030-8-jasowang@redhat.com>
26ba25
Patchwork-id: 83981
26ba25
O-Subject: [RHEL8 qemu-kvm PATCH 7/9] virtio-net-test: accept variable length argument in pci_test_start()
26ba25
Bugzilla: 1636784
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
26ba25
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
26ba25
RH-Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
26ba25
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
26ba25
26ba25
This allows flexibility to be reused for all kinds of command line
26ba25
used by other tests.
26ba25
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
Reviewed-by: Thomas Huth <thuth@redhat.com>
26ba25
Signed-off-by: Jason Wang <jasowang@redhat.com>
26ba25
Message-id: 20181204035347.6148-4-jasowang@redhat.com
26ba25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26ba25
(cherry picked from commit ae4c445c6f38a01504b7040b1e01a69945137b0c)
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 tests/virtio-net-test.c | 17 +++++++++++------
26ba25
 1 file changed, 11 insertions(+), 6 deletions(-)
26ba25
26ba25
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
26ba25
index b285a26..ad6968c 100644
26ba25
--- a/tests/virtio-net-test.c
26ba25
+++ b/tests/virtio-net-test.c
26ba25
@@ -52,17 +52,21 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)
26ba25
     return dev;
26ba25
 }
26ba25
 
26ba25
-static QOSState *pci_test_start(int socket)
26ba25
+GCC_FMT_ATTR(1, 2)
26ba25
+static QOSState *pci_test_start(const char *cmd, ...)
26ba25
 {
26ba25
     QOSState *qs;
26ba25
+    va_list ap;
26ba25
     const char *arch = qtest_get_arch();
26ba25
-    const char *cmd = "-netdev socket,fd=%d,id=hs0 -device "
26ba25
-                      "virtio-net-pci,netdev=hs0";
26ba25
 
26ba25
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
26ba25
-        qs = qtest_pc_boot(cmd, socket);
26ba25
+        va_start(ap, cmd);
26ba25
+        qs = qtest_pc_vboot(cmd, ap);
26ba25
+        va_end(ap);
26ba25
     } else if (strcmp(arch, "ppc64") == 0) {
26ba25
-        qs = qtest_spapr_boot(cmd, socket);
26ba25
+        va_start(ap, cmd);
26ba25
+        qs = qtest_spapr_vboot(cmd, ap);
26ba25
+        va_end(ap);
26ba25
     } else {
26ba25
         g_printerr("virtio-net tests are only available on x86 or ppc64\n");
26ba25
         exit(EXIT_FAILURE);
26ba25
@@ -223,7 +227,8 @@ static void pci_basic(gconstpointer data)
26ba25
     ret = socketpair(PF_UNIX, SOCK_STREAM, 0, sv);
26ba25
     g_assert_cmpint(ret, !=, -1);
26ba25
 
26ba25
-    qs = pci_test_start(sv[1]);
26ba25
+    qs = pci_test_start("-netdev socket,fd=%d,id=hs0 -device "
26ba25
+                        "virtio-net-pci,netdev=hs0", sv[1]);
26ba25
     dev = virtio_net_pci_init(qs->pcibus, PCI_SLOT);
26ba25
 
26ba25
     rx = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, qs->alloc, 0);
26ba25
-- 
26ba25
1.8.3.1
26ba25