public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH 10/12] tests: Simplify explicit checks for command success
Date: Tue, 17 May 2022 14:36:12 +0200	[thread overview]
Message-ID: <20220517123614.1892316-11-sbrivio@redhat.com> (raw)
In-Reply-To: <20220517123614.1892316-1-sbrivio@redhat.com>

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

From: David Gibson <david(a)gibson.dropbear.id.au>

A number of individual test cases use '*out' commands to check for success
of specific commands they've issued.  Now that the test harness is testing
for success of all issued commands as a matter of course, we no longer need
to do this.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/build/static_checkers |  6 ++----
 test/distro/debian         | 33 +++++++++++----------------------
 test/distro/opensuse       | 18 ++++++------------
 test/distro/ubuntu         | 15 +++++----------
 test/icmp/passt_in_ns      |  4 ----
 5 files changed, 24 insertions(+), 52 deletions(-)

diff --git a/test/build/static_checkers b/test/build/static_checkers
index d18dea8..34c8dff 100644
--- a/test/build/static_checkers
+++ b/test/build/static_checkers
@@ -14,9 +14,7 @@
 htools	clang-tidy cppcheck
 
 test	Run clang-tidy
-hout	RET make clang-tidy; echo $?
-check	[ __RET__ -eq 0 ]
+host	make clang-tidy
 
 test	Run cppcheck
-hout	RET make cppcheck; echo $?
-check	[ __RET__ -eq 0 ]
+host	make cppcheck
diff --git a/test/distro/debian b/test/distro/debian
index 344f453..f748dea 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -61,8 +61,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make
 
 # TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs
 # with wrapper provided by glibc 2.19, probably wrong argument order.
@@ -89,8 +88,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 host	sysctl -w kernel.unprivileged_userns_clone=1
 distro_quick_pasta_test
@@ -114,8 +112,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 host	sysctl -w kernel.unprivileged_userns_clone=1
 distro_quick_pasta_test
@@ -146,8 +143,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 host	sysctl -w kernel.unprivileged_userns_clone=1
 distro_quick_pasta_test
@@ -179,8 +175,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 host	sysctl -w kernel.unprivileged_userns_clone=1
 distro_quick_pasta_test
@@ -204,8 +199,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -234,8 +228,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -265,8 +258,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -289,8 +281,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -311,8 +302,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -334,8 +324,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
diff --git a/test/distro/opensuse b/test/distro/opensuse
index a2c0944..39f059a 100644
--- a/test/distro/opensuse
+++ b/test/distro/opensuse
@@ -60,8 +60,7 @@ host	echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
 host	for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -89,8 +88,7 @@ host	echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
 host	for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -117,8 +115,7 @@ host	echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
 host	for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -143,8 +140,7 @@ sleep	10
 host	zypper install -y gcc make netcat-openbsd; echo
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -172,8 +168,7 @@ sleep	10
 host	zypper install -y gcc make netcat-openbsd; echo
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -200,8 +195,7 @@ host	echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i ens2
 host	for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
diff --git a/test/distro/ubuntu b/test/distro/ubuntu
index 781daab..3ce156d 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -62,8 +62,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make
 
 # TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs
 # with wrapper provided by glibc 2.19, probably wrong argument order.
@@ -96,8 +95,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make
 
 # TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs
 # with wrapper provided by glibc 2.19, probably wrong argument order.
@@ -127,8 +125,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make
 
 # TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs
 # with wrapper provided by glibc 2.19, probably wrong argument order.
@@ -160,8 +157,7 @@ host	dhclient
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 distro_quick_pasta_test
 
@@ -195,8 +191,7 @@ host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
 
 host	make clean
-hout	RET CFLAGS="-Werror" make; echo $?
-check	[ __RET__ -eq 0 ]
+host	CFLAGS="-Werror" make
 
 host	export SHELL="/bin/dash"
 host	dash
diff --git a/test/icmp/passt_in_ns b/test/icmp/passt_in_ns
index be5be29..38a9a4f 100644
--- a/test/icmp/passt_in_ns
+++ b/test/icmp/passt_in_ns
@@ -24,14 +24,10 @@ test	ICMP echo: guest to ns
 nsout	IFNAME_NS ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
 ns	ip addr add 192.0.2.1/32 dev __IFNAME_NS__
 guest	ping -c1 -w1 192.0.2.1
-gout	RET echo $?
 ns	ip addr del 192.0.2.1/32 dev __IFNAME_NS__
-check	[ __RET__ -eq 0 ]
 
 test	ICMPv6 echo: guest to ns
 ns	ip addr add 2001:db8::1 dev __IFNAME_NS__ && sleep 2 # DAD
 gout	IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
 guest	ping -c1 -w1 2001:db8::1
-gout	RET echo $?
 ns	ip addr del 2001:db8::1 dev __IFNAME_NS__
-check	[ __RET__ -eq 0 ]
-- 
2.35.1


  parent reply	other threads:[~2022-05-17 12:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 12:36 [PATCH 00/12] Tests fixes and clean-ups Stefano Brivio
2022-05-17 12:36 ` [PATCH 01/12] tests: Update mbuto git URLs Stefano Brivio
2022-05-17 12:36 ` [PATCH 02/12] tests: Remove unused XVFB variable Stefano Brivio
2022-05-17 12:36 ` [PATCH 03/12] tests: Add some debugging output for the test scripts themselves Stefano Brivio
2022-05-17 12:36 ` [PATCH 04/12] tests: Don't use tmux update-environment Stefano Brivio
2022-05-17 12:36 ` [PATCH 05/12] tests: Don't globally set tmux default-shell Stefano Brivio
2022-05-17 12:36 ` [PATCH 06/12] tests: Improve control character filtering in pane_parse Stefano Brivio
2022-05-17 12:36 ` [PATCH 07/12] tests: Don't ignore errors during script Stefano Brivio
2022-05-17 12:36 ` [PATCH 08/12] tests: Add pane_status command to check for success of issued commands Stefano Brivio
2022-05-17 12:36 ` [PATCH 09/12] tests: Simplify *tools commands using pane_status Stefano Brivio
2022-05-17 12:36 ` Stefano Brivio [this message]
2022-05-17 12:36 ` [PATCH 11/12] test/perf/pasta_udp: Drop redundant assignment of ::1 to loopback interface Stefano Brivio
2022-05-17 12:36 ` [PATCH 12/12] test/run: Return 0 from run(), exit value already reflects failures Stefano Brivio
2022-05-18  3:17 ` [PATCH 00/12] Tests fixes and clean-ups David Gibson
2022-05-18  5:40   ` 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=20220517123614.1892316-11-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --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).