netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH 10/11] tests: Adjust testsuite return codes to automake guidelines
Date: Wed,  7 Dec 2022 18:44:29 +0100	[thread overview]
Message-ID: <20221207174430.4335-11-phil@nwl.cc> (raw)
In-Reply-To: <20221207174430.4335-1-phil@nwl.cc>

As per the manual[1]:

"When no test protocol is in use, an exit status of 0 from a test script
will denote a success, an exit status of 77 a skipped test, an exit
status of 99 a hard error, and any other exit status will denote a
failure."

[1] https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 iptables-test.py                  | 2 +-
 iptables/tests/shell/run-tests.sh | 4 +++-
 xlate-test.py                     | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/iptables-test.py b/iptables-test.py
index dc031c2b60450..de1e1e95fda55 100755
--- a/iptables-test.py
+++ b/iptables-test.py
@@ -579,7 +579,7 @@ STDERR_IS_TTY = sys.stderr.isatty()
 
     if os.getuid() != 0:
         print("You need to be root to run this, sorry", file=sys.stderr)
-        return
+        return 77
 
     if not args.netns and not args.no_netns and not spawn_netns():
         print("Cannot run in own namespace, connectivity might break",
diff --git a/iptables/tests/shell/run-tests.sh b/iptables/tests/shell/run-tests.sh
index 7a80af3432285..1125690583b46 100755
--- a/iptables/tests/shell/run-tests.sh
+++ b/iptables/tests/shell/run-tests.sh
@@ -21,7 +21,6 @@ EOF
 
 msg_error() {
         echo "E: $1 ..." >&2
-        exit 1
 }
 
 msg_warn() {
@@ -34,10 +33,12 @@ msg_info() {
 
 if [ "$(id -u)" != "0" ] ; then
         msg_error "this requires root!"
+        exit 77
 fi
 
 if [ ! -d "$TESTDIR" ] ; then
         msg_error "missing testdir $TESTDIR"
+        exit 99
 fi
 
 # support matching repeated pattern in SINGLE check below
@@ -76,6 +77,7 @@ while [ -n "$1" ]; do
 		;;
 	*)
 		msg_error "unknown parameter '$1'"
+		exit 99
 		;;
 	esac
 done
diff --git a/xlate-test.py b/xlate-test.py
index 4f037ef6ed96d..4cb1401b71677 100755
--- a/xlate-test.py
+++ b/xlate-test.py
@@ -250,7 +250,7 @@ xtables_nft_multi = 'xtables-nft-multi'
                 tests, passed, failed, errors = run_test(args.test, payload)
         except IOError:
             print(red("Error: ") + "test file does not exist", file=sys.stderr)
-            return -1
+            return 99
     else:
         files, tests, passed, failed, errors = load_test_files()
 
-- 
2.38.0


  parent reply	other threads:[~2022-12-07 17:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 17:44 [iptables PATCH 00/11] Support 'make dist' and 'make check' Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 01/11] Drop INCOMPATIBILITIES file Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 02/11] Drop libiptc/linux_stddef.h Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 03/11] Makefile: Generate ip6tables man pages on the fly Phil Sutter
2022-12-07 18:36   ` Jan Engelhardt
2022-12-07 18:48     ` Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 04/11] extensions: Makefile: Merge initext targets Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 05/11] iptables/Makefile: Reorg variable assignments Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 06/11] iptables/Makefile: Split nft-variant man page list Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 07/11] Makefile: Fix for 'make distcheck' Phil Sutter
2022-12-07 17:44 ` [iptables PATCH 08/11] Makefile: Generate .tar.bz2 archive with 'make dist' Phil Sutter
2022-12-07 18:45   ` Jan Engelhardt
2022-12-07 18:56     ` Phil Sutter
2022-12-07 19:13       ` Jan Engelhardt
2022-12-07 20:55         ` Phil Sutter
2022-12-07 21:35           ` Pablo Neira Ayuso
2022-12-07 17:44 ` [iptables PATCH 09/11] include/Makefile: xtables-version.h is generated Phil Sutter
2022-12-07 17:44 ` Phil Sutter [this message]
2022-12-07 17:44 ` [iptables PATCH 11/11] Makefile.am: Integrate testsuites Phil Sutter

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=20221207174430.4335-11-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    /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).