public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH 07/10] test: Rename slightly misleading "valgrind" tests
Date: Thu, 18 Aug 2022 16:13:55 +1000	[thread overview]
Message-ID: <20220818061358.1775944-8-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220818061358.1775944-1-david@gibson.dropbear.id.au>

[-- Attachment #1: Type: text/plain, Size: 4101 bytes --]

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 <david(a)gibson.dropbear.id.au>
---
 test/lib/setup                          | 2 --
 test/run                                | 5 +++--
 test/{valgrind => shutdown}/passt       | 9 +++++----
 test/{valgrind => shutdown}/passt_in_ns | 9 +++++----
 4 files changed, 13 insertions(+), 12 deletions(-)
 rename test/{valgrind => shutdown}/passt (64%)
 rename test/{valgrind => shutdown}/passt_in_ns (62%)

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/valgrind/passt b/test/shutdown/passt
similarity index 64%
rename from test/valgrind/passt
rename to test/shutdown/passt
index f8bcf00..00ced61 100644
--- a/test/valgrind/passt
+++ b/test/shutdown/passt
@@ -6,16 +6,17 @@
 # PASTA - Pack A Subtle Tap Abstraction
 #  for network namespace/tap device mode
 #
-# test/valgrind/passt - Terminate passt and check valgrind exit code
+# 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 <sbrivio(a)redhat.com>
 
-test	valgrind: exit code
+test	shutdown: exit code
 
 hout	PASST_PID cat passt.pid
 host	kill __PASST_PID__
 sleep	1
 
-pout	VALGRIND_EXIT echo $?
-check	[ "__VALGRIND_EXIT__" = "0" ]
+pout	EXIT echo $?
+check	[ "__EXIT__" = "0" ]
diff --git a/test/valgrind/passt_in_ns b/test/shutdown/passt_in_ns
similarity index 62%
rename from test/valgrind/passt_in_ns
rename to test/shutdown/passt_in_ns
index d28e251..a427bf4 100644
--- a/test/valgrind/passt_in_ns
+++ b/test/shutdown/passt_in_ns
@@ -6,16 +6,17 @@
 # PASTA - Pack A Subtle Tap Abstraction
 #  for network namespace/tap device mode
 #
-# test/valgrind/passt_in_ns - Terminate passt and check valgrind exit code
+# 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 <sbrivio(a)redhat.com>
 
-test	valgrind: exit code
+test	shutdown: exit code
 
 nsout	PASST_PID cat passt.pid
 ns	kill __PASST_PID__
 sleep	1
 
-pout	VALGRIND_EXIT echo $?
-check	[ "__VALGRIND_EXIT__" = "0" ]
+pout	EXIT echo $?
+check	[ "__EXIT__" = "0" ]
-- 
@@ -6,16 +6,17 @@
 # PASTA - Pack A Subtle Tap Abstraction
 #  for network namespace/tap device mode
 #
-# test/valgrind/passt_in_ns - Terminate passt and check valgrind exit code
+# 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 <sbrivio(a)redhat.com>
 
-test	valgrind: exit code
+test	shutdown: exit code
 
 nsout	PASST_PID cat passt.pid
 ns	kill __PASST_PID__
 sleep	1
 
-pout	VALGRIND_EXIT echo $?
-check	[ "__VALGRIND_EXIT__" = "0" ]
+pout	EXIT echo $?
+check	[ "__EXIT__" = "0" ]
-- 
2.37.2


  parent reply	other threads:[~2022-08-18  6:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18  6:13 [PATCH 00/10] passt test fixes, batch 6 David Gibson
2022-08-18  6:13 ` [PATCH 01/10] test: Convert distro tests to use socat instead of nc/ncat David Gibson
2022-08-18  6:13 ` [PATCH 02/10] test: Split cppcheck and clang-tidy tests into different files David Gibson
2022-08-18  6:13 ` [PATCH 03/10] test: Remove unused *_XTERM variables David Gibson
2022-08-18  6:13 ` [PATCH 04/10] test: Ignore video processing temporary files David Gibson
2022-08-18  6:13 ` [PATCH 05/10] test: Split setup/teardown functions for build and distro tests David Gibson
2022-08-18  6:13 ` [PATCH 06/10] test: Only select a single interface or gateway in tests David Gibson
2022-08-18  6:13 ` David Gibson [this message]
2022-08-18  6:13 ` [PATCH 08/10] test: Use shutdown test for pasta David Gibson
2022-08-18  6:13 ` [PATCH 09/10] test: Log debugging output from test script David Gibson
2022-08-18  6:13 ` [PATCH 10/10] test: Kill qemu by pidfile rather than ^C David Gibson
2022-08-21 20:23 ` [PATCH 00/10] passt test fixes, batch 6 Stefano Brivio

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=20220818061358.1775944-8-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).