Enable the simple virtio tests on s390x, too
cover Enable the simple virtio tests on s390x, too
First patch introduces the qtest_startf() function that can be used to start tests with a printf-like string. This patch was originally part of Eric's bigger qtest refactoring series, and I originally wanted to wait 'til it's included in the master branch. But since this did not happen yet and QEMU soft-freeze is approaching soon, I decided to rather included a slightly simplified version of that patch here instead.
The second patch then finally enables some of the simple virtio tests on s390x, too.
Eric Blake (1):
libqtest: Add qtest_[v]startf()
Thomas Huth (1):
tests: Enable the very simple virtio tests on s390x, too
tests/Makefile.include | 9 ++++--- tests/boot-order-test.c | 11 +++------ tests/boot-serial-test.c | 12 +++------ tests/endianness-test.c | 33 +++++++++---------------- tests/ipmi-bt-test.c | 11 +++------ tests/libqtest.c | 22 +++++++++++++++++ tests/libqtest.h | 25 +++++++++++++++++++ tests/m25p80-test.c | 9 +++---- tests/pnv-xscom-test.c | 16 +++--------- tests/prom-env-test.c | 13 ++++------ tests/tco-test.c | 10 +++----- tests/test-filter-mirror.c | 14 +++++------ tests/test-filter-redirector.c | 56 ++++++++++++++++++++---------------------- tests/virtio-balloon-test.c | 8 +++--- tests/virtio-blk-test.c | 5 +--- tests/virtio-console-test.c | 19 ++++++++------ tests/virtio-serial-test.c | 10 +++++--- tests/vmgenid-test.c | 29 ++++++---------------- 18 files changed, 156 insertions(+), 156 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 2/2 tests: Enable the very simple virtio tests on s390x, too
These tests can easily be used on s390x, too. We just have to make sure to use the virtio-xxx-ccw devices instead of virtio-xxx-pci.
--- tests/Makefile.include | 9 ++++++--- tests/virtio-balloon-test.c | 8 +++++--- tests/virtio-console-test.c | 19 +++++++++++-------- tests/virtio-serial-test.c | 10 ++++++---- 4 files changed, 28 insertions(+), 18 deletions(-)
tests/Makefile.include +6 -3
@@ -367,6 +367,9 @@ check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF) check-qtest-s390x-y += tests/drive_del-test$(EXESUF) +check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF) +check-qtest-s390x-y += tests/virtio-console-test$(EXESUF) +check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF) check-qtest-generic-y += tests/qom-test$(EXESUF) check-qtest-generic-y += tests/test-hmp$(EXESUF)
@@ -754,14 +757,14 @@ tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o tests/ne2000-test$(EXESUF): tests/ne2000-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) -tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o +tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o $(libqos-virtio-obj-y) tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y) tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y) tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y) tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y) tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o $(libqos-virtio-obj-y) -tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o -tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o +tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o $(libqos-virtio-obj-y) +tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o $(libqos-virtio-obj-y) tests/tpci200-test$(EXESUF): tests/tpci200-test.o tests/display-vga-test$(EXESUF): tests/display-vga-test.o tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
tests/virtio-balloon-test.c +5 -3
@@ -9,9 +9,10 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/virtio.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop (void ) +static void balloon_nop (void ) { }
@@ -20,9 +21,10 @@ int main(int argc, char **argv)int ret;g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/virtio/balloon/pci/nop" , pci_nop); +qtest_add_func ("/virtio/balloon/nop" , balloon_nop); -qtest_start ("-device virtio-balloon-pci" ); + global_qtest =qtest_startf ("-device virtio-balloon-%s" , +qvirtio_get_dev_type ()); ret =g_test_run ();qtest_end ();
tests/virtio-console-test.c +11 -8
@@ -9,27 +9,30 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/virtio.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void console_pci_nop (void ) +static void console_nop (void ) { -qtest_start ("-device virtio-serial-pci,id=vser0 " -"-device virtconsole,bus=vser0.0" ); + global_qtest =qtest_startf ("-device virtio-serial-%s,id=vser0 " +"-device virtconsole,bus=vser0.0" , +qvirtio_get_dev_type ());qtest_end (); } -static void serialport_pci_nop (void ) +static void serialport_nop (void ) { -qtest_start ("-device virtio-serial-pci,id=vser0 " -"-device virtserialport,bus=vser0.0" ); + global_qtest =qtest_startf ("-device virtio-serial-%s,id=vser0 " +"-device virtserialport,bus=vser0.0" , +qvirtio_get_dev_type ());qtest_end (); }int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/virtio/console/pci/nop" , console_pci_nop); -qtest_add_func ("/virtio/serialport/pci/nop" , serialport_pci_nop); +qtest_add_func ("/virtio/console/nop" , console_nop); +qtest_add_func ("/virtio/serialport/nop" , serialport_nop);return g_test_run (); }
tests/virtio-serial-test.c +6 -4
@@ -9,9 +9,10 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/virtio.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop (void ) +static void virtio_serial_nop (void ) { }
@@ -27,10 +28,11 @@ int main(int argc, char **argv)int ret;g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/virtio/serial/pci/nop" , pci_nop); -qtest_add_func ("/virtio/serial/pci/hotplug" , hotplug); +qtest_add_func ("/virtio/serial/nop" , virtio_serial_nop); +qtest_add_func ("/virtio/serial/hotplug" , hotplug); -qtest_start ("-device virtio-serial-pci" ); + global_qtest =qtest_startf ("-device virtio-serial-%s" , +qvirtio_get_dev_type ()); ret =g_test_run ();qtest_end ();
Signature · 1 line
1.8.3.1
PATCH 1/2 libqtest: Add qtest_[v]startf()
In reply to Thomas HuthFrom: Eric Blake <[email protected]>
We have several callers that were formatting the argument strings themselves; consolidate this effort by adding new convenience functions directly in libqtest, and update some call-sites that can benefit from it.
Note that the new functions qtest_startf() and qtest_vstartf() behave more like qtest_init() (the caller must assign global_qtest after the fact, rather than getting it implicitly set). This helps us prepare for future patches that get rid of the global variable, by explicitly highlighting which tests still depend on it now.
[thuth: Dropped the hunks that do not apply cleanly to qemu master
yet and added the missing g_free(args) in qtest_vstartf()]
--- tests/boot-order-test.c | 11 +++------ tests/boot-serial-test.c | 12 +++------ tests/endianness-test.c | 33 +++++++++---------------- tests/ipmi-bt-test.c | 11 +++------ tests/libqtest.c | 22 +++++++++++++++++ tests/libqtest.h | 25 +++++++++++++++++++ tests/m25p80-test.c | 9 +++---- tests/pnv-xscom-test.c | 16 +++--------- tests/prom-env-test.c | 13 ++++------ tests/tco-test.c | 10 +++----- tests/test-filter-mirror.c | 14 +++++------ tests/test-filter-redirector.c | 56 ++++++++++++++++++++---------------------- tests/virtio-blk-test.c | 5 +--- tests/vmgenid-test.c | 29 ++++++---------------- 14 files changed, 128 insertions(+), 138 deletions(-)
tests/boot-order-test.c +4 -7
@@ -28,14 +28,12 @@ static void test_a_boot_order(const char *machine,uint64_t expected_boot, uint64_t expected_reboot) { - char *args; uint64_t actual; - args =g_strdup_printf ("-nodefaults%s%s %s" , - machine ?" -M " :"" , - machine ?:"" , - test_args); -qtest_start (args); + global_qtest =qtest_startf ("-nodefaults%s%s %s" , + machine ?" -M " :"" , + machine ?:"" , + test_args); actual =read_boot_order (); g_assert_cmphex(actual, ==, expected_boot);qmp_discard_response ("{ 'execute': 'system_reset' }" );
@@ -47,7 +45,6 @@ static void test_a_boot_order(const char *machine, actual =read_boot_order (); g_assert_cmphex(actual, ==, expected_reboot);qtest_quit (global_qtest); -g_free (args); } static void test_boot_orders(const char *machine,
tests/boot-serial-test.c +4 -8
@@ -71,7 +71,6 @@ done:static void test_machine (const void *data) {const testdef_t *test = data; -char *args;char tmpname[] ="/tmp/qtest-boot-serial-XXXXXX" ;int fd;
@@ -82,18 +81,15 @@ static void test_machine(const void *data)* Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - args =g_strdup_printf ("-M %s,accel=tcg:kvm " -"-chardev file,id=serial0,path=%s " -"-no-shutdown -serial chardev:serial0 %s" , - test->machine, tmpname, test->extra); - -qtest_start (args); + global_qtest =qtest_startf ("-M %s,accel=tcg:kvm " +"-chardev file,id=serial0,path=%s " +"-no-shutdown -serial chardev:serial0 %s" , + test->machine, tmpname, test->extra);unlink (tmpname);check_guest_output (test, fd);qtest_quit (global_qtest); -g_free (args);close (fd); }
tests/endianness-test.c +12 -21
@@ -114,13 +114,11 @@ static void isa_outl(const TestCase *test, uint16_t addr, uint32_t value)static void test_endianness (gconstpointer data) {const TestCase *test = data; -char *args; - args =g_strdup_printf ("-M %s%s%s -device pc-testdev" , - test->machine, - test->superio ?" -device " :"" , - test->superio ?:"" ); -qtest_start (args); + global_qtest =qtest_startf ("-M %s%s%s -device pc-testdev" , + test->machine, + test->superio ?" -device " :"" , + test->superio ?:"" );isa_outl (test,0xe0 ,0x87654321 ); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765);
@@ -183,19 +181,16 @@ static void test_endianness(gconstpointer data) g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x43); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x21);qtest_quit (global_qtest); -g_free (args); }static void test_endianness_split (gconstpointer data) {const TestCase *test = data; -char *args; - args =g_strdup_printf ("-M %s%s%s -device pc-testdev" , - test->machine, - test->superio ?" -device " :"" , - test->superio ?:"" ); -qtest_start (args); + global_qtest =qtest_startf ("-M %s%s%s -device pc-testdev" , + test->machine, + test->superio ?" -device " :"" , + test->superio ?:"" );isa_outl (test,0xe8 ,0x87654321 ); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765);
@@ -230,19 +225,16 @@ static void test_endianness_split(gconstpointer data) g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321);qtest_quit (global_qtest); -g_free (args); }static void test_endianness_combine (gconstpointer data) {const TestCase *test = data; -char *args; - args =g_strdup_printf ("-M %s%s%s -device pc-testdev" , - test->machine, - test->superio ?" -device " :"" , - test->superio ?:"" ); -qtest_start (args); + global_qtest =qtest_startf ("-M %s%s%s -device pc-testdev" , + test->machine, + test->superio ?" -device " :"" , + test->superio ?:"" );isa_outl (test,0xe0 ,0x87654321 ); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765);
@@ -277,7 +269,6 @@ static void test_endianness_combine(gconstpointer data) g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321);qtest_quit (global_qtest); -g_free (args); }int main (int argc,char **argv)
tests/ipmi-bt-test.c +4 -7
@@ -401,7 +401,6 @@ static void open_socket(void)int main (int argc,char **argv) {const char *arch =qtest_get_arch (); -char *cmdline;int ret;/* Check architecture */
@@ -415,12 +414,10 @@ int main(int argc, char **argv)/* Run the tests */ g_test_init (&argc, &argv,NULL ); - cmdline =g_strdup_printf ( -" -chardev socket,id=ipmi0,host=localhost,port=%d,reconnect=10" -" -device ipmi-bmc-extern,chardev=ipmi0,id=bmc0" -" -device isa-ipmi-bt,bmc=bmc0" , emu_port); -qtest_start (cmdline); -g_free (cmdline); + global_qtest =qtest_startf ( +" -chardev socket,id=ipmi0,host=localhost,port=%d,reconnect=10" +" -device ipmi-bmc-extern,chardev=ipmi0,id=bmc0" +" -device isa-ipmi-bt,bmc=bmc0" , emu_port);qtest_irq_intercept_in (global_qtest,"ioapic" );qtest_add_func ("/ipmi/extern/connect" , test_connect);qtest_add_func ("/ipmi/extern/bt_base" , test_bt_base);
tests/libqtest.c +22 -0
@@ -244,6 +244,28 @@ QTestState *qtest_init(const char *extra_args)return s; } +QTestState *qtest_vstartf (const char *fmt,va_list ap) +{ +char *args =g_strdup_vprintf (fmt, ap); +QTestState *s; + + s =qtest_start (args); +g_free (args); + global_qtest =NULL ; +return s; +} + +QTestState *qtest_startf (const char *fmt, ...) +{ +va_list ap; +QTestState *s; + +va_start (ap, fmt); + s =qtest_vstartf (fmt, ap); +va_end (ap); +return s; +} +void qtest_quit (QTestState *s) {g_hook_destroy_link (&abrt_hooks,g_hook_find_data (&abrt_hooks, TRUE, s));
tests/libqtest.h +25 -0
@@ -24,6 +24,31 @@ typedef struct QTestState QTestState;extern QTestState *global_qtest;/** +* qtest_startf: +* @fmt...: Format for creating other arguments to pass to QEMU, formatted +* like sprintf(). +* +* Start QEMU and return the resulting #QTestState (but unlike qtest_start(), +* #global_qtest is left at NULL). +* +* Returns: #QTestState instance. +*/ +QTestState *qtest_startf (const char *fmt, ...)GCC_FMT_ATTR (1 ,2 ); + +/** +* qtest_vstartf: +* @fmt: Format for creating other arguments to pass to QEMU, formatted +* like vsprintf(). +* @ap: Format arguments. +* +* Start QEMU and return the resulting #QTestState (but unlike qtest_start(), +* #global_qtest is left at NULL). +* +* Returns: #QTestState instance. +*/ +QTestState *qtest_vstartf (const char *fmt,va_list ap)GCC_FMT_ATTR (1 ,0 ); + +/** * qtest_init: * @extra_args: other arguments to pass to QEMU. *
tests/m25p80-test.c +3 -6
@@ -354,7 +354,6 @@ int main(int argc, char **argv) {int ret;int fd; -char *args;g_test_init (&argc, &argv,NULL );
@@ -364,10 +363,9 @@ int main(int argc, char **argv)g_assert (ret ==0 );close (fd); - args =g_strdup_printf ("-m 256 -machine palmetto-bmc " -"-drive file=%s,format=raw,if=mtd" , - tmp_path); -qtest_start (args); + global_qtest =qtest_startf ("-m 256 -machine palmetto-bmc " +"-drive file=%s,format=raw,if=mtd" , + tmp_path);qtest_add_func ("/m25p80/read_jedec" , test_read_jedec);qtest_add_func ("/m25p80/erase_sector" , test_erase_sector);
@@ -380,6 +378,5 @@ int main(int argc, char **argv)qtest_quit (global_qtest);unlink (tmp_path); -g_free (args);return ret; }
tests/pnv-xscom-test.c +4 -12
@@ -81,16 +81,12 @@ static void test_xscom_cfam_id(const PnvChip *chip)static void test_cfam_id (const void *data) { -char *args;const PnvChip *chip = data; - args =g_strdup_printf ("-M powernv,accel=tcg -cpu %s" , chip->cpu_model); - -qtest_start (args); + global_qtest =qtest_startf ("-M powernv,accel=tcg -cpu %s" , + chip->cpu_model);test_xscom_cfam_id (chip);qtest_quit (global_qtest); - -g_free (args); }#define PNV_XSCOM_EX_CORE_BASE (chip, i) \
@@ -109,16 +105,12 @@ static void test_xscom_core(const PnvChip *chip)static void test_core (const void *data) { -char *args;const PnvChip *chip = data; - args =g_strdup_printf ("-M powernv,accel=tcg -cpu %s" , chip->cpu_model); - -qtest_start (args); + global_qtest =qtest_startf ("-M powernv,accel=tcg -cpu %s" , + chip->cpu_model);test_xscom_core (chip);qtest_quit (global_qtest); - -g_free (args); }static void add_test (const char *name,void (*test)(const void *data))
tests/prom-env-test.c +5 -8
@@ -44,21 +44,18 @@ static void check_guest_memory(void)static void test_machine (const void *machine) { -char *args;const char *extra_args;/* The pseries firmware boots much faster without the default devices */ extra_args =strcmp (machine,"pseries" ) ==0 ?"-nodefaults" :"" ; - args =g_strdup_printf ("-M %s,accel=tcg %s -prom-env 'use-nvramrc?=true' " -"-prom-env 'nvramrc=%x %x l!' " , - (const char *)machine, extra_args,MAGIC ,ADDRESS ); - -qtest_start (args); + global_qtest =qtest_startf ("-M %s,accel=tcg %s " +"-prom-env 'use-nvramrc?=true' " +"-prom-env 'nvramrc=%x %x l!' " , + (const char *)machine, extra_args, +MAGIC ,ADDRESS );check_guest_memory ();qtest_quit (global_qtest); - -g_free (args); }static void add_tests (const char *machines[])
tests/tco-test.c +4 -6
@@ -55,14 +55,12 @@ static void test_end(TestData *d)static void test_init (TestData *d) {QTestState *qs; -char *s; - s =g_strdup_printf ("-machine q35 %s %s" , - d->noreboot ?"" :"-global ICH9-LPC.noreboot=false" , - !d->args ?"" : d->args); - qs =qtest_start (s); + qs =qtest_startf ("-machine q35 %s %s" , + d->noreboot ?"" :"-global ICH9-LPC.noreboot=false" , + !d->args ?"" : d->args); + global_qtest = qs;qtest_irq_intercept_in (qs,"ioapic" ); -g_free (s); d->bus =qpci_init_pc (NULL ); d->dev =qpci_device_find (d->bus,QPCI_DEVFN (0x1f ,0x00 ));
tests/test-filter-mirror.c +6 -8
@@ -18,7 +18,6 @@static void test_mirror (void ) {int send_sock[2 ], recv_sock; -char *cmdline;uint32_t ret =0 , len =0 ;char send_buf[] ="Hello! filter-mirror~" ;char sock_path[] ="filter-mirror.XXXXXX" ;
@@ -37,13 +36,12 @@ static void test_mirror(void) ret =mkstemp (sock_path); g_assert_cmpint(ret, !=, -1); - cmdline =g_strdup_printf ("-netdev socket,id=qtest-bn0,fd=%d " -"-device %s,netdev=qtest-bn0,id=qtest-e0 " -"-chardev socket,id=mirror0,path=%s,server,nowait " -"-object filter-mirror,id=qtest-f0,netdev=qtest-bn0,queue=tx,outdev=mirror0 " - , send_sock[1 ], devstr, sock_path); -qtest_start (cmdline); -g_free (cmdline); + global_qtest =qtest_startf ( +"-netdev socket,id=qtest-bn0,fd=%d " +"-device %s,netdev=qtest-bn0,id=qtest-e0 " +"-chardev socket,id=mirror0,path=%s,server,nowait " +"-object filter-mirror,id=qtest-f0,netdev=qtest-bn0,queue=tx,outdev=mirror0 " + , send_sock[1 ], devstr, sock_path); recv_sock =unix_connect (sock_path,NULL ); g_assert_cmpint(recv_sock, !=, -1);
tests/test-filter-redirector.c +26 -30
80 lines not on this page · raw message
tests/virtio-blk-test.c +1 -4
@@ -84,19 +84,16 @@ static QOSState *pci_test_start(void)static void arm_test_start (void ) { -char *cmdline;char *tmp_path; tmp_path =drive_create (); - cmdline =g_strdup_printf ("-machine virt " + global_qtest =qtest_startf ("-machine virt " "-drive if=none,id=drive0,file=%s,format=raw " "-device virtio-blk-device,drive=drive0" , tmp_path); -qtest_start (cmdline);unlink (tmp_path);g_free (tmp_path); -g_free (cmdline); }static void test_end (void )
tests/vmgenid-test.c +8 -21
@@ -130,41 +130,32 @@ static void read_guid_from_monitor(QemuUUID *guid)static char disk[] ="tests/vmgenid-test-disk-XXXXXX" ; -static char *guid_cmd_strdup (const char *guid) -{ -return g_strdup_printf ("-machine accel=kvm:tcg " -"-device vmgenid,id=testvgid,guid=%s " -"-drive id=hd0,if=none,file=%s,format=raw " -"-device ide-hd,drive=hd0 " , - guid, disk); -} - +#define GUID_CMD (guid) \ + "-machine accel=kvm:tcg " \ + "-device vmgenid,id=testvgid,guid=%s " \ + "-drive id=hd0,if=none,file=%s,format=raw " \ + "-device ide-hd,drive=hd0 ", guid, diskstatic void vmgenid_set_guid_test (void ) {QemuUUID expected, measured; -gchar *cmd;g_assert (qemu_uuid_parse (VGID_GUID , &expected) ==0 ); - cmd =guid_cmd_strdup (VGID_GUID ); -qtest_start (cmd); + global_qtest =qtest_startf (GUID_CMD (VGID_GUID ));/* Read the GUID from accessing guest memory */ read_guid_from_memory (&measured);g_assert (memcmp (measured.data, expected.data,sizeof (measured.data)) ==0 );qtest_quit (global_qtest); -g_free (cmd); }static void vmgenid_set_guid_auto_test (void ) { -char *cmd;QemuUUID measured; - cmd =guid_cmd_strdup ("auto" ); -qtest_start (cmd); + global_qtest =qtest_startf (GUID_CMD ("auto" ));read_guid_from_memory (&measured);
@@ -172,25 +163,21 @@ static void vmgenid_set_guid_auto_test(void)g_assert (!qemu_uuid_is_null (&measured));qtest_quit (global_qtest); -g_free (cmd); }static void vmgenid_query_monitor_test (void ) {QemuUUID expected, measured; -gchar *cmd;g_assert (qemu_uuid_parse (VGID_GUID , &expected) ==0 ); - cmd =guid_cmd_strdup (VGID_GUID ); -qtest_start (cmd); + global_qtest =qtest_startf (GUID_CMD (VGID_GUID ));/* Read the GUID via the monitor */ read_guid_from_monitor (&measured);g_assert (memcmp (measured.data, expected.data,sizeof (measured.data)) ==0 );qtest_quit (global_qtest); -g_free (cmd); }int main (int argc,char **argv)
Signature · 1 line
1.8.3.1
Quoted 7 lines · Thomas Huth
First patch introduces the
qtest_startf()function that can be used to start tests with a printf-like string. This patch was originally part of Eric's bigger qtest refactoring series, and I originally wanted to wait 'til it's included in the master branch. But since this did not happen yet and QEMU soft-freeze is approaching soon, I decided to rather included a slightly simplified version of that patch here instead.
Fair enough. I'm also trying to focus on getting features in before soft freeze, hence my lack of rebasing the qtest refactoring series in the meantime. Arguably (although it is a bit weak) we can claim testsuite fixes as material that is still relevant after soft freeze as it does not affect the final installed binaries, as long as they still go in before hard freeze, but it's hard to say at this point if any of my qtest refactoring will make 2.11.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 2/2] tests: Enable the very simple virtio tests on s390x, too
In reply to Thomas HuthQuoted 5 lines · Thomas Huth
These tests can easily be used on s390x, too. We just have to make sure to use the virtio-xxx-ccw devices instead of virtio-xxx-pci.
Signed-off-by Thomas Huth <[email protected]>---
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 9 lines · On Wed, 18 Oct 2017 10:01:57 -0500 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Thomas Huth
First patch introduces the
qtest_startf()function that can be used to start tests with a printf-like string. This patch was originally part of Eric's bigger qtest refactoring series, and I originally wanted to wait 'til it's included in the master branch. But since this did not happen yet and QEMU soft-freeze is approaching soon, I decided to rather included a slightly simplified version of that patch here instead.
Quoted 8 lines
Fair enough. I'm also trying to focus on getting features in before soft freeze, hence my lack of rebasing the qtest refactoring series in the meantime. Arguably (although it is a bit weak) we can claim testsuite fixes as material that is still relevant after soft freeze as it does not affect the final installed binaries, as long as they still go in before hard freeze, but it's hard to say at this point if any of my qtest refactoring will make 2.11.
Hi Eric,
does Thomas' port of your patch look sane? If yes, I'll queue both patches on s390-next for 2.11.
Quoted 21 lines · Cornelia Huck
Quoted 9 lines · On Wed, 18 Oct 2017 10:01:57 -0500 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Thomas Huth
First patch introduces the
qtest_startf()function that can be used to start tests with a printf-like string. This patch was originally part of Eric's bigger qtest refactoring series, and I originally wanted to wait 'til it's included in the master branch. But since this did not happen yet and QEMU soft-freeze is approaching soon, I decided to rather included a slightly simplified version of that patch here instead.Quoted 8 lines
Fair enough. I'm also trying to focus on getting features in before soft freeze, hence my lack of rebasing the qtest refactoring series in the meantime. Arguably (although it is a bit weak) we can claim testsuite fixes as material that is still relevant after soft freeze as it does not affect the final installed binaries, as long as they still go in before hard freeze, but it's hard to say at this point if any of my qtest refactoring will make 2.11.
Quoted 4 lines
Hi Eric,
does Thomas' port of your patch look sane? If yes, I'll queue both patches on s390-next for 2.11.
Yes, it's fine with me.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 8 lines · Thomas Huth
First patch introduces the
qtest_startf()function that can be used to start tests with a printf-like string. This patch was originally part of Eric's bigger qtest refactoring series, and I originally wanted to wait 'til it's included in the master branch. But since this did not happen yet and QEMU soft-freeze is approaching soon, I decided to rather included a slightly simplified version of that patch here instead.
Quoted 4 lines
The second patch then finally enables some of the simple virtio tests on s390x, too.
From virtio POV:
Quoted 28 lines
Eric Blake (1):
libqtest: Add qtest_[v]startf()Thomas Huth (1):
tests: Enable the very simple virtio tests on s390x, tootests/Makefile.include | 9 ++++--- tests/boot-order-test.c | 11 +++------ tests/boot-serial-test.c | 12 +++------ tests/endianness-test.c | 33 +++++++++---------------- tests/ipmi-bt-test.c | 11 +++------ tests/libqtest.c | 22 +++++++++++++++++ tests/libqtest.h | 25 +++++++++++++++++++ tests/m25p80-test.c | 9 +++---- tests/pnv-xscom-test.c | 16 +++--------- tests/prom-env-test.c | 13 ++++------ tests/tco-test.c | 10 +++----- tests/test-filter-mirror.c | 14 +++++------ tests/test-filter-redirector.c | 56 ++++++++++++++++++++---------------------- tests/virtio-balloon-test.c | 8 +++--- tests/virtio-blk-test.c | 5 +--- tests/virtio-console-test.c | 19 ++++++++------ tests/virtio-serial-test.c | 10 +++++--- tests/vmgenid-test.c | 29 ++++++---------------- 18 files changed, 156 insertions(+), 156 deletions(-)Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [qemu-s390x] [PATCH 2/2] tests: Enable the very simple virtio tests on s390x, too
In reply to Thomas HuthQuoted 147 lines · Thomas Huth
These tests can easily be used on s390x, too. We just have to make sure to use the virtio-xxx-ccw devices instead of virtio-xxx-pci.
Signed-off-by Thomas Huth <[email protected]>--- tests/Makefile.include | 9 ++++++--- tests/virtio-balloon-test.c | 8 +++++--- tests/virtio-console-test.c | 19 +++++++++++-------- tests/virtio-serial-test.c | 10 ++++++---- 4 files changed, 28 insertions(+), 18 deletions(-)tests/Makefile.include +6
-3@@ -367,6 +367,9 @@ check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF) check-qtest-s390x-y += tests/drive_del-test$(EXESUF) +check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF) +check-qtest-s390x-y += tests/virtio-console-test$(EXESUF) +check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF) check-qtest-generic-y += tests/qom-test$(EXESUF) check-qtest-generic-y += tests/test-hmp$(EXESUF)@@ -754,14 +757,14 @@ tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o tests/ne2000-test$(EXESUF): tests/ne2000-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) -tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o +tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o $(libqos-virtio-obj-y) tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y) tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y) tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y) tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y) tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o $(libqos-virtio-obj-y) -tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o -tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o +tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o $(libqos-virtio-obj-y) +tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o $(libqos-virtio-obj-y) tests/tpci200-test$(EXESUF): tests/tpci200-test.o tests/display-vga-test$(EXESUF): tests/display-vga-test.o tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.otests/virtio-balloon-test.c +5
-3@@ -9,9 +9,10 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/virtio.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop (void ) +static void balloon_nop (void ) { }@@ -20,9 +21,10 @@ int main(int argc, char **argv)int ret;g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/virtio/balloon/pci/nop" , pci_nop); +qtest_add_func ("/virtio/balloon/nop" , balloon_nop); -qtest_start ("-device virtio-balloon-pci" ); + global_qtest =qtest_startf ("-device virtio-balloon-%s" , +qvirtio_get_dev_type ()); ret =g_test_run ();qtest_end ();tests/virtio-console-test.c +11
-8@@ -9,27 +9,30 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/virtio.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void console_pci_nop (void ) +static void console_nop (void ) { -qtest_start ("-device virtio-serial-pci,id=vser0 " -"-device virtconsole,bus=vser0.0" ); + global_qtest =qtest_startf ("-device virtio-serial-%s,id=vser0 " +"-device virtconsole,bus=vser0.0" , +qvirtio_get_dev_type ());qtest_end (); } -static void serialport_pci_nop (void ) +static void serialport_nop (void ) { -qtest_start ("-device virtio-serial-pci,id=vser0 " -"-device virtserialport,bus=vser0.0" ); + global_qtest =qtest_startf ("-device virtio-serial-%s,id=vser0 " +"-device virtserialport,bus=vser0.0" , +qvirtio_get_dev_type ());qtest_end (); }int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/virtio/console/pci/nop" , console_pci_nop); -qtest_add_func ("/virtio/serialport/pci/nop" , serialport_pci_nop); +qtest_add_func ("/virtio/console/nop" , console_nop); +qtest_add_func ("/virtio/serialport/nop" , serialport_nop);return g_test_run (); }tests/virtio-serial-test.c +6
-4@@ -9,9 +9,10 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/virtio.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop (void ) +static void virtio_serial_nop (void ) { }@@ -27,10 +28,11 @@ int main(int argc, char **argv)int ret;g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/virtio/serial/pci/nop" , pci_nop); -qtest_add_func ("/virtio/serial/pci/hotplug" , hotplug); +qtest_add_func ("/virtio/serial/nop" , virtio_serial_nop); +qtest_add_func ("/virtio/serial/hotplug" , hotplug); -qtest_start ("-device virtio-serial-pci" ); + global_qtest =qtest_startf ("-device virtio-serial-%s" , +qvirtio_get_dev_type ()); ret =g_test_run ();qtest_end ();
Cornelia Huck
AppliedQuoted 28 lines · On Wed, 18 Oct 2017 16:20:26 +0200 Thomas Huth <[email protected]> wrote:
First patch introduces the
qtest_startf()function that can be used to start tests with a printf-like string. This patch was originally part of Eric's bigger qtest refactoring series, and I originally wanted to wait 'til it's included in the master branch. But since this did not happen yet and QEMU soft-freeze is approaching soon, I decided to rather included a slightly simplified version of that patch here instead.The second patch then finally enables some of the simple virtio tests on s390x, too.
Eric Blake (1):
libqtest: Add qtest_[v]startf()Thomas Huth (1):
tests: Enable the very simple virtio tests on s390x, tootests/Makefile.include | 9 ++++--- tests/boot-order-test.c | 11 +++------ tests/boot-serial-test.c | 12 +++------ tests/endianness-test.c | 33 +++++++++---------------- tests/ipmi-bt-test.c | 11 +++------ tests/libqtest.c | 22 +++++++++++++++++ tests/libqtest.h | 25 +++++++++++++++++++ tests/m25p80-test.c | 9 +++---- tests/pnv-xscom-test.c | 16 +++--------- tests/prom-env-test.c | 13 ++++------ tests/tco-test.c | 10 +++-----
Quoted 9 lines
tests/test-filter-mirror.c | 14 +++++------ tests/test-filter-redirector.c | 56 ++++++++++++++++++++---------------------- tests/virtio-balloon-test.c | 8 +++--- tests/virtio-blk-test.c | 5 +--- tests/virtio-console-test.c | 19 ++++++++------ tests/virtio-serial-test.c | 10 +++++--- tests/vmgenid-test.c | 29 ++++++---------------- 18 files changed, 156 insertions(+), 156 deletions(-)
Thanks, applied.