]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: Adjust testsuite return codes to automake guidelines
authorPhil Sutter <phil@nwl.cc>
Sat, 15 Oct 2022 09:43:01 +0000 (11:43 +0200)
committerPhil Sutter <phil@nwl.cc>
Wed, 14 Dec 2022 14:47:18 +0000 (15:47 +0100)
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
iptables/tests/shell/run-tests.sh
xlate-test.py

index dc031c2b60450c451aa293007dd8036382804a3a..de1e1e95fda55c96f1e3e5562a60ba94abdc62d8 100755 (executable)
@@ -579,7 +579,7 @@ def main():
 
     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",
index 7a80af34322855aa62f20d2368d4ec44c7de6915..1125690583b466612546facaea3f96386b294030 100755 (executable)
@@ -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
index 4f037ef6ed96de138d231325e7e9cad840c4093e..4cb1401b716775f0916c5ea2f12c9994a2cbb96a 100755 (executable)
@@ -250,7 +250,7 @@ def main():
                 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()