diff options
author | Thomas Huth <thuth@redhat.com> | 2021-12-20 11:30:25 +0100 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2021-12-22 08:13:05 +0100 |
commit | 31fb263c2963489055789385aa8b91663756edee (patch) | |
tree | 42e1bef6717bb33cd54aa59073510394e4337726 /tests | |
parent | 046da5ef5747b8ae8efa02bd1d068abd5d639a12 (diff) | |
download | qemu-31fb263c2963489055789385aa8b91663756edee.zip qemu-31fb263c2963489055789385aa8b91663756edee.tar.gz qemu-31fb263c2963489055789385aa8b91663756edee.tar.bz2 |
tests/qtest: Make the filter tests independent from a specific NIC
These filter tests need a NIC, no matter which one, so they use a common
NIC by default. However, these common NIC models might not always have
been compiled into the QEMU target binary, so assuming that a certain NIC
is available is a bad idea. Since the exact type of NIC does not really
matter for these tests, let's switch to "-nic" instead of "-netdev" so
that QEMU can simply pick a default NIC for us.
This way we can now run the tests on other targets that have a default
machine with an on-board/default NIC, too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20211220103025.311759-1-thuth@redhat.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/meson.build | 40 | ||||
-rw-r--r-- | tests/qtest/test-filter-mirror.c | 10 | ||||
-rw-r--r-- | tests/qtest/test-filter-redirector.c | 20 | ||||
-rw-r--r-- | tests/qtest/test-netfilter.c | 8 |
4 files changed, 38 insertions, 40 deletions
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 1b2bde6..37e1eaa 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -47,7 +47,6 @@ qtests_i386 = \ (have_tools ? ['ahci-test'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) + \ - (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['test-filter-redirector'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) + \ (config_host.has_key('CONFIG_LINUX') and \ config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ @@ -90,7 +89,9 @@ qtests_i386 = \ 'vmgenid-test', 'migration-test', 'test-x86-cpuid-compat', - 'numa-test'] + 'numa-test', + 'test-filter-redirector' + ] if dbus_display qtests_i386 += ['dbus-display-test'] @@ -113,31 +114,49 @@ endif qtests_x86_64 = qtests_i386 -qtests_alpha = [ 'boot-serial-test' ] + \ +qtests_alpha = ['boot-serial-test'] + \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) qtests_avr = [ 'boot-serial-test' ] -qtests_hppa = [ 'boot-serial-test' ] + \ +qtests_hppa = ['boot-serial-test'] + \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) -qtests_m68k = [ 'boot-serial-test' ] -qtests_microblaze = [ 'boot-serial-test' ] +qtests_m68k = ['boot-serial-test'] + \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + +qtests_microblaze = ['boot-serial-test'] + \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + qtests_microblazeel = qtests_microblaze qtests_mips = \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) qtests_mips64 = \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) qtests_mips64el = \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) qtests_ppc = \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ ['boot-order-test', 'prom-env-test', 'boot-serial-test'] \ @@ -147,19 +166,22 @@ qtests_ppc64 = \ (config_all_devices.has_key('CONFIG_PSERIES') ? ['device-plug-test'] : []) + \ (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xscom-test'] : []) + \ (config_all_devices.has_key('CONFIG_PSERIES') ? ['rtas-test'] : []) + \ - (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ + (slirp.found() ? ['pxe-test'] : []) + \ (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \ (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \ - (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ qtests_pci + ['migration-test', 'numa-test', 'cpu-plug-test', 'drive_del-test'] qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) -qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] +qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] + \ + ['test-filter-mirror', 'test-filter-redirector'] + \ + (slirp.found() ? ['test-netfilter'] : []) qtests_sparc64 = \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ + (slirp.found() ? ['test-netfilter'] : []) + \ + ['test-filter-mirror', 'test-filter-redirector'] + \ ['prom-env-test', 'boot-serial-test'] qtests_npcm7xx = \ diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mirror.c index bc0dee6..95367d1 100644 --- a/tests/qtest/test-filter-mirror.c +++ b/tests/qtest/test-filter-mirror.c @@ -28,13 +28,8 @@ static void test_mirror(void) char *recv_buf; uint32_t size = sizeof(send_buf); size = htonl(size); - const char *devstr = "e1000"; QTestState *qts; - if (g_str_equal(qtest_get_arch(), "s390x")) { - devstr = "virtio-net-ccw"; - } - ret = socketpair(PF_UNIX, SOCK_STREAM, 0, send_sock); g_assert_cmpint(ret, !=, -1); @@ -42,11 +37,10 @@ static void test_mirror(void) g_assert_cmpint(ret, !=, -1); qts = qtest_initf( - "-netdev socket,id=qtest-bn0,fd=%d " - "-device %s,netdev=qtest-bn0,id=qtest-e0 " + "-nic socket,id=qtest-bn0,fd=%d " "-chardev socket,id=mirror0,fd=%d " "-object filter-mirror,id=qtest-f0,netdev=qtest-bn0,queue=tx,outdev=mirror0 " - , send_sock[1], devstr, recv_sock[1]); + , send_sock[1], recv_sock[1]); struct iovec iov[] = { { diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter-redirector.c index 4269b2c..4f3f59c 100644 --- a/tests/qtest/test-filter-redirector.c +++ b/tests/qtest/test-filter-redirector.c @@ -62,16 +62,6 @@ /* TODO actually test the results and get rid of this */ #define qmp_discard_response(qs, ...) qobject_unref(qtest_qmp(qs, __VA_ARGS__)) -static const char *get_devstr(void) -{ - if (g_str_equal(qtest_get_arch(), "s390x")) { - return "virtio-net-ccw"; - } - - return "rtl8139"; -} - - static void test_redirector_tx(void) { int backend_sock[2], recv_sock; @@ -93,8 +83,7 @@ static void test_redirector_tx(void) g_assert_cmpint(ret, !=, -1); qts = qtest_initf( - "-netdev socket,id=qtest-bn0,fd=%d " - "-device %s,netdev=qtest-bn0,id=qtest-e0 " + "-nic socket,id=qtest-bn0,fd=%d " "-chardev socket,id=redirector0,path=%s,server=on,wait=off " "-chardev socket,id=redirector1,path=%s,server=on,wait=off " "-chardev socket,id=redirector2,path=%s " @@ -103,7 +92,7 @@ static void test_redirector_tx(void) "-object filter-redirector,id=qtest-f1,netdev=qtest-bn0," "queue=tx,indev=redirector2 " "-object filter-redirector,id=qtest-f2,netdev=qtest-bn0," - "queue=tx,outdev=redirector1 ", backend_sock[1], get_devstr(), + "queue=tx,outdev=redirector1 ", backend_sock[1], sock_path0, sock_path1, sock_path0); recv_sock = unix_connect(sock_path1, NULL); @@ -163,8 +152,7 @@ static void test_redirector_rx(void) g_assert_cmpint(ret, !=, -1); qts = qtest_initf( - "-netdev socket,id=qtest-bn0,fd=%d " - "-device %s,netdev=qtest-bn0,id=qtest-e0 " + "-nic socket,id=qtest-bn0,fd=%d " "-chardev socket,id=redirector0,path=%s,server=on,wait=off " "-chardev socket,id=redirector1,path=%s,server=on,wait=off " "-chardev socket,id=redirector2,path=%s " @@ -173,7 +161,7 @@ static void test_redirector_rx(void) "-object filter-redirector,id=qtest-f1,netdev=qtest-bn0," "queue=rx,outdev=redirector2 " "-object filter-redirector,id=qtest-f2,netdev=qtest-bn0," - "queue=rx,indev=redirector1 ", backend_sock[1], get_devstr(), + "queue=rx,indev=redirector1 ", backend_sock[1], sock_path0, sock_path1, sock_path0); struct iovec iov[] = { diff --git a/tests/qtest/test-netfilter.c b/tests/qtest/test-netfilter.c index 785b6f3..b09ef7f 100644 --- a/tests/qtest/test-netfilter.c +++ b/tests/qtest/test-netfilter.c @@ -178,11 +178,6 @@ int main(int argc, char **argv) { int ret; char *args; - const char *devstr = "e1000"; - - if (g_str_equal(qtest_get_arch(), "s390x")) { - devstr = "virtio-net-ccw"; - } g_test_init(&argc, &argv, NULL); qtest_add_func("/netfilter/addremove_one", add_one_netfilter); @@ -192,8 +187,7 @@ int main(int argc, char **argv) qtest_add_func("/netfilter/remove_netdev_multi", remove_netdev_with_multi_netfilter); - args = g_strdup_printf("-netdev user,id=qtest-bn0 " - "-device %s,netdev=qtest-bn0", devstr); + args = g_strdup_printf("-nic user,id=qtest-bn0"); qtest_start(args); ret = g_test_run(); |