From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Yang Hongyang <yanghy@cn.fujitsu.com>
Subject: [PATCH for-7.0] tests/qtest: Make the netfilter test independent from a specific NIC
Date: Tue, 7 Dec 2021 10:05:48 +0100 [thread overview]
Message-ID: <20211207090548.105307-1-thuth@redhat.com> (raw)
The netfilter test needs a NIC, no matter which one, so it uses
e1000 by default (or virtio-net-ccw on s390x). However, this NIC
might not be always compiled into the QEMU target binary, so assuming
that this NIC is always available is a bad idea. Since the exact type
of NIC does not really matter for this test, 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 test on other targets that have a default
machine which features an on-board/default NIC, too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/meson.build | 23 +++++++++++++++++------
tests/qtest/test-netfilter.c | 8 +-------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 5260b33dc0..cd88cf4bf9 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -104,27 +104,36 @@ endif
qtests_x86_64 = qtests_i386
-qtests_alpha = [ 'boot-serial-test' ] + \
+qtests_alpha = [ 'boot-serial-test' ] + \
+ (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' ] + \
+ (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' ] + \
+ (slirp.found() ? [ 'test-netfilter' ] : [])
+
+qtests_microblaze = [ 'boot-serial-test' ] + \
+ (slirp.found() ? [ 'test-netfilter' ] : [])
+
qtests_microblazeel = qtests_microblaze
qtests_mips = \
+ (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 = \
+ (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 = \
+ (slirp.found() ? [ 'test-netfilter' ] : []) + \
(config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \
(config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
@@ -147,10 +156,12 @@ qtests_ppc64 = \
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'] + \
+ (slirp.found() ? [ 'test-netfilter' ] : [])
qtests_sparc64 = \
- (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \
+ (slirp.found() ? [ 'test-netfilter' ] : []) + \
+ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \
['prom-env-test', 'boot-serial-test']
qtests_npcm7xx = \
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
reply other threads:[~2021-12-07 9:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211207090548.105307-1-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yanghy@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).