tests: Adjust testsuite return codes to automake guidelines
Phil Sutter
reviewerPATCH 1/2 tests: Adjust testsuite return codes to automake guidelines
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 <[email protected]>
--- iptables-test.py | 2 +- iptables/tests/shell/run-tests.sh | 4 +++- xlate-test.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
iptables-test.py +1 -1
@@ -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",
iptables/tests/shell/run-tests.sh +3 -1
@@ -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
xlate-test.py +1 -1
@@ -110,7 +110,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()
Signature · 1 line
2.34.1
Phil Sutter
reviewerPATCH 2/2 Makefile.am: Integrate testsuites
Support calling 'make check' in topdir to run all three testsuites. While updating .gitignore, also add 'configure~' my autotools create and the tags file.
Signed-off-by Phil Sutter <[email protected]>
--- .gitignore | 12 ++++++++++++ Makefile.am | 2 ++ extensions/GNUmakefile.in | 5 ++++- 3 files changed, 18 insertions(+), 1 deletion(-)
.gitignore +12 -0
@@ -20,6 +20,7 @@ Makefile.in /build-aux/ /config.* /configure +/configure~ /libtool /stamp-h1 /iptables/iptables-apply.8
@@ -29,3 +30,14 @@ Makefile.in # vim/nano swap file *.swp + +/tags + +# make check results +/test-suite.log +/iptables-test.py.log +/iptables-test.py.trs +/xlate-test.py.log +/xlate-test.py.trs +iptables/tests/shell/run-tests.sh.log +iptables/tests/shell/run-tests.sh.trs
Makefile.am +2 -0
@@ -31,3 +31,5 @@ endif config.status: extensions/GNUmakefile.in \ include/xtables-version.h.in + +TESTS = xlate-test.py iptables-test.py iptables/tests/shell/run-tests.sh
extensions/GNUmakefile.in +4 -1
@@ -79,7 +79,7 @@ targets_install := .SECONDARY: -.PHONY: all install uninstall clean distclean FORCE +.PHONY: all install uninstall clean distclean FORCE check all: ${targets}
@@ -307,3 +307,6 @@ matches.man: .initext.dd .initextb.dd .initexta.dd .initext4.dd .initext6.dd $(w targets.man: .initext.dd .initextb.dd .initexta.dd .initext4.dd .initext6.dd $(wildcard ${srcdir}/lib*.man) $(call man_run,$(call ex_targets,${pfx_build_mod} ${pfb_build_mod} ${pfa_build_mod} ${pf4_build_mod} ${pf6_build_mod} ${pfx_symlinks})) + +# empty check target to satisfy 'make check' in topdir +check:
Signature · 1 line
2.34.1