mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 13:30:52 +00:00
tests: Add network filter tests to the check-qtest-s390x list
With some small modifications, we can also use the the netfilter, the filter-mirror and the filter-redirector tests on s390x. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <1502951113-4246-3-git-send-email-thuth@redhat.com> Reviewed-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
This commit is contained in:
parent
7f57d58d6a
commit
ea5bef49ea
@ -361,6 +361,9 @@ check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
|
||||
|
||||
check-qtest-s390x-y = tests/boot-serial-test$(EXESUF)
|
||||
check-qtest-s390x-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
||||
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-generic-y += tests/qom-test$(EXESUF)
|
||||
check-qtest-generic-y += tests/test-hmp$(EXESUF)
|
||||
|
@ -25,6 +25,11 @@ static void test_mirror(void)
|
||||
char *recv_buf;
|
||||
uint32_t size = sizeof(send_buf);
|
||||
size = htonl(size);
|
||||
const char *devstr = "e1000";
|
||||
|
||||
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);
|
||||
@ -33,10 +38,10 @@ static void test_mirror(void)
|
||||
g_assert_cmpint(ret, !=, -1);
|
||||
|
||||
cmdline = g_strdup_printf("-netdev socket,id=qtest-bn0,fd=%d "
|
||||
"-device e1000,netdev=qtest-bn0,id=qtest-e0 "
|
||||
"-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], sock_path);
|
||||
, send_sock[1], devstr, sock_path);
|
||||
qtest_start(cmdline);
|
||||
g_free(cmdline);
|
||||
|
||||
|
@ -57,6 +57,16 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
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;
|
||||
@ -78,7 +88,7 @@ static void test_redirector_tx(void)
|
||||
g_assert_cmpint(ret, !=, -1);
|
||||
|
||||
cmdline = g_strdup_printf("-netdev socket,id=qtest-bn0,fd=%d "
|
||||
"-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
|
||||
"-device %s,netdev=qtest-bn0,id=qtest-e0 "
|
||||
"-chardev socket,id=redirector0,path=%s,server,nowait "
|
||||
"-chardev socket,id=redirector1,path=%s,server,nowait "
|
||||
"-chardev socket,id=redirector2,path=%s,nowait "
|
||||
@ -87,8 +97,8 @@ 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], sock_path0, sock_path1, sock_path0);
|
||||
"queue=tx,outdev=redirector1 ", backend_sock[1], get_devstr(),
|
||||
sock_path0, sock_path1, sock_path0);
|
||||
qtest_start(cmdline);
|
||||
g_free(cmdline);
|
||||
|
||||
@ -149,7 +159,7 @@ static void test_redirector_rx(void)
|
||||
g_assert_cmpint(ret, !=, -1);
|
||||
|
||||
cmdline = g_strdup_printf("-netdev socket,id=qtest-bn0,fd=%d "
|
||||
"-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
|
||||
"-device %s,netdev=qtest-bn0,id=qtest-e0 "
|
||||
"-chardev socket,id=redirector0,path=%s,server,nowait "
|
||||
"-chardev socket,id=redirector1,path=%s,server,nowait "
|
||||
"-chardev socket,id=redirector2,path=%s,nowait "
|
||||
@ -158,8 +168,8 @@ 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], sock_path0, sock_path1, sock_path0);
|
||||
"queue=rx,indev=redirector1 ", backend_sock[1], get_devstr(),
|
||||
sock_path0, sock_path1, sock_path0);
|
||||
qtest_start(cmdline);
|
||||
g_free(cmdline);
|
||||
|
||||
|
@ -182,6 +182,12 @@ static void remove_netdev_with_multi_netfilter(void)
|
||||
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);
|
||||
@ -191,10 +197,13 @@ int main(int argc, char **argv)
|
||||
qtest_add_func("/netfilter/remove_netdev_multi",
|
||||
remove_netdev_with_multi_netfilter);
|
||||
|
||||
qtest_start("-netdev user,id=qtest-bn0 -device e1000,netdev=qtest-bn0");
|
||||
args = g_strdup_printf("-netdev user,id=qtest-bn0 "
|
||||
"-device %s,netdev=qtest-bn0", devstr);
|
||||
qtest_start(args);
|
||||
ret = g_test_run();
|
||||
|
||||
qtest_end();
|
||||
g_free(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user