From 9224af149483e448546db7a63b66992c6003ab3e Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 18 Aug 2022 16:13:55 +1000 Subject: test: Rename slightly misleading "valgrind" tests The "valgrind" test cases are designed to pick up errors reported when passt is running under valgrind. But what it actually does is just kill the passt process, then see if it had a non-zero exit code. That means it will equally well pick up any other problems which caused passt to exit with an error status: either something detected within passt or as a result of passt being killed by an unexpected signal. The fact that the "valgrind" test is actually responsible for shutting down the passt process is non-obvious and can lead to problems when selectively running tests during debugging. Rename the "valgrind" tests to "shutdown" tests and run it regardless of whether we're using valgrind or not. This allows us to remove an ugly speacial case in the passt_in_ns teardown code. Signed-off-by: David Gibson --- test/lib/setup | 2 -- test/run | 5 +++-- test/shutdown/passt | 22 ++++++++++++++++++++++ test/shutdown/passt_in_ns | 22 ++++++++++++++++++++++ test/valgrind/passt | 21 --------------------- test/valgrind/passt_in_ns | 21 --------------------- 6 files changed, 47 insertions(+), 46 deletions(-) create mode 100644 test/shutdown/passt create mode 100644 test/shutdown/passt_in_ns delete mode 100644 test/valgrind/passt delete mode 100644 test/valgrind/passt_in_ns diff --git a/test/lib/setup b/test/lib/setup index d858c71..19ddd37 100755 --- a/test/lib/setup +++ b/test/lib/setup @@ -317,8 +317,6 @@ teardown_passt_in_ns() { pane_wait GUEST tmux send-keys -t ${PANE_GUEST} "C-d" - [ ${VALGRIND} -eq 0 ] && tmux send-keys -t ${PANE_PASST} "C-c" - [ ${VALGRIND} -eq 0 ] && pane_status GUEST tmux send-keys -t ${PANE_PASST} "C-d" pane_wait GUEST diff --git a/test/run b/test/run index efec955..f9792bd 100755 --- a/test/run +++ b/test/run @@ -84,7 +84,7 @@ run() { test dhcp/passt test tcp/passt test udp/passt - test valgrind/passt + test shutdown/passt teardown passt VALGRIND=1 @@ -94,7 +94,7 @@ run() { test icmp/passt_in_ns test tcp/passt_in_ns test udp/passt_in_ns - test valgrind/passt_in_ns + test shutdown/passt_in_ns teardown passt_in_ns VALGRIND=0 @@ -105,6 +105,7 @@ run() { test perf/passt_udp test perf/pasta_tcp test perf/pasta_udp + test shutdown/passt_in_ns teardown passt_in_ns setup two_guests diff --git a/test/shutdown/passt b/test/shutdown/passt new file mode 100644 index 0000000..00ced61 --- /dev/null +++ b/test/shutdown/passt @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# PASST - Plug A Simple Socket Transport +# for qemu/UNIX domain socket mode +# +# PASTA - Pack A Subtle Tap Abstraction +# for network namespace/tap device mode +# +# test/shutdown/passt - Shut down passt and check exit code (will detect +# valgrind errors amongst others) +# +# Copyright (c) 2022 Red Hat GmbH +# Author: Stefano Brivio + +test shutdown: exit code + +hout PASST_PID cat passt.pid +host kill __PASST_PID__ +sleep 1 + +pout EXIT echo $? +check [ "__EXIT__" = "0" ] diff --git a/test/shutdown/passt_in_ns b/test/shutdown/passt_in_ns new file mode 100644 index 0000000..a427bf4 --- /dev/null +++ b/test/shutdown/passt_in_ns @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# PASST - Plug A Simple Socket Transport +# for qemu/UNIX domain socket mode +# +# PASTA - Pack A Subtle Tap Abstraction +# for network namespace/tap device mode +# +# test/shutdown/passt_in_ns - Shut down passt and check exit code (will detect +# valgrind errors amongst others) +# +# Copyright (c) 2022 Red Hat GmbH +# Author: Stefano Brivio + +test shutdown: exit code + +nsout PASST_PID cat passt.pid +ns kill __PASST_PID__ +sleep 1 + +pout EXIT echo $? +check [ "__EXIT__" = "0" ] diff --git a/test/valgrind/passt b/test/valgrind/passt deleted file mode 100644 index f8bcf00..0000000 --- a/test/valgrind/passt +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -# -# PASST - Plug A Simple Socket Transport -# for qemu/UNIX domain socket mode -# -# PASTA - Pack A Subtle Tap Abstraction -# for network namespace/tap device mode -# -# test/valgrind/passt - Terminate passt and check valgrind exit code -# -# Copyright (c) 2022 Red Hat GmbH -# Author: Stefano Brivio - -test valgrind: exit code - -hout PASST_PID cat passt.pid -host kill __PASST_PID__ -sleep 1 - -pout VALGRIND_EXIT echo $? -check [ "__VALGRIND_EXIT__" = "0" ] diff --git a/test/valgrind/passt_in_ns b/test/valgrind/passt_in_ns deleted file mode 100644 index d28e251..0000000 --- a/test/valgrind/passt_in_ns +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -# -# PASST - Plug A Simple Socket Transport -# for qemu/UNIX domain socket mode -# -# PASTA - Pack A Subtle Tap Abstraction -# for network namespace/tap device mode -# -# test/valgrind/passt_in_ns - Terminate passt and check valgrind exit code -# -# Copyright (c) 2022 Red Hat GmbH -# Author: Stefano Brivio - -test valgrind: exit code - -nsout PASST_PID cat passt.pid -ns kill __PASST_PID__ -sleep 1 - -pout VALGRIND_EXIT echo $? -check [ "__VALGRIND_EXIT__" = "0" ] -- cgit v1.2.3