Skip to contentSkip to conversation

qtest: Prepare virtio, other PCI tests

PATCH Applied Andreas Färber 3 participants 26 messages Mar 12, 2014 – Mar 27, 2014

lore
Share & tools
lore
#0 lore raw

v3 cover qtest: Prepare virtio, other PCI tests

Hello Michael, Amit and Stefan,

This series starts preparing tests to cover optional PCI devices. They don't do any functional tests but assure that QOM/PCI/VMState refactorings don't break the basic usage of devices not covered by qom-test.

v3 covers all virtio devices plus pvpanic, nvme, i82801b11, spapr-pci-host-bridge.
* virtio-blk and nvme use /dev/null.
* virtio-9p uses a temporary directory.

I intend to pick those already posted plus the virtio-console tests into my pull.

Regards,
Andreas

v2 -> v3:
* Added virtio-scsi, virtio-9p, virtio-serial-bus, virtio-console tests
* Added pvpanic tests - required libqtest API changes
* Added nvme test - required nvme change
* Added i82801b11 test
* Rebased on 9p config changes
* Queued spapr-pci-host-bridge test (Alexey)

v1 -> v2:
* Reordered includes (stefanha)
* Used qtest_end() where applicable
* Added qtest for tpci200 and ipoctal232 (for my IndustryPack refactoring series)
* Added qtests for ne2000, virtio-net, virtio-blk, virtio-balloon, virtio-rng

Cc Stefan Hajnoczi <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Amit Shah <[email protected]>
Cc Kevin Wolf <[email protected]>
Cc Anthony Liguori <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Alexey Kardashevskiy <[email protected]>

Alexey Kardashevskiy (1):
tests: Add spapr-pci-host-bridge qtest

Andreas Färber (14):
tests: Clean up IndustryPack TCPI200 gcov paths
tests: Add virtio-blk qtest
tests: Add virtio-balloon qtest
tests: Add virtio-rng qtest
tests: Add virtio-scsi qtest
tests: Add virtio-9p qtest
tests: Add virtio-serial qtest
tests: Add virtio-console qtest
tests: Add pvpanic qtest
qtest: Factor out qtest_qmp_receive()
pvpanic-test: Assert pause event
nvme: Permit zero-length block devices
tests: Add nvme qtest
tests: Add i82801b11 qtest

 hw/block/nvme.c             |  4 ++--
 tests/Makefile              | 43 +++++++++++++++++++++++++++++++++++++++--
 tests/i82801b11-test.c      | 33 +++++++++++++++++++++++++++++++
 tests/libqtest.c            | 15 ++++++++++-----
 tests/libqtest.h            | 18 +++++++++++++++++
 tests/nvme-test.c           | 34 ++++++++++++++++++++++++++++++++
 tests/pvpanic-test.c        | 47 +++++++++++++++++++++++++++++++++++++++++++++
 tests/spapr-phb-test.c      | 35 +++++++++++++++++++++++++++++++++
 tests/virtio-9p-test.c      | 46 ++++++++++++++++++++++++++++++++++++++++++++
 tests/virtio-balloon-test.c | 33 +++++++++++++++++++++++++++++++
 tests/virtio-blk-test.c     | 34 ++++++++++++++++++++++++++++++++
 tests/virtio-console-test.c | 34 ++++++++++++++++++++++++++++++++
 tests/virtio-rng-test.c     | 33 +++++++++++++++++++++++++++++++
 tests/virtio-scsi-test.c    | 35 +++++++++++++++++++++++++++++++++
 tests/virtio-serial-test.c  | 33 +++++++++++++++++++++++++++++++
 15 files changed, 468 insertions(+), 9 deletions(-)
 create mode 100644 tests/i82801b11-test.c
 create mode 100644 tests/nvme-test.c
 create mode 100644 tests/pvpanic-test.c
 create mode 100644 tests/spapr-phb-test.c
 create mode 100644 tests/virtio-9p-test.c
 create mode 100644 tests/virtio-balloon-test.c
 create mode 100644 tests/virtio-blk-test.c
 create mode 100644 tests/virtio-console-test.c
 create mode 100644 tests/virtio-rng-test.c
 create mode 100644 tests/virtio-scsi-test.c
 create mode 100644 tests/virtio-serial-test.c
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH v3 1/15 tests: Clean up IndustryPack TCPI200 gcov paths

---
 tests/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/Makefile +2 -2
index e146f81..1dc24c8 100644
@@ -87,9 +87,9 @@ gcov-files-pci-y += hw/net/ne2000.c
 check-qtest-pci-y += $(check-qtest-virtio-y)
 gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
 check-qtest-pci-y += tests/tpci200-test$(EXESUF)
-gcov-files-pci-y += hw/char/tpci200.c
+gcov-files-pci-y += hw/ipack/tpci200.c
 check-qtest-pci-y += $(check-qtest-ipack-y)
-gcov-files-pci-y += $(gcov-files-ipack-y) hw/ipack/tpci200.c
+gcov-files-pci-y += $(gcov-files-ipack-y)
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
Signature · 1 line
1.8.4.5
#2 lore raw

PATCH v3 2/15 tests: Add virtio-blk qtest

In reply to Andreas Färber
---
 tests/Makefile          |  3 +++
 tests/virtio-blk-test.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 tests/virtio-blk-test.c
tests/Makefile +3 -0
index 1dc24c8..d5a3f10 100644
@@ -72,6 +72,8 @@ gcov-files-ipack-y += hw/char/ipoctal232.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
+check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
+gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -239,6 +241,7 @@ tests/pcnet-test$(EXESUF): tests/pcnet-test.o
 tests/eepro100-test$(EXESUF): tests/eepro100-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/ne2000-test$(EXESUF): tests/ne2000-test.o
+tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
tests/virtio-blk-test.c new file +34 -0
new file mode 100644
index 0000000..d53f875
@@ -0,0 +1,34 @@
+/*
+ * QTest testcase for VirtIO Block Device
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/blk/pci/nop", pci_nop);
+
+    qtest_start("-drive id=drv0,if=none,file=/dev/null "
+                "-device virtio-blk-pci,drive=drv0");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#3 lore raw

PATCH v3 3/15 tests: Add virtio-balloon qtest

In reply to Andreas Färber
---
 tests/Makefile              |  3 +++
 tests/virtio-balloon-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/virtio-balloon-test.c
tests/Makefile +3 -0
index d5a3f10..d4f23df 100644
@@ -72,6 +72,8 @@ gcov-files-ipack-y += hw/char/ipoctal232.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
+check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
+gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
 check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 
@@ -241,6 +243,7 @@ tests/pcnet-test$(EXESUF): tests/pcnet-test.o
 tests/eepro100-test$(EXESUF): tests/eepro100-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/ne2000-test$(EXESUF): tests/ne2000-test.o
+tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o
 tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
tests/virtio-balloon-test.c new file +33 -0
new file mode 100644
index 0000000..becebb5
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for VirtIO Balloon
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/balloon/pci/nop", pci_nop);
+
+    qtest_start("-device virtio-balloon-pci");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#4 lore raw

PATCH v3 4/15 tests: Add virtio-rng qtest

In reply to Andreas Färber
---
 tests/Makefile          |  3 +++
 tests/virtio-rng-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/virtio-rng-test.c
tests/Makefile +3 -0
index d4f23df..308a5a2 100644
@@ -76,6 +76,8 @@ check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
 check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
+check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
+gcov-files-virtio-y += hw/virtio/virtio-rng.c
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -246,6 +248,7 @@ tests/ne2000-test$(EXESUF): tests/ne2000-test.o
 tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o
 tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
+tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-rng-test.c new file +33 -0
new file mode 100644
index 0000000..402c206
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for VirtIO RNG
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/rng/pci/nop", pci_nop);
+
+    qtest_start("-device virtio-rng-pci");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#5 lore raw

PATCH v3 5/15 tests: Add virtio-scsi qtest

In reply to Andreas Färber
---
 tests/Makefile           |  3 +++
 tests/virtio-scsi-test.c | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 tests/virtio-scsi-test.c
tests/Makefile +3 -0
index 308a5a2..75b4659 100644
@@ -78,6 +78,8 @@ check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
+check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
+gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -249,6 +251,7 @@ tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o
 tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
+tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-scsi-test.c new file +35 -0
new file mode 100644
index 0000000..3230908
@@ -0,0 +1,35 @@
+/*
+ * QTest testcase for VirtIO SCSI
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/scsi/pci/nop", pci_nop);
+
+    qtest_start("-drive id=drv0,if=none,file=/dev/null "
+                "-device virtio-scsi-pci,id=vscsi0 "
+                "-device scsi-hd,bus=vscsi0.0,drive=drv0");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#6 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 05/15] tests: Add virtio-scsi qtest

Il 12/03/2014 19:28, Andreas Färber ha scritto:

Quoted 61 lines
---
 tests/Makefile           |  3 +++
 tests/virtio-scsi-test.c | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 tests/virtio-scsi-test.c
tests/Makefile +3 -0
index 308a5a2..75b4659 100644
@@ -78,6 +78,8 @@ check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
+check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
+gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -249,6 +251,7 @@ tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o
 tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
+tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-scsi-test.c new file +25 -0
new file mode 100644
index 0000000..3230908
@@ -0,0 +1,35 @@
+/*
+ * QTest testcase for VirtIO SCSI
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/scsi/pci/nop", pci_nop);

tests/virtio-scsi-test.c line 35

Quoted 10 lines
tests/virtio-scsi-test.c new file +10 -0
+
+    qtest_start("-drive id=drv0,if=none,file=/dev/null "
+                "-device virtio-scsi-pci,id=vscsi0 "
+                "-device scsi-hd,bus=vscsi0.0,drive=drv0");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}

ACK

If we get a summer of code student, we could aim at making these tests work on all PCI platforms.

Paolo

#7 lore raw

PATCH v3 6/15 tests: Add virtio-9p qtest

In reply to Andreas Färber

Make it conditional to 9p availability.
Create a temporary directory to share.

---
 tests/Makefile         |  6 ++++++
 tests/virtio-9p-test.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 tests/virtio-9p-test.c
tests/Makefile +6 -0
index 75b4659..117e606 100644
@@ -80,6 +80,11 @@ check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
 check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
+ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
+check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
+gcov-files-virtio-y += hw/9pfs/virtio-9p.c
+gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
+endif
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -252,6 +257,7 @@ tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
+tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-9p-test.c new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
1.8.4.5
#8 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 06/15] tests: Add virtio-9p qtest

Am 12.03.2014 19:28, schrieb Andreas Färber:

Quoted 9 lines

Make it conditional to 9p availability.
Create a temporary directory to share.

---
 tests/Makefile         |  6 ++++++
 tests/virtio-9p-test.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 tests/virtio-9p-test.c

Ping! Any objections to applying this first conditional test case? This would complete the virtio tests, I believe.

Thanks,
Andreas

Quoted 78 lines
tests/Makefile +6 -0
index 75b4659..117e606 100644
@@ -80,6 +80,11 @@ check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
 check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
+ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
+check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
+gcov-files-virtio-y += hw/9pfs/virtio-9p.c
+gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
+endif
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -252,6 +257,7 @@ tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
+tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-9p-test.c new file +46 -0
new file mode 100644
index 0000000..1fae477
@@ -0,0 +1,46 @@
+/*
+ * QTest testcase for VirtIO 9P
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include "libqtest.h"
+#include "qemu-common.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+static char test_share[] = "/tmp/qtest.XXXXXX";
+
+int main(int argc, char **argv)
+{
+    char *args;
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/9p/pci/nop", pci_nop);
+
+    g_assert(mkdtemp(test_share));
+
+    args = g_strdup_printf("-fsdev local,id=fsdev0,security_model=none,path=%s "
+                           "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=qtest",
+                           test_share);
+    qtest_start(args);
+    g_free(args);
+
+    ret = g_test_run();
+
+    qtest_end();
+    rmdir(test_share);
+
+    return ret;
+}
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#9 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 06/15] tests: Add virtio-9p qtest

Il 27/03/2014 17:01, Andreas Färber ha scritto:

Quoted 87 lines

Am 12.03.2014 19:28, schrieb Andreas Färber:

Quoted 9 lines

Make it conditional to 9p availability.
Create a temporary directory to share.

---
 tests/Makefile         |  6 ++++++
 tests/virtio-9p-test.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 tests/virtio-9p-test.c

Ping! Any objections to applying this first conditional test case? This would complete the virtio tests, I believe.

Thanks,
Andreas

Quoted 70 lines
tests/Makefile +6 -0
index 75b4659..117e606 100644
@@ -80,6 +80,11 @@ check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
 check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
+ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
+check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
+gcov-files-virtio-y += hw/9pfs/virtio-9p.c
+gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
+endif
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -252,6 +257,7 @@ tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
+tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-9p-test.c new file +39 -0
new file mode 100644
index 0000000..1fae477
@@ -0,0 +1,46 @@
+/*
+ * QTest testcase for VirtIO 9P
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include "libqtest.h"
+#include "qemu-common.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+static char test_share[] = "/tmp/qtest.XXXXXX";
+
+int main(int argc, char **argv)
+{
+    char *args;
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/9p/pci/nop", pci_nop);
+
+    g_assert(mkdtemp(test_share));
+
+    args = g_strdup_printf("-fsdev local,id=fsdev0,security_model=none,path=%s "
+                           "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=qtest",
+                           test_share);
+    qtest_start(args);
+    g_free(args);
+
Quoted 10 lines

tests/virtio-9p-test.c line 46

Quoted 8 lines
tests/virtio-9p-test.c new file +7 -0
+    ret = g_test_run();
+
+    qtest_end();
+    rmdir(test_share);
+
+    return ret;
+}

Fine by me.

Paolo

#10 lore raw

PATCH v3 7/15 tests: Add virtio-serial qtest

In reply to Andreas Färber
---
 tests/Makefile             |  3 +++
 tests/virtio-serial-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/virtio-serial-test.c
tests/Makefile +3 -0
index 117e606..5c402d5 100644
@@ -85,6 +85,8 @@ check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
 gcov-files-virtio-y += hw/9pfs/virtio-9p.c
 gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
 endif
+check-qtest-virtio-y += tests/virtio-serial-test$(EXESUF)
+gcov-files-virtio-y += i386-softmmu/hw/char/virtio-serial-bus.c
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -258,6 +260,7 @@ tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
 tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o
+tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-serial-test.c new file +33 -0
new file mode 100644
index 0000000..e743875
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for VirtIO Serial
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/serial/pci/nop", pci_nop);
+
+    qtest_start("-device virtio-serial-pci");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#11 lore raw

PATCH v3 8/15 tests: Add virtio-console qtest

In reply to Andreas Färber
---
 tests/Makefile              |  6 ++++++
 tests/virtio-console-test.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 tests/virtio-console-test.c
tests/Makefile +6 -0
index 5c402d5..e13e98a 100644
@@ -69,6 +69,9 @@ gcov-files-ipack-y += hw/ipack/ipack.c
 check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
 gcov-files-ipack-y += hw/char/ipoctal232.c
 
+check-qtest-virtioserial-y += tests/virtio-console-test$(EXESUF)
+gcov-files-virtioserial-y += hw/char/virtio-console.c
+
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
@@ -87,6 +90,8 @@ gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
 endif
 check-qtest-virtio-y += tests/virtio-serial-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/char/virtio-serial-bus.c
+check-qtest-virtio-y += $(check-qtest-virtioserial-y)
+gcov-files-virtio-y += $(gcov-files-virtioserial-y)
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
@@ -261,6 +266,7 @@ tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o
 tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o
 tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o
+tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
tests/virtio-console-test.c new file +34 -0
new file mode 100644
index 0000000..f98f5af2
@@ -0,0 +1,34 @@
+/*
+ * QTest testcase for VirtIO Console
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/console/pci/nop", pci_nop);
+
+    qtest_start("-device virtio-serial-pci,id=vser0 "
+                "-device virtconsole,bus=vser0.0");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#12 lore raw

PATCH v3 9/15 tests: Add pvpanic qtest

In reply to Andreas Färber
---
 tests/Makefile       |  3 +++
 tests/pvpanic-test.c | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 tests/pvpanic-test.c
tests/Makefile +3 -0
index e13e98a..23e764d 100644
@@ -130,6 +130,8 @@ check-qtest-i386-y += tests/vmxnet3-test$(EXESUF)
 gcov-files-i386-y += hw/net/vmxnet3.c
 gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c
 gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c
+check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
+gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -272,6 +274,7 @@ tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
+tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 
 # QTest rules
tests/pvpanic-test.c new file +38 -0
new file mode 100644
index 0000000..7bb4d06
@@ -0,0 +1,38 @@
+/*
+ * QTest testcase for PV Panic
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+static void test_panic(void)
+{
+    uint8_t val;
+
+    val = inb(0x505);
+    g_assert_cmpuint(val, ==, 1);
+
+    outb(0x505, 0x1);
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/pvpanic/panic", test_panic);
+
+    qtest_start("-device pvpanic");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#13 lore raw

PATCH v3 10/15 qtest: Factor out qtest_qmp_receive()

In reply to Andreas Färber
---
 tests/libqtest.c | 15 ++++++++++-----
 tests/libqtest.h | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+), 5 deletions(-)
tests/libqtest.c +10 -5
index f587d36..fe96005 100644
@@ -309,14 +309,10 @@ static void qmp_response(JSONMessageParser *parser, QList *tokens)
     qmp->response = (QDict *)obj;
 }
 
-QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap)
+QDict *qtest_qmp_receive(QTestState *s)
 {
     QMPResponseParser qmp;
 
-    /* Send QMP request */
-    socket_sendf(s->qmp_fd, fmt, ap);
-
-    /* Receive reply */
     qmp.response = NULL;
     json_message_parser_init(&qmp.parser, qmp_response);
     while (!qmp.response) {
@@ -340,6 +336,15 @@ QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap)
     return qmp.response;
 }
 
+QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap)
+{
+    /* Send QMP request */
+    socket_sendf(s->qmp_fd, fmt, ap);
+
+    /* Receive reply */
+    return qtest_qmp_receive(s);
+}
+
 QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
 {
     va_list ap;
tests/libqtest.h +18 -0
index 9deebdc..cc947a0 100644
@@ -83,6 +83,14 @@ void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap);
 QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap);
 
 /**
+ * qtest_receive:
+ * @s: #QTestState instance to operate on.
+ *
+ * Reads a QMP message from QEMU and returns the response.
+ */
+QDict *qtest_qmp_receive(QTestState *s);
+
+/**
  * qtest_get_irq:
  * @s: #QTestState instance to operate on.
  * @num: Interrupt to observe.
@@ -383,6 +391,16 @@ static inline void qmp_discard_response(const char *fmt, ...)
 }
 
 /**
+ * qmp_receive:
+ *
+ * Reads a QMP message from QEMU and returns the response.
+ */
+static inline QDict *qmp_receive(void)
+{
+    return qtest_qmp_receive(global_qtest);
+}
+
+/**
  * get_irq:
  * @num: Interrupt to observe.
  *
Signature · 1 line
1.8.4.5
#14 lore raw

PATCH v3 11/15 pvpanic-test: Assert pause event

In reply to Andreas Färber
---
 tests/pvpanic-test.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tests/pvpanic-test.c +9 -0
index 7bb4d06..a7ad6b3 100644
@@ -15,11 +15,20 @@
 static void test_panic(void)
 {
     uint8_t val;
+    QDict *response, *data;
 
     val = inb(0x505);
     g_assert_cmpuint(val, ==, 1);
 
     outb(0x505, 0x1);
+
+    response = qmp_receive();
+    g_assert(qdict_haskey(response, "event"));
+    g_assert_cmpstr(qdict_get_str(response, "event"), ==, "GUEST_PANICKED");
+    g_assert(qdict_haskey(response, "data"));
+    data = qdict_get_qdict(response, "data");
+    g_assert(qdict_haskey(data, "action"));
+    g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause");
 }
 
 int main(int argc, char **argv)
Signature · 1 line
1.8.4.5
#15 lore raw

PATCH v3 12/15 nvme: Permit zero-length block devices

In reply to Andreas Färber

It may not be sensible for normal use cases, but it allows to use /dev/null in QTest.

---
 hw/block/nvme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/block/nvme.c +2 -2
index 2882ffe..5fd8f89 100644
@@ -752,8 +752,8 @@ static int nvme_init(PCIDevice *pci_dev)
         return -1;
     }
 
-    bs_size =  bdrv_getlength(n->conf.bs);
-    if (bs_size <= 0) {
+    bs_size = bdrv_getlength(n->conf.bs);
+    if (bs_size < 0) {
         return -1;
     }
 
Signature · 1 line
1.8.4.5
Applied
#16 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 12/15] nvme: Permit zero-length block devices

Quoted 2 lines · Andreas Färber

It may not be sensible for normal use cases, but it allows to use /dev/null in QTest.

Thanks! Sounds useful despite not being usable as storage. :)

I applied to my nvme tree here:

http://git.infradead.org/users/kbusch/qemu-nvme.git

It's quite a bit ahead of the upstream on 'nvme features'. I often hear from people in various orgs using this, so might be time I roll it into a pull request.

Quoted 24 lines

---
hw/block/nvme.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
hw/block/nvme.c +2 -2
index 2882ffe..5fd8f89 100644
@@ -752,8 +752,8 @@ static int nvme_init(PCIDevice *pci_dev)
        return -1;
    }
 
-    bs_size =  bdrv_getlength(n->conf.bs);
-    if (bs_size <= 0) {
+    bs_size = bdrv_getlength(n->conf.bs);
+    if (bs_size < 0) {
        return -1;
    }
 
Signature · 1 line
1.8.4.5
#17 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 12/15] nvme: Permit zero-length block devices

Am 12.03.2014 20:13, schrieb Keith Busch:

Quoted 5 lines · Andreas Färber
Quoted 2 lines

It may not be sensible for normal use cases, but it allows to use /dev/null in QTest.

Thanks! Sounds useful despite not being usable as storage. :)

Thanks for the quick review!

Quoted 7 lines

I applied to my nvme tree here:

http://git.infradead.org/users/kbusch/qemu-nvme.git

It's quite a bit ahead of the upstream on 'nvme features'. I often hear from people in various orgs using this, so might be time I roll it into a pull request.

Tonight is Hard Freeze for 2.0. If you could also review the matching test case http://patchwork.ozlabs.org/patch/329627/ I would put both in my pull. I guess you'll need to submit your queue for review first? Hard to see in a non-rebased tree.

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#18 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 12/15] nvme: Permit zero-length block devices

Quoted 3 lines · Andreas Färber

Tonight is Hard Freeze for 2.0. If you could also review the matching test case http://patchwork.ozlabs.org/patch/329627/ I would put both in my pull.

Looks great! I'd apply the new test case, but it won't without the previous "pvpanic-test" patch in your series.

Quoted 2 lines

I guess you'll need to submit your queue for review first? Hard to see in a non-rebased tree.

For sure. I pushed a new rebased branch to my repo so it could be more easily observed. My first commit below really ought to have been split into a dozen or so individuals, so my own fault if it fails review for that or any other reason. I have no concerns about waiting for the next window if I need to split it up better and fix anything.

A pull request at this point would look like this:

The following changes since commit 750036a848ea913ba6343718ffa70da98f7eef6b:

Merge remote-tracking branch 'remotes/afaerber/tags/prep-for-upstream' into staging (2014-03-12 17:53:37 +0000)

are available in the git repository at:

git://git.infradead.org/users/kbusch/qemu-nvme.git v2.0-updates

for you to fetch changes up to 9323763f1b9db24c575a5f8afc13e460a63cac22:

nvme: Permit zero-length block devices (2014-03-12 13:17:58 -0600)

----------------------------------------------------------------
Andreas Färber (1):
nvme: Permit zero-length block devices

Keith Busch (4):
NVMe: Implement remainder from spec
NVMe: Clear allocated bitmap after format
NVMe: Use aio flush
NVMe: completion queue coalescing

 default-configs/pci.mak |    1 +
 hw/block/nvme.c         | 1640 +++++++++++++++++++++++++++++++++++++++++++----
 hw/block/nvme.h         |  114 ++++
 3 files changed, 1621 insertions(+), 134 deletions(-)
#19 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 12/15] nvme: Permit zero-length block devices

Hi Keith,

Am 12.03.2014 21:13, schrieb Keith Busch:

Quoted 7 lines · Andreas Färber
Quoted 3 lines

Tonight is Hard Freeze for 2.0. If you could also review the matching test case http://patchwork.ozlabs.org/patch/329627/ I would put both in my pull.

Looks great! I'd apply the new test case, but it won't without the previous "pvpanic-test" patch in your series.

I had held off putting them in my pull for -rc0, but not seeing patches/pull from your side I am queuing them now for -rc1. Can I formalize your review as an Acked-by of both, if not turn your Signed-off-by into a Reviewed-by for this patch here?

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Acked-by
#20 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 12/15] nvme: Permit zero-length block devices

Quoted 6 lines · Andreas Färber

Am 12.03.2014 21:13, schrieb Keith Busch:

Quoted 5 lines · Andreas Färber
Quoted 3 lines

Tonight is Hard Freeze for 2.0. If you could also review the matching test case http://patchwork.ozlabs.org/patch/329627/ I would put both in my pull.

Quoted 7 lines
Quoted 2 lines

Looks great! I'd apply the new test case, but it won't without the previous "pvpanic-test" patch in your series.

I had held off putting them in my pull for -rc0, but not seeing patches/pull from your side I am queuing them now for -rc1. Can I formalize your review as an Acked-by of both, if not turn your Signed-off-by into a Reviewed-by for this patch here?

Sounds good to me.

#21 lore raw

PATCH v3 13/15 tests: Add nvme qtest

In reply to Andreas Färber
---
 tests/Makefile    |  3 +++
 tests/nvme-test.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 tests/nvme-test.c
tests/Makefile +3 -0
index 23e764d..c8b4060 100644
@@ -104,6 +104,8 @@ check-qtest-pci-y += tests/eepro100-test$(EXESUF)
 gcov-files-pci-y += hw/net/eepro100.c
 check-qtest-pci-y += tests/ne2000-test$(EXESUF)
 gcov-files-pci-y += hw/net/ne2000.c
+check-qtest-pci-y += tests/nvme-test$(EXESUF)
+gcov-files-pci-y += hw/block/nvme.c
 check-qtest-pci-y += $(check-qtest-virtio-y)
 gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
 check-qtest-pci-y += tests/tpci200-test$(EXESUF)
@@ -275,6 +277,7 @@ tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
 tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
+tests/nvme-test$(EXESUF): tests/nvme-test.o
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 
 # QTest rules
tests/nvme-test.c new file +34 -0
new file mode 100644
index 0000000..85768e8
@@ -0,0 +1,34 @@
+/*
+ * QTest testcase for NVMe
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/nvme/nop", nop);
+
+    qtest_start("-drive id=drv0,if=none,file=/dev/null "
+                "-device nvme,drive=drv0,serial=foo");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#22 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 13/15] tests: Add nvme qtest

Am 12.03.2014 19:28, schrieb Andreas Färber:

Quoted 6 lines
---
 tests/Makefile    |  3 +++
 tests/nvme-test.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 tests/nvme-test.c

Squashing MAINTAINERS update:

MAINTAINERS +1 -0
index 7d17f83..174c2c1 100644
@@ -648,6 +648,7 @@ nvme
 M: Keith Busch <[email protected]>
 S: Supported
 F: hw/block/nvme*
+F: tests/nvme-test.c
 
 Xilinx EDK
 M: Peter Crosthwaite <[email protected]>

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#23 lore raw

PATCH v3 14/15 tests: Add i82801b11 qtest

In reply to Andreas Färber
---
 tests/Makefile         |  3 +++
 tests/i82801b11-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/i82801b11-test.c
tests/Makefile +3 -0
index c8b4060..bf6c0a9 100644
@@ -134,6 +134,8 @@ gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c
 gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c
 check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
 gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
+check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
+gcov-files-i386-y += hw/pci-bridge/i802801b11.c
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -278,6 +280,7 @@ tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
 tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
 tests/nvme-test$(EXESUF): tests/nvme-test.o
+tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 
 # QTest rules
tests/i82801b11-test.c new file +33 -0
new file mode 100644
index 0000000..78d9ce0
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for i82801b11
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/i82801b11/nop", nop);
+
+    qtest_start("-machine q35 -device i82801b11-bridge,bus=pcie.0,addr=1e.0");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5
#24 lore raw

Re: [Qemu-devel] [PATCH qom-next v3 14/15] tests: Add i82801b11 qtest

Am 12.03.2014 19:28, schrieb Andreas Färber:

Quoted 12 lines
---
 tests/Makefile         |  3 +++
 tests/i82801b11-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/i82801b11-test.c
tests/Makefile +0 -0
index c8b4060..bf6c0a9 100644

tests/Makefile gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c · line 138

Quoted 5 lines
tests/Makefile +2 -0
@@ -134,6 +134,8 @@ gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c
 gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c
 check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
 gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
+check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
+gcov-files-i386-y += hw/pci-bridge/i802801b11.c

Typo fixed: i82801b11.c

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#25 lore raw

PATCH v3 15/15 tests: Add spapr-pci-host-bridge qtest

In reply to Andreas Färber

From: Alexey Kardashevskiy <[email protected]>

This adds a test whether sPAPR PHB can be added via the command line.

---
 tests/Makefile         |  3 +++
 tests/spapr-phb-test.c | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 tests/spapr-phb-test.c
tests/Makefile +3 -0
index bf6c0a9..8887512 100644
@@ -155,6 +155,8 @@ check-qtest-arm-y = tests/tmp105-test$(EXESUF)
 gcov-files-arm-y += hw/misc/tmp105.c
 check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
 check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
+check-qtest-ppc64-y += tests/spapr-phb-test$(EXESUF)
+gcov-files-ppc64-y += ppc64-softmmu/hw/ppc/spapr_pci.c
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
 check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
 
@@ -251,6 +253,7 @@ libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
 tests/rtc-test$(EXESUF): tests/rtc-test.o
 tests/m48t59-test$(EXESUF): tests/m48t59-test.o
 tests/endianness-test$(EXESUF): tests/endianness-test.o
+tests/spapr-phb-test$(EXESUF): tests/spapr-phb-test.o $(libqos-obj-y)
 tests/fdc-test$(EXESUF): tests/fdc-test.o
 tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-obj-y)
 tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
tests/spapr-phb-test.c new file +35 -0
new file mode 100644
index 0000000..b629de4
@@ -0,0 +1,35 @@
+/*
+ * QTest testcase for SPAPR PHB
+ *
+ * Authors:
+ *  Alexey Kardashevskiy <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#include <glib.h>
+
+#include "libqtest.h"
+
+#define TYPE_SPAPR_PCI_HOST_BRIDGE "spapr-pci-host-bridge"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void test_phb_device(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/spapr-phb/device", test_phb_device);
+
+    qtest_start("-device " TYPE_SPAPR_PCI_HOST_BRIDGE ",index=100");
+
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
Signature · 1 line
1.8.4.5