Message ID | 20211220103025.311759-1-thuth@redhat.com |
---|---|
State | New |
Headers | show |
Series | tests/qtest: Make the filter tests independent from a specific NIC | expand |
> -----Original Message----- > From: Qemu-devel <qemu-devel- > bounces+chen.zhang=intel.com@nongnu.org> On Behalf Of Thomas Huth > Sent: Monday, December 20, 2021 6:30 PM > To: qemu-devel@nongnu.org; Laurent Vivier <lvivier@redhat.com> > Cc: Paolo Bonzini <pbonzini@redhat.com>; Yang Hongyang > <yanghy@cn.fujitsu.com>; Zhang Chen <zhangchen.fnst@cn.fujitsu.com> > Subject: [PATCH] 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. > Oh, It's my and Hongyang's abandoned mailbox. Looks good to me. By the way, should I add the test/qtest/test-filter* to the MAINTAINER file? Reviewed-by: Zhang Chen <chen.zhang@intel.com> Thanks Chen > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > tests/qtest/meson.build | 40 +++++++++++++++++++++------- > tests/qtest/test-filter-mirror.c | 10 ++----- > tests/qtest/test-filter-redirector.c | 20 +++----------- > 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 > ebeac59b3f..7811177f03 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' > + ] > > dbus_daemon = find_program('dbus-daemon', required: false) if > dbus_daemon.found() and config_host.has_key('GDBUS_CODEGEN') > @@ -109,31 +110,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'] \ > @@ -143,19 +162,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 bc0dee64dd..95367d14d3 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 4269b2cdd9..4f3f59cba8 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 > 785b6f3226..b09ef7fae9 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(); > > -- > 2.27.0 >
On 21/12/2021 07.38, Zhang, Chen wrote: > > >> -----Original Message----- >> From: Qemu-devel <qemu-devel- >> bounces+chen.zhang=intel.com@nongnu.org> On Behalf Of Thomas Huth >> Sent: Monday, December 20, 2021 6:30 PM >> To: qemu-devel@nongnu.org; Laurent Vivier <lvivier@redhat.com> >> Cc: Paolo Bonzini <pbonzini@redhat.com>; Yang Hongyang >> <yanghy@cn.fujitsu.com>; Zhang Chen <zhangchen.fnst@cn.fujitsu.com> >> Subject: [PATCH] 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. >> > > Oh, It's my and Hongyang's abandoned mailbox. Sorry, I only looked at the top of the *.c files and copied the e-mail address from there. > Looks good to me. Thanks for the review! > By the way, should I add the test/qtest/test-filter* to the MAINTAINER file? That might be helpful indeed to get you CC:-ed correctly next time. Thomas
> -----Original Message----- > From: Thomas Huth <thuth@redhat.com> > Sent: Tuesday, December 21, 2021 3:35 PM > To: Zhang, Chen <chen.zhang@intel.com>; qemu-devel@nongnu.org; > Laurent Vivier <lvivier@redhat.com> > Cc: Paolo Bonzini <pbonzini@redhat.com> > Subject: Re: [PATCH] tests/qtest: Make the filter tests independent from a > specific NIC > > On 21/12/2021 07.38, Zhang, Chen wrote: > > > > > >> -----Original Message----- > >> From: Qemu-devel <qemu-devel- > >> bounces+chen.zhang=intel.com@nongnu.org> On Behalf Of Thomas > Huth > >> Sent: Monday, December 20, 2021 6:30 PM > >> To: qemu-devel@nongnu.org; Laurent Vivier <lvivier@redhat.com> > >> Cc: Paolo Bonzini <pbonzini@redhat.com>; Yang Hongyang > >> <yanghy@cn.fujitsu.com>; Zhang Chen <zhangchen.fnst@cn.fujitsu.com> > >> Subject: [PATCH] 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. > >> > > > > Oh, It's my and Hongyang's abandoned mailbox. > > Sorry, I only looked at the top of the *.c files and copied the e-mail address > from there. > > > Looks good to me. > > Thanks for the review! > > > By the way, should I add the test/qtest/test-filter* to the MAINTAINER file? > > That might be helpful indeed to get you CC:-ed correctly next time. Already send a patch to update it. Thanks Chen > > Thomas
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index ebeac59b3f..7811177f03 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' + ] dbus_daemon = find_program('dbus-daemon', required: false) if dbus_daemon.found() and config_host.has_key('GDBUS_CODEGEN') @@ -109,31 +110,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'] \ @@ -143,19 +162,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 bc0dee64dd..95367d14d3 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 4269b2cdd9..4f3f59cba8 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 785b6f3226..b09ef7fae9 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();
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> --- tests/qtest/meson.build | 40 +++++++++++++++++++++------- tests/qtest/test-filter-mirror.c | 10 ++----- tests/qtest/test-filter-redirector.c | 20 +++----------- tests/qtest/test-netfilter.c | 8 +----- 4 files changed, 38 insertions(+), 40 deletions(-)