tests: enable virtio tests on SPAPR
v3 cover tests: enable virtio tests on SPAPR
This series enables virtio tests on SPAPR by starting machines using qtest_pc_boot() or qtest_spapr_boot() to use the good libqos PCI framework (pc or spapr).
It adds also some byte-swapping in virtio-pci.c as PCI is always little-endian and the endianness of the virtio device depends on the endianness of the guest.
This series does not enable virtio PCI MSI-X tests on SPAPR as this needs more work and will be the aim of another series.
This series must be applied on top of my previous
series: "tests: enable ohci/uhci/xhci tests on PPC64"
v3:
- remove "ppc" from allowed archs for virtio-blk-test
- remove g_assert_nonnull() after g_malloc()
- add a patch to fix "vs" memory leak in virtio-scsi-test
- add a patch to remove g_assert() after qtest_spapr_boot() and update comment qtest_vboot() to explain it never returns NULL.
v2:
- update comments (virtio-1.0, log)
- move g_assert_nonnull() to qtest_boot()
- exit gracefully if the architecture is not supported
- replace qtest_pc_shutdown() by qtest_shutdown()
- move qvirtio_scsi_stop() to qvirtio_scsi_pci_free()
Laurent Vivier (5):
tests: fix memory leak in virtio-scsi-test
tests: don't check if qtest_spapr_boot() returns NULL
tests: use qtest_pc_boot()/qtest_shutdown() in virtio tests
qtest: evaluate endianness of the target in qtest_init()
tests: enable virtio tests on SPAPR
tests/Makefile.include | 3 +- tests/libqos/libqos.c | 1 + tests/libqos/virtio-pci.c | 28 +++++++- tests/libqtest.c | 96 +++++++++++++------------ tests/libqtest.h | 16 ++++- tests/rtas-test.c | 1 - tests/virtio-9p-test.c | 59 ++++++++-------- tests/virtio-blk-test.c | 175 ++++++++++++++++++++++------------------------ tests/virtio-net-test.c | 57 ++++++++------- tests/virtio-rng-test.c | 7 +- tests/virtio-scsi-test.c | 78 +++++++++++---------- 11 files changed, 283 insertions(+), 238 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 1/5 tests: fix memory leak in virtio-scsi-test
vs is allocated in qvirtio_scsi_pci_init() and never freed.
--- tests/virtio-scsi-test.c | 1 + 1 file changed, 1 insertion(+)
tests/virtio-scsi-test.c +1 -0
@@ -64,6 +64,7 @@ static void qvirtio_scsi_pci_free(QVirtIOSCSI *vs)qvirtio_pci_device_disable (container_of (vs->dev, QVirtioPCIDevice, vdev));g_free (vs->dev);qpci_free_pc (vs->bus); +g_free (vs); } static uint64_t qvirtio_scsi_alloc(QVirtIOSCSI *vs, size_t alloc_size,
Signature · 1 line
2.7.4
PATCH v3 2/5 tests: don't check if qtest_spapr_boot() returns NULL
In reply to Laurent Vivierqtest_spapr_boot()/qtest_pc_boot()/qtest_boot() call qtest_vboot() and qtest_vboot() calls g_malloc(),
and g_malloc() never fails:
if memory allocation fails, the application is terminated.
--- tests/libqos/libqos.c | 1 + tests/rtas-test.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
tests/libqos/libqos.c +1 -0
@@ -10,6 +10,7 @@/** * Launch QEMU with the given command line, * and then set up interrupts and our guest malloc interface. +* Never return NULL as the application is terminated if g_malloc() fails. */ QOSState *qtest_vboot (QOSOps *ops,const char *cmdline_fmt,va_list ap) {
tests/rtas-test.c +0 -1
@@ -14,7 +14,6 @@ static void test_rtas_get_time_of_day(void)time_t t1, t2; qs =qtest_spapr_boot ("-machine pseries" ); -g_assert (qs !=NULL ); t1 =time (NULL ); ret =qrtas_get_time_of_day (qs->alloc, &tm, &ns);
Signature · 1 line
2.7.4
PATCH v3 3/5 tests: use qtest_pc_boot()/qtest_shutdown() in virtio tests
In reply to Laurent VivierThis patch replaces calls to qtest_start() and qtest_end() by calls to qtest_pc_boot() and qtest_shutdown().
This allows to initialize memory allocator and PCI interface functions. This will ease to enable virtio tests on other architectures by only adding a specific qtest_XXX_boot() (like qtest_spapr_boot()).
--- tests/virtio-9p-test.c | 51 +++++++--------- tests/virtio-blk-test.c | 150 ++++++++++++++++++++--------------------------- tests/virtio-net-test.c | 39 +++++------- tests/virtio-scsi-test.c | 67 +++++++++------------ 4 files changed, 129 insertions(+), 178 deletions(-)
tests/virtio-9p-test.c +22 -29
@@ -10,62 +10,56 @@#include "qemu/osdep.h" #include "libqtest.h" #include "qemu-common.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" -#include "libqos/malloc.h" -#include "libqos/malloc-pc.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_pci.h" static const char mount_tag[] ="qtest" ;static char *test_share; -static void qvirtio_9p_start (void ) -{ -char *args; +static QOSState *qvirtio_9p_start (void ) +{ test_share =g_strdup ("/tmp/qtest.XXXXXX" );g_assert_nonnull (mkdtemp (test_share)); +const char *cmd ="-fsdev local,id=fsdev0,security_model=none,path=%s " +"-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" ; - args =g_strdup_printf ("-fsdev local,id=fsdev0,security_model=none,path=%s " -"-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" , - test_share, mount_tag); - -qtest_start (args); -g_free (args); +return qtest_pc_boot (cmd, test_share, mount_tag); } -static void qvirtio_9p_stop (void ) +static void qvirtio_9p_stop (QOSState *qs) { -qtest_end (); +qtest_shutdown (qs);rmdir (test_share);g_free (test_share); }static void pci_nop (void ) { -qvirtio_9p_start (); -qvirtio_9p_stop (); +QOSState *qs; + + qs =qvirtio_9p_start (); +qvirtio_9p_stop (qs); }typedef struct {QVirtioDevice *dev; -QGuestAllocator *alloc; -QPCIBus *bus; +QOSState *qs;QVirtQueue *vq; }QVirtIO9P ; -static QVirtIO9P *qvirtio_9p_pci_init (void ) +static QVirtIO9P *qvirtio_9p_pci_init (QOSState *qs) {QVirtIO9P *v9p;QVirtioPCIDevice *dev; v9p =g_new0 (QVirtIO9P,1 ); - v9p->alloc =pc_alloc_init (); - v9p->bus =qpci_init_pc (NULL ); - dev =qvirtio_pci_device_find (v9p->bus,VIRTIO_ID_9P ); + v9p->qs = qs; + dev =qvirtio_pci_device_find (v9p->qs->pcibus,VIRTIO_ID_9P );g_assert_nonnull (dev); g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_9P); v9p->dev = (QVirtioDevice *) dev;
@@ -75,17 +69,15 @@ static QVirtIO9P *qvirtio_9p_pci_init(void)qvirtio_set_acknowledge (&qvirtio_pci, v9p->dev);qvirtio_set_driver (&qvirtio_pci, v9p->dev); - v9p->vq =qvirtqueue_setup (&qvirtio_pci, v9p->dev, v9p->alloc,0 ); + v9p->vq =qvirtqueue_setup (&qvirtio_pci, v9p->dev, v9p->qs->alloc,0 );return v9p; }static void qvirtio_9p_pci_free (QVirtIO9P *v9p) { -qvirtqueue_cleanup (&qvirtio_pci, v9p->vq, v9p->alloc); -pc_alloc_uninit (v9p->alloc); +qvirtqueue_cleanup (&qvirtio_pci, v9p->vq, v9p->qs->alloc);qvirtio_pci_device_disable (container_of (v9p->dev, QVirtioPCIDevice, vdev));g_free (v9p->dev); -qpci_free_pc (v9p->bus);g_free (v9p); }
@@ -96,9 +88,10 @@ static void pci_basic_config(void)size_t tag_len;char *tag;int i; +QOSState *qs; -qvirtio_9p_start (); - v9p =qvirtio_9p_pci_init (); + qs =qvirtio_9p_start (); + v9p =qvirtio_9p_pci_init (qs); addr = ((QVirtioPCIDevice *) v9p->dev)->addr +VIRTIO_PCI_CONFIG_OFF (false); tag_len = qvirtio_config_readw(&qvirtio_pci, v9p->dev,
@@ -115,7 +108,7 @@ static void pci_basic_config(void)g_free (tag);qvirtio_9p_pci_free (v9p); -qvirtio_9p_stop (); +qvirtio_9p_stop (qs); }int main (int argc,char **argv)
tests/virtio-blk-test.c +64 -86
391 lines not on this page · raw message
tests/virtio-net-test.c +14 -25
@@ -12,12 +12,9 @@#include "qemu-common.h" #include "qemu/sockets.h" #include "qemu/iov.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" -#include "libqos/malloc.h" -#include "libqos/malloc-pc.h" -#include "libqos/malloc-generic.h" #include "qemu/bswap.h" #include "hw/virtio/virtio-net.h" #include "standard-headers/linux/virtio_ids.h"
@@ -53,16 +50,12 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)return dev; } -static QPCIBus *pci_test_start (int socket) +static QOSState *pci_test_start (int socket) { -char *cmdline; +const char *cmd ="-netdev socket,fd=%d,id=hs0 -device " +"virtio-net-pci,netdev=hs0" ; - cmdline =g_strdup_printf ("-netdev socket,fd=%d,id=hs0 -device " -"virtio-net-pci,netdev=hs0" , socket); -qtest_start (cmdline); -g_free (cmdline); - -return qpci_init_pc (NULL ); +return qtest_pc_boot (cmd, socket); }static void driver_init (const QVirtioBus *bus,QVirtioDevice *dev)
@@ -205,9 +198,8 @@ static void stop_cont_test(const QVirtioBus *bus, QVirtioDevice *dev,static void pci_basic (gconstpointer data) {QVirtioPCIDevice *dev; -QPCIBus *bus; +QOSState *qs;QVirtQueuePCI *tx, *rx; -QGuestAllocator *alloc; void (*func) (const QVirtioBus *bus, QVirtioDevice *dev, QGuestAllocator *alloc,
@@ -219,28 +211,25 @@ static void pci_basic(gconstpointer data) ret =socketpair (PF_UNIX ,SOCK_STREAM ,0 , sv); g_assert_cmpint(ret, !=, -1); - bus =pci_test_start (sv[1 ]); - dev =virtio_net_pci_init (bus,PCI_SLOT ); + qs =pci_test_start (sv[1 ]); + dev =virtio_net_pci_init (qs->pcibus,PCI_SLOT ); - alloc =pc_alloc_init (); rx = (QVirtQueuePCI *)qvirtqueue_setup (&qvirtio_pci, &dev->vdev, - alloc,0 ); + qs->alloc,0 ); tx = (QVirtQueuePCI *)qvirtqueue_setup (&qvirtio_pci, &dev->vdev, - alloc,1 ); + qs->alloc,1 );driver_init (&qvirtio_pci, &dev->vdev); -func (&qvirtio_pci, &dev->vdev, alloc, &rx->vq, &tx->vq, sv[0 ]); +func (&qvirtio_pci, &dev->vdev, qs->alloc, &rx->vq, &tx->vq, sv[0 ]);/* End test */ close (sv[0 ]); -qvirtqueue_cleanup (&qvirtio_pci, &tx->vq, alloc); -qvirtqueue_cleanup (&qvirtio_pci, &rx->vq, alloc); -pc_alloc_uninit (alloc); +qvirtqueue_cleanup (&qvirtio_pci, &tx->vq, qs->alloc); +qvirtqueue_cleanup (&qvirtio_pci, &rx->vq, qs->alloc);qvirtio_pci_device_disable (dev);g_free (dev->pdev);g_free (dev); -qpci_free_pc (bus); - test_end(); + qtest_shutdown(qs); }#endif
tests/virtio-scsi-test.c +29 -38
153 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 4/5 qtest: evaluate endianness of the target in qtest_init()
In reply to Laurent VivierThis allows to store it and not have to rescan the list each time we need it.
--- tests/libqos/virtio-pci.c | 2 +- tests/libqtest.c | 96 +++++++++++++++++++++++++---------------------- tests/libqtest.h | 16 ++++++-- tests/virtio-blk-test.c | 2 +- 4 files changed, 66 insertions(+), 50 deletions(-)
tests/libqos/virtio-pci.c +1 -1
@@ -86,7 +86,7 @@ static uint64_t qvirtio_pci_config_readq(QVirtioDevice *d, uint64_t addr)int i;uint64_t u64 =0 ; -if (qtest_big_endian ()) { +if (target_big_endian ()) {for (i =0 ; i <8 ; ++i) { u64 |= (uint64_t )qpci_io_readb (dev->pdev, (void *)(uintptr_t )addr + i) << (7 - i) *8 ;
tests/libqtest.c +51 -45
119 lines not on this page · raw message
tests/libqtest.h +13 -3
@@ -410,6 +410,14 @@ int64_t qtest_clock_step(QTestState *s, int64_t step);int64_t qtest_clock_set (QTestState *s,int64_t val);/** +* qtest_big_endian: +* @s: QTestState instance to operate on. +* +* Returns: True if the architecture under test has a big endian configuration. +*/ +bool qtest_big_endian (QTestState *s); + +/** * qtest_get_arch: * * Returns: The architecture for the QEMU executable under test.
@@ -874,12 +882,14 @@ static inline int64_t clock_set(int64_t val) }/** -* qtest_big_endian: +* target_big_endian: * * Returns: True if the architecture under test has a big endian configuration. */ -bool qtest_big_endian (void ); - +static inline bool target_big_endian (void ) +{ +return qtest_big_endian (global_qtest); +}QDict *qmp_fd_receive (int fd);void qmp_fd_sendv (int fd,const char *fmt,va_list ap);
tests/virtio-blk-test.c +1 -1
@@ -120,7 +120,7 @@ static inline void virtio_blk_fix_request(QVirtioBlkReq *req)bool host_endian = false;#endif -if (qtest_big_endian () != host_endian) { +if (target_big_endian () != host_endian) { req->type =bswap32 (req->type); req->ioprio =bswap32 (req->ioprio); req->sector =bswap64 (req->sector);
Signature · 1 line
2.7.4
PATCH v3 5/5 tests: enable virtio tests on SPAPR
In reply to Laurent Vivierbut disable MSI-X tests on SPAPR as we can't check the result (the memory region used on PC is not readable on SPAPR).
--- tests/Makefile.include | 3 ++- tests/libqos/virtio-pci.c | 26 ++++++++++++++++++++++++-- tests/virtio-9p-test.c | 12 +++++++++++- tests/virtio-blk-test.c | 25 ++++++++++++++++++++----- tests/virtio-net-test.c | 18 ++++++++++++++++-- tests/virtio-rng-test.c | 7 ++++++- tests/virtio-scsi-test.c | 12 +++++++++++- 7 files changed, 90 insertions(+), 13 deletions(-)
tests/Makefile.include +2 -1
@@ -278,6 +278,7 @@ check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF) gcov-files-ppc64-y += hw/usb/hcd-uhci.c check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF) gcov-files-ppc64-y += hw/usb/hcd-xhci.c +check-qtest-ppc64-y += $(check-qtest-virtio-y) check-qtest-sh4-y = tests/endianness-test$(EXESUF)
@@ -604,7 +605,7 @@ libqos-pc-obj-y += tests/libqos/ahci.o libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o -libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o +libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o tests/rtc-test$(EXESUF): tests/rtc-test.o
tests/libqos/virtio-pci.c +24 -2
@@ -68,16 +68,38 @@ static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d, uint64_t addr)return qpci_io_readb (dev->pdev, (void *)(uintptr_t )addr); } +/* PCI is always read in little-endian order +* but virtio ( < 1.0) is in guest order +* so with a big-endian guest the order has been reversed, +* reverse it again +* virtio-1.0 is always little-endian, like PCI, but as it +* is not implemented in libqos, we don't manage this case. +*/ +static uint16_t qvirtio_pci_config_readw (QVirtioDevice *d,uint64_t addr) {QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; -return qpci_io_readw (dev->pdev, (void *)(uintptr_t )addr); +uint16_t value; + + value =qpci_io_readw (dev->pdev, (void *)(uintptr_t )addr); +/* FIXME: don't swap with virtio-1.0 */ +if (target_big_endian ()) { + value =bswap16 (value); + } +return value; }static uint32_t qvirtio_pci_config_readl (QVirtioDevice *d,uint64_t addr) {QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; -return qpci_io_readl (dev->pdev, (void *)(uintptr_t )addr); +uint32_t value; + + value =qpci_io_readl (dev->pdev, (void *)(uintptr_t )addr); +/* FIXME: don't swap with virtio-1.0 */ +if (target_big_endian ()) { + value =bswap32 (value); + } +return value; }static uint64_t qvirtio_pci_config_readq (QVirtioDevice *d,uint64_t addr)
tests/virtio-9p-test.c +11 -1
@@ -11,6 +11,7 @@#include "libqtest.h" #include "qemu-common.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "standard-headers/linux/virtio_ids.h"
@@ -22,12 +23,21 @@ static char *test_share;static QOSState *qvirtio_9p_start (void ) { +const char *arch =qtest_get_arch (); test_share =g_strdup ("/tmp/qtest.XXXXXX" );g_assert_nonnull (mkdtemp (test_share));const char *cmd ="-fsdev local,id=fsdev0,security_model=none,path=%s " "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" ; -return qtest_pc_boot (cmd, test_share, mount_tag); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +return qtest_pc_boot (cmd, test_share, mount_tag); + } +if (strcmp (arch,"ppc64" ) ==0 ) { +return qtest_spapr_boot (cmd, test_share, mount_tag); + } + +g_printerr ("virtio-9p tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); }static void qvirtio_9p_stop (QOSState *qs)
tests/virtio-blk-test.c +20 -5
@@ -11,6 +11,7 @@#include "qemu/osdep.h" #include "libqtest.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "libqos/virtio-mmio.h"
@@ -59,6 +60,7 @@ static char *drive_create(void)static QOSState *pci_test_start (void ) {QOSState *qs; +const char *arch =qtest_get_arch ();char *tmp_path;const char *cmd ="-drive if=none,id=drive0,file=%s,format=raw " "-drive if=none,id=drive1,file=/dev/null,format=raw "
@@ -67,7 +69,14 @@ static QOSState *pci_test_start(void) tmp_path =drive_create (); - qs =qtest_pc_boot (cmd, tmp_path,PCI_SLOT ,PCI_FN ); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { + qs =qtest_pc_boot (cmd, tmp_path,PCI_SLOT ,PCI_FN ); + }else if (strcmp (arch,"ppc64" ) ==0 ) { + qs =qtest_spapr_boot (cmd, tmp_path,PCI_SLOT ,PCI_FN ); + }else { +g_printerr ("virtio-blk tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); + }unlink (tmp_path);g_free (tmp_path);return qs;
@@ -671,6 +680,7 @@ static void pci_hotplug(void) {QVirtioPCIDevice *dev;QOSState *qs; +const char *arch =qtest_get_arch (); qs =pci_test_start ();
@@ -684,7 +694,9 @@ static void pci_hotplug(void)g_free (dev);/* unplug secondary disk */ -qpci_unplug_acpi_device_test ("drv1" ,PCI_SLOT_HP ); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qpci_unplug_acpi_device_test ("drv1" ,PCI_SLOT_HP ); + }qtest_shutdown (qs); }
@@ -735,12 +747,15 @@ int main(int argc, char **argv)g_test_init (&argc, &argv,NULL ); -if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 || +strcmp (arch,"ppc64" ) ==0 ) {qtest_add_func ("/virtio/blk/pci/basic" , pci_basic);qtest_add_func ("/virtio/blk/pci/indirect" , pci_indirect);qtest_add_func ("/virtio/blk/pci/config" , pci_config); -qtest_add_func ("/virtio/blk/pci/msix" , pci_msix); -qtest_add_func ("/virtio/blk/pci/idx" , pci_idx); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qtest_add_func ("/virtio/blk/pci/msix" , pci_msix); +qtest_add_func ("/virtio/blk/pci/idx" , pci_idx); + }qtest_add_func ("/virtio/blk/pci/hotplug" , pci_hotplug); }else if (strcmp (arch,"arm" ) ==0 ) {qtest_add_func ("/virtio/blk/mmio/basic" , mmio_basic);
tests/virtio-net-test.c +16 -2
@@ -13,6 +13,7 @@#include "qemu/sockets.h" #include "qemu/iov.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "qemu/bswap.h"
@@ -52,10 +53,18 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)static QOSState *pci_test_start (int socket) { +const char *arch =qtest_get_arch ();const char *cmd ="-netdev socket,fd=%d,id=hs0 -device " "virtio-net-pci,netdev=hs0" ; -return qtest_pc_boot (cmd, socket); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +return qtest_pc_boot (cmd, socket); + } +if (strcmp (arch,"ppc64" ) ==0 ) { +return qtest_spapr_boot (cmd, socket); + } +g_printerr ("virtio-net tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); }static void driver_init (const QVirtioBus *bus,QVirtioDevice *dev)
@@ -235,10 +244,15 @@ static void pci_basic(gconstpointer data)static void hotplug (void ) { +const char *arch =qtest_get_arch (); +qtest_start ("-device virtio-net-pci" );qpci_plug_device_test ("virtio-net-pci" ,"net1" ,PCI_SLOT_HP ,NULL ); -qpci_unplug_acpi_device_test ("net1" ,PCI_SLOT_HP ); + +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qpci_unplug_acpi_device_test ("net1" ,PCI_SLOT_HP ); + }test_end (); }
tests/virtio-rng-test.c +6 -1
@@ -20,8 +20,13 @@ static void pci_nop(void)static void hotplug (void ) { +const char *arch =qtest_get_arch (); +qpci_plug_device_test ("virtio-rng-pci" ,"rng1" ,PCI_SLOT_HP ,NULL ); -qpci_unplug_acpi_device_test ("rng1" ,PCI_SLOT_HP ); + +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qpci_unplug_acpi_device_test ("rng1" ,PCI_SLOT_HP ); + } }int main (int argc,char **argv)
tests/virtio-scsi-test.c +11 -1
@@ -12,6 +12,7 @@#include "libqtest.h" #include "block/scsi.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "standard-headers/linux/virtio_ids.h"
@@ -33,11 +34,20 @@ typedef struct {static QOSState *qvirtio_scsi_start (const char *extra_opts) { +const char *arch =qtest_get_arch ();const char *cmd ="-drive id=drv0,if=none,file=/dev/null,format=raw " "-device virtio-scsi-pci,id=vs0 " "-device scsi-hd,bus=vs0.0,drive=drv0 %s" ; -return qtest_pc_boot (cmd, extra_opts ? :"" ); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +return qtest_pc_boot (cmd, extra_opts ? :"" ); + } +if (strcmp (arch,"ppc64" ) ==0 ) { +return qtest_spapr_boot (cmd, extra_opts ? :"" ); + } + +g_printerr ("virtio-scsi tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); }static void qvirtio_scsi_stop (QOSState *qs)
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH v3 1/5] tests: fix memory leak in virtio-scsi-test
In reply to Laurent VivierQuoted 4 lines · On Sat, 1 Oct 2016 20:56:00 +0200 Laurent Vivier <[email protected]> wrote:
vs is allocated in
qvirtio_scsi_pci_init()and never freed.Signed-off-by Laurent Vivier <[email protected]>---
Quoted 15 lines
tests/virtio-scsi-test.c | 1 + 1 file changed, 1 insertion(+)tests/virtio-scsi-test.c +1
-0@@ -64,6 +64,7 @@ static void qvirtio_scsi_pci_free(QVirtIOSCSI *vs)qvirtio_pci_device_disable (container_of (vs->dev, QVirtioPCIDevice, vdev));g_free (vs->dev);qpci_free_pc (vs->bus); +g_free (vs); } static uint64_t qvirtio_scsi_alloc(QVirtIOSCSI *vs, size_t alloc_size,
Re: [Qemu-devel] [PATCH v3 2/5] tests: don't check if qtest_spapr_boot() returns NULL
In reply to Laurent VivierQuoted 7 lines · On Sat, 1 Oct 2016 20:56:01 +0200 Laurent Vivier <[email protected]> wrote:
qtest_spapr_boot()/qtest_pc_boot()/qtest_boot() call
qtest_vboot()andqtest_vboot()callsg_malloc(),
andg_malloc()never fails:
if memory allocation fails, the application is terminated.Signed-off-by Laurent Vivier <[email protected]>---
Quoted 28 lines
tests/libqos/libqos.c | 1 + tests/rtas-test.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)tests/libqos/libqos.c +1
-0@@ -10,6 +10,7 @@/** * Launch QEMU with the given command line, * and then set up interrupts and our guest malloc interface. +* Never return NULL as the application is terminated if g_malloc() fails. */ QOSState *qtest_vboot (QOSOps *ops,const char *cmdline_fmt,va_list ap) {tests/rtas-test.c +0
-1@@ -14,7 +14,6 @@ static void test_rtas_get_time_of_day(void)time_t t1, t2; qs =qtest_spapr_boot ("-machine pseries" ); -g_assert (qs !=NULL ); t1 =time (NULL ); ret =qrtas_get_time_of_day (qs->alloc, &tm, &ns);
Quoted 5 lines · On Sat, 1 Oct 2016 20:56:04 +0200 Laurent Vivier <[email protected]> wrote:
but disable MSI-X tests on SPAPR as we can't check the result (the memory region used on PC is not readable on SPAPR).
Signed-off-by Laurent Vivier <[email protected]>---
Quoted 286 lines
tests/Makefile.include | 3 ++- tests/libqos/virtio-pci.c | 26 ++++++++++++++++++++++++-- tests/virtio-9p-test.c | 12 +++++++++++- tests/virtio-blk-test.c | 25 ++++++++++++++++++++----- tests/virtio-net-test.c | 18 ++++++++++++++++-- tests/virtio-rng-test.c | 7 ++++++- tests/virtio-scsi-test.c | 12 +++++++++++- 7 files changed, 90 insertions(+), 13 deletions(-)tests/Makefile.include +2
-1@@ -278,6 +278,7 @@ check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF) gcov-files-ppc64-y += hw/usb/hcd-uhci.c check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF) gcov-files-ppc64-y += hw/usb/hcd-xhci.c +check-qtest-ppc64-y += $(check-qtest-virtio-y) check-qtest-sh4-y = tests/endianness-test$(EXESUF)@@ -604,7 +605,7 @@ libqos-pc-obj-y += tests/libqos/ahci.o libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o -libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o +libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o tests/rtc-test$(EXESUF): tests/rtc-test.otests/libqos/virtio-pci.c +24
-2@@ -68,16 +68,38 @@ static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d, uint64_t addr)return qpci_io_readb (dev->pdev, (void *)(uintptr_t )addr); } +/* PCI is always read in little-endian order +* but virtio ( < 1.0) is in guest order +* so with a big-endian guest the order has been reversed, +* reverse it again +* virtio-1.0 is always little-endian, like PCI, but as it +* is not implemented in libqos, we don't manage this case. +*/ +static uint16_t qvirtio_pci_config_readw (QVirtioDevice *d,uint64_t addr) {QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; -return qpci_io_readw (dev->pdev, (void *)(uintptr_t )addr); +uint16_t value; + + value =qpci_io_readw (dev->pdev, (void *)(uintptr_t )addr); +/* FIXME: don't swap with virtio-1.0 */ +if (target_big_endian ()) { + value =bswap16 (value); + } +return value; }static uint32_t qvirtio_pci_config_readl (QVirtioDevice *d,uint64_t addr) {QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; -return qpci_io_readl (dev->pdev, (void *)(uintptr_t )addr); +uint32_t value; + + value =qpci_io_readl (dev->pdev, (void *)(uintptr_t )addr); +/* FIXME: don't swap with virtio-1.0 */ +if (target_big_endian ()) { + value =bswap32 (value); + } +return value; }static uint64_t qvirtio_pci_config_readq (QVirtioDevice *d,uint64_t addr)tests/virtio-9p-test.c +11
-1@@ -11,6 +11,7 @@#include "libqtest.h" #include "qemu-common.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "standard-headers/linux/virtio_ids.h" @@ -22,12 +23,21 @@ static char *test_share;static QOSState *qvirtio_9p_start (void ) { +const char *arch =qtest_get_arch (); test_share =g_strdup ("/tmp/qtest.XXXXXX" );g_assert_nonnull (mkdtemp (test_share));const char *cmd ="-fsdev local,id=fsdev0,security_model=none,path=%s " "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" ; -return qtest_pc_boot (cmd, test_share, mount_tag); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +return qtest_pc_boot (cmd, test_share, mount_tag); + } +if (strcmp (arch,"ppc64" ) ==0 ) { +return qtest_spapr_boot (cmd, test_share, mount_tag); + } + +g_printerr ("virtio-9p tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); }static void qvirtio_9p_stop (QOSState *qs)tests/virtio-blk-test.c +20
-5@@ -11,6 +11,7 @@#include "qemu/osdep.h" #include "libqtest.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "libqos/virtio-mmio.h" @@ -59,6 +60,7 @@ static char *drive_create(void)static QOSState *pci_test_start (void ) {QOSState *qs; +const char *arch =qtest_get_arch ();char *tmp_path;const char *cmd ="-drive if=none,id=drive0,file=%s,format=raw " "-drive if=none,id=drive1,file=/dev/null,format=raw " @@ -67,7 +69,14 @@ static QOSState *pci_test_start(void) tmp_path =drive_create (); - qs =qtest_pc_boot (cmd, tmp_path,PCI_SLOT ,PCI_FN ); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { + qs =qtest_pc_boot (cmd, tmp_path,PCI_SLOT ,PCI_FN ); + }else if (strcmp (arch,"ppc64" ) ==0 ) { + qs =qtest_spapr_boot (cmd, tmp_path,PCI_SLOT ,PCI_FN ); + }else { +g_printerr ("virtio-blk tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); + }unlink (tmp_path);g_free (tmp_path);return qs;@@ -671,6 +680,7 @@ static void pci_hotplug(void) {QVirtioPCIDevice *dev;QOSState *qs; +const char *arch =qtest_get_arch (); qs =pci_test_start ();@@ -684,7 +694,9 @@ static void pci_hotplug(void)g_free (dev);/* unplug secondary disk */ -qpci_unplug_acpi_device_test ("drv1" ,PCI_SLOT_HP ); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qpci_unplug_acpi_device_test ("drv1" ,PCI_SLOT_HP ); + }qtest_shutdown (qs); }@@ -735,12 +747,15 @@ int main(int argc, char **argv)g_test_init (&argc, &argv,NULL ); -if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 || +strcmp (arch,"ppc64" ) ==0 ) {qtest_add_func ("/virtio/blk/pci/basic" , pci_basic);qtest_add_func ("/virtio/blk/pci/indirect" , pci_indirect);qtest_add_func ("/virtio/blk/pci/config" , pci_config); -qtest_add_func ("/virtio/blk/pci/msix" , pci_msix); -qtest_add_func ("/virtio/blk/pci/idx" , pci_idx); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qtest_add_func ("/virtio/blk/pci/msix" , pci_msix); +qtest_add_func ("/virtio/blk/pci/idx" , pci_idx); + }qtest_add_func ("/virtio/blk/pci/hotplug" , pci_hotplug); }else if (strcmp (arch,"arm" ) ==0 ) {qtest_add_func ("/virtio/blk/mmio/basic" , mmio_basic);tests/virtio-net-test.c +16
-2@@ -13,6 +13,7 @@#include "qemu/sockets.h" #include "qemu/iov.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "qemu/bswap.h" @@ -52,10 +53,18 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)static QOSState *pci_test_start (int socket) { +const char *arch =qtest_get_arch ();const char *cmd ="-netdev socket,fd=%d,id=hs0 -device " "virtio-net-pci,netdev=hs0" ; -return qtest_pc_boot (cmd, socket); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +return qtest_pc_boot (cmd, socket); + } +if (strcmp (arch,"ppc64" ) ==0 ) { +return qtest_spapr_boot (cmd, socket); + } +g_printerr ("virtio-net tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); }static void driver_init (const QVirtioBus *bus,QVirtioDevice *dev)@@ -235,10 +244,15 @@ static void pci_basic(gconstpointer data)static void hotplug (void ) { +const char *arch =qtest_get_arch (); +qtest_start ("-device virtio-net-pci" );qpci_plug_device_test ("virtio-net-pci" ,"net1" ,PCI_SLOT_HP ,NULL ); -qpci_unplug_acpi_device_test ("net1" ,PCI_SLOT_HP ); + +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qpci_unplug_acpi_device_test ("net1" ,PCI_SLOT_HP ); + }test_end (); }tests/virtio-rng-test.c +6
-1@@ -20,8 +20,13 @@ static void pci_nop(void)static void hotplug (void ) { +const char *arch =qtest_get_arch (); +qpci_plug_device_test ("virtio-rng-pci" ,"rng1" ,PCI_SLOT_HP ,NULL ); -qpci_unplug_acpi_device_test ("rng1" ,PCI_SLOT_HP ); + +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qpci_unplug_acpi_device_test ("rng1" ,PCI_SLOT_HP ); + } }int main (int argc,char **argv)tests/virtio-scsi-test.c +11
-1@@ -12,6 +12,7 @@#include "libqtest.h" #include "block/scsi.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" #include "standard-headers/linux/virtio_ids.h" @@ -33,11 +34,20 @@ typedef struct {static QOSState *qvirtio_scsi_start (const char *extra_opts) { +const char *arch =qtest_get_arch ();const char *cmd ="-drive id=drv0,if=none,file=/dev/null,format=raw " "-device virtio-scsi-pci,id=vs0 " "-device scsi-hd,bus=vs0.0,drive=drv0 %s" ; -return qtest_pc_boot (cmd, extra_opts ? :"" ); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +return qtest_pc_boot (cmd, extra_opts ? :"" ); + } +if (strcmp (arch,"ppc64" ) ==0 ) { +return qtest_spapr_boot (cmd, extra_opts ? :"" ); + } + +g_printerr ("virtio-scsi tests are only available on x86 or ppc64\n" ); +exit (EXIT_FAILURE ); }static void qvirtio_scsi_stop (QOSState *qs)
Re: [Qemu-devel] [PATCH v3 3/5] tests: use qtest_pc_boot()/qtest_shutdown() in virtio tests
In reply to Laurent VivierQuoted 11 lines · On Sat, 1 Oct 2016 20:56:02 +0200 Laurent Vivier <[email protected]> wrote:
This patch replaces calls to
qtest_start()andqtest_end()by calls toqtest_pc_boot()andqtest_shutdown().This allows to initialize memory allocator and PCI interface functions. This will ease to enable virtio tests on other architectures by only adding a specific
qtest_XXX_boot()(likeqtest_spapr_boot()).Signed-off-by Laurent Vivier <[email protected]>Reviewed-by Greg Kurz <[email protected]>---
Oops I had missed it during review but I have a single remark for the 9p test.
My R-b stands anyway.
Quoted 27 lines
tests/virtio-9p-test.c | 51 +++++++--------- tests/virtio-blk-test.c | 150 ++++++++++++++++++++--------------------------- tests/virtio-net-test.c | 39 +++++------- tests/virtio-scsi-test.c | 67 +++++++++------------ 4 files changed, 129 insertions(+), 178 deletions(-)tests/virtio-9p-test.c +1
-4@@ -10,62 +10,56 @@#include "qemu/osdep.h" #include "libqtest.h" #include "qemu-common.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" -#include "libqos/malloc.h" -#include "libqos/malloc-pc.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_pci.h" static const char mount_tag[] ="qtest" ;static char *test_share; -static void qvirtio_9p_start (void )
tests/virtio-9p-test.c line 29
Quoted 10 lines
tests/virtio-9p-test.c +4
-2-{ -char *args; +static QOSState *qvirtio_9p_start (void ) +{ test_share =g_strdup ("/tmp/qtest.XXXXXX" );g_assert_nonnull (mkdtemp (test_share)); +const char *cmd ="-fsdev local,id=fsdev0,security_model=none,path=%s " +"-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" ;
Even if C99 supports declarations within the code, I prefer the old school way of declaring variables followed by an empty line, at the top.
Cheers.
--
Greg
Re: [Qemu-devel] [PATCH v3 3/5] tests: use qtest_pc_boot()/qtest_shutdown() in virtio tests
Quoted 50 lines · Greg Kurz
Quoted 11 lines · On Sat, 1 Oct 2016 20:56:02 +0200 Laurent Vivier <[email protected]> wrote:
This patch replaces calls to
qtest_start()andqtest_end()by calls toqtest_pc_boot()andqtest_shutdown().This allows to initialize memory allocator and PCI interface functions. This will ease to enable virtio tests on other architectures by only adding a specific
qtest_XXX_boot()(likeqtest_spapr_boot()).Signed-off-by Laurent Vivier <[email protected]>Reviewed-by Greg Kurz <[email protected]>---
Oops I had missed it during review but I have a single remark for the 9p test.
My R-b stands anyway.
Quoted 30 lines
tests/virtio-9p-test.c | 51 +++++++--------- tests/virtio-blk-test.c | 150 ++++++++++++++++++++--------------------------- tests/virtio-net-test.c | 39 +++++------- tests/virtio-scsi-test.c | 67 +++++++++------------ 4 files changed, 129 insertions(+), 178 deletions(-)tests/virtio-9p-test.c +1
-6@@ -10,62 +10,56 @@#include "qemu/osdep.h" #include "libqtest.h" #include "qemu-common.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" -#include "libqos/malloc.h" -#include "libqos/malloc-pc.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_pci.h" static const char mount_tag[] ="qtest" ;static char *test_share; -static void qvirtio_9p_start (void ) -{ -char *args;
Quoted 10 lines
tests/virtio-9p-test.c line 29
Quoted 7 lines
tests/virtio-9p-test.c +4
-0+static QOSState *qvirtio_9p_start (void ) +{ test_share =g_strdup ("/tmp/qtest.XXXXXX" );g_assert_nonnull (mkdtemp (test_share)); +const char *cmd ="-fsdev local,id=fsdev0,security_model=none,path=%s " +"-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" ;Even if C99 supports declarations within the code, I prefer the old school way of declaring variables followed by an empty line, at the top.
Yes, you're right, I prefer too...
I will resend the series next week.
Thanks,
Laurent
Re: [Qemu-devel] [PATCH v3 3/5] tests: use qtest_pc_boot()/qtest_shutdown() in virtio tests
Quoted 62 lines · On Fri, 7 Oct 2016 19:54:54 +0200 Laurent Vivier <[email protected]> wrote:
Quoted 50 lines · Greg Kurz
Quoted 11 lines · On Sat, 1 Oct 2016 20:56:02 +0200 Laurent Vivier <[email protected]> wrote:
This patch replaces calls to
qtest_start()andqtest_end()by calls toqtest_pc_boot()andqtest_shutdown().This allows to initialize memory allocator and PCI interface functions. This will ease to enable virtio tests on other architectures by only adding a specific
qtest_XXX_boot()(likeqtest_spapr_boot()).Signed-off-by Laurent Vivier <[email protected]>Reviewed-by Greg Kurz <[email protected]>---
Oops I had missed it during review but I have a single remark for the 9p test.
My R-b stands anyway.
Quoted 30 lines
tests/virtio-9p-test.c | 51 +++++++--------- tests/virtio-blk-test.c | 150 ++++++++++++++++++++--------------------------- tests/virtio-net-test.c | 39 +++++------- tests/virtio-scsi-test.c | 67 +++++++++------------ 4 files changed, 129 insertions(+), 178 deletions(-)tests/virtio-9p-test.c +1
-6@@ -10,62 +10,56 @@#include "qemu/osdep.h" #include "libqtest.h" #include "qemu-common.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" -#include "libqos/malloc.h" -#include "libqos/malloc-pc.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_pci.h" static const char mount_tag[] ="qtest" ;static char *test_share; -static void qvirtio_9p_start (void ) -{ -char *args;Quoted 10 lines
tests/virtio-9p-test.c line 29
Quoted 7 lines
tests/virtio-9p-test.c +4
-0+static QOSState *qvirtio_9p_start (void ) +{ test_share =g_strdup ("/tmp/qtest.XXXXXX" );g_assert_nonnull (mkdtemp (test_share)); +const char *cmd ="-fsdev local,id=fsdev0,security_model=none,path=%s " +"-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" ;Even if C99 supports declarations within the code, I prefer the old school way of declaring variables followed by an empty line, at the top.
Quoted 8 lines
Yes, you're right, I prefer too...
I will resend the series next week.
Thanks,
Laurent
Hi Laurent,
Do you plan to repost soon ? I ask because I have some patches to add functional testing to virtio-9p-test, that will likely conflict with this series.
Cheers.
--
Greg
Re: [Qemu-devel] [PATCH v3 3/5] tests: use qtest_pc_boot()/qtest_shutdown() in virtio tests
Quoted 67 lines · Greg Kurz
Quoted 64 lines · On Fri, 7 Oct 2016 19:54:54 +0200 Laurent Vivier <[email protected]> wrote:
Quoted 50 lines · Greg Kurz
Quoted 11 lines · On Sat, 1 Oct 2016 20:56:02 +0200 Laurent Vivier <[email protected]> wrote:
This patch replaces calls to
qtest_start()andqtest_end()by calls toqtest_pc_boot()andqtest_shutdown().This allows to initialize memory allocator and PCI interface functions. This will ease to enable virtio tests on other architectures by only adding a specific
qtest_XXX_boot()(likeqtest_spapr_boot()).Signed-off-by Laurent Vivier <[email protected]>Reviewed-by Greg Kurz <[email protected]>---
Oops I had missed it during review but I have a single remark for the 9p test.
My R-b stands anyway.
Quoted 30 lines
tests/virtio-9p-test.c | 51 +++++++--------- tests/virtio-blk-test.c | 150 ++++++++++++++++++++--------------------------- tests/virtio-net-test.c | 39 +++++------- tests/virtio-scsi-test.c | 67 +++++++++------------ 4 files changed, 129 insertions(+), 178 deletions(-)tests/virtio-9p-test.c +1
-6@@ -10,62 +10,56 @@#include "qemu/osdep.h" #include "libqtest.h" #include "qemu-common.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" -#include "libqos/malloc.h" -#include "libqos/malloc-pc.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_pci.h" static const char mount_tag[] ="qtest" ;static char *test_share; -static void qvirtio_9p_start (void ) -{ -char *args;Quoted 10 lines
tests/virtio-9p-test.c line 29
Quoted 7 lines
tests/virtio-9p-test.c +4
-0+static QOSState *qvirtio_9p_start (void ) +{ test_share =g_strdup ("/tmp/qtest.XXXXXX" );g_assert_nonnull (mkdtemp (test_share)); +const char *cmd ="-fsdev local,id=fsdev0,security_model=none,path=%s " +"-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s" ;Even if C99 supports declarations within the code, I prefer the old school way of declaring variables followed by an empty line, at the top.
Yes, you're right, I prefer too...
Quoted 8 lines
Quoted 6 lines
I will resend the series next week.
Thanks,
LaurentHi Laurent,
Hi Greg,
Quoted 4 lines
Do you plan to repost soon ? I ask because I have some patches to add functional testing to virtio-9p-test, that will likely conflict with this series.
I'm going to repost it this morning.
Laurent