tests: shell: iptables/0010-wait_0 is unreliable
Phil Sutter
reviewerPATCH 1/5 tests: shell: iptables/0010-wait_0 is unreliable
Sometimes the test would fail, especially after removing /run/xtables.lock file. Looks like the supposedly blocking iptables-restore coproc sometimes takes a moment to set things up.
--- iptables/tests/shell/testcases/iptables/0010-wait_0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/tests/shell/testcases/iptables/0010-wait_0 +1 -1
@@ -11,7 +11,7 @@ esac coproc RESTORE { $XT_MULTI iptables-restore; } echo "*filter" >&${RESTORE[1]} - +sleep 0.5 $XT_MULTI iptables -A FORWARD -j ACCEPT & ipt_pid=$!
Signature · 1 line
2.47.0
Phil Sutter
reviewerPATCH 2/5 tests: shell: Print escape sequences with terminals only
If stdout is not a terminal, don't print the '[EXECUTING]' status line which has to be cleared again.
--- iptables/tests/shell/run-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
iptables/tests/shell/run-tests.sh +2 -2
@@ -165,7 +165,7 @@ do_test() { rc_spec=`echo $(basename ${testfile}) | cut -d _ -f2-` - msg_info "[EXECUTING] $testfile" + [ -t 1 ] && msg_info "[EXECUTING] $testfile" if [ "$VERBOSE" = "y" ]; then XT_MULTI=$xtables_multi unshare -n ${testfile}
@@ -173,7 +173,7 @@ do_test() { else XT_MULTI=$xtables_multi unshare -n ${testfile} > /dev/null 2>&1 rc_got=$? - echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line + [ -t 1 ] && echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line fi if [ "$rc_got" == "$rc_spec" ] ; then
Signature · 1 line
2.47.0
Phil Sutter
reviewerPATCH 3/5 tests: iptables-test: Fix for 'make distcheck'
In reply to Phil SutterThis was a tricky one: Since called from VPATH topdir, extensions/ do not contain test files at all. The script consequently passed since 0 tests failed (of 0 in total).
Fix this by introducing TESTS_PATH which is extensions/ below the directory of the running iptables-test.py. Keep EXTENSIONS_PATH as-is: The built extensions are indeed there and XTABLES_LIBDIR must point to them.
--- iptables-test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
iptables-test.py +4 -3
@@ -30,6 +30,7 @@ EBTABLES_SAVE = "ebtables-save" #IP6TABLES_SAVE = ['xtables-save','-6'] EXTENSIONS_PATH = "extensions" +TESTS_PATH = os.path.join(os.path.dirname(sys.argv[0]), "extensions") LOGFILE="/tmp/iptables-test.log" log_file = None
@@ -558,7 +559,7 @@ STDERR_IS_TTY = sys.stderr.isatty() ''' Show the list of missing test files ''' - file_list = os.listdir(EXTENSIONS_PATH) + file_list = os.listdir(TESTS_PATH) testfiles = [i for i in file_list if i.endswith('.t')] libfiles = [i for i in file_list if i.startswith('lib') and i.endswith('.c')]
@@ -669,8 +670,8 @@ STDERR_IS_TTY = sys.stderr.isatty() if args.filename: file_list = args.filename else: - file_list = [os.path.join(EXTENSIONS_PATH, i) - for i in os.listdir(EXTENSIONS_PATH) + file_list = [os.path.join(TESTS_PATH, i) + for i in os.listdir(TESTS_PATH) if i.endswith('.t')] file_list.sort()
Signature · 1 line
2.47.0
Phil Sutter
reviewerPATCH 4/5 tests: xlate-test: Fix for 'make distcheck'
In reply to Phil SutterSimilar problem as with the other suites: The build directory does not contain test cases, only build results.
--- xlate-test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
xlate-test.py +4 -2
@@ -188,8 +188,10 @@ xtables_nft_multi = 'xtables-nft-multi' def load_test_files(): test_files = total_tests = total_passed = total_error = total_failed = 0 - tests = sorted(os.listdir("extensions")) - for test in ['extensions/' + f for f in tests if f.endswith(".txlate")]: + tests_path = os.path.join(os.path.dirname(sys.argv[0]), "extensions") + tests = sorted(os.listdir(tests_path)) + for test in [os.path.join(tests_path, f) + for f in tests if f.endswith(".txlate")]: with open(test, "r") as payload: tests, passed, failed, errors = run_test(test, payload) test_files += 1
Signature · 1 line
2.47.0
Phil Sutter
reviewerPATCH 5/5 Makefile.am: Revert to old serial test harness
In reply to Phil SutterRunning the different testsuites in parallel is dangerous since despite running in different netns, legacy iptables still synchronizes via the common XTABLES_LOCKFILE.
--- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.am +1 -1
@@ -1,7 +1,7 @@ # -*- Makefile -*- ACLOCAL_AMFLAGS = -I m4 -AUTOMAKE_OPTIONS = foreign subdir-objects dist-xz no-dist-gzip +AUTOMAKE_OPTIONS = foreign subdir-objects dist-xz no-dist-gzip serial-tests SUBDIRS = libiptc libxtables if ENABLE_DEVEL
Signature · 1 line
2.47.0
Phil Sutter
reviewerQuoted 6 lines · Phil Sutter
Sometimes the test would fail, especially after removing
/run/xtables.lockfile. Looks like the supposedly blocking iptables-restore coproc sometimes takes a moment to set things up.Fixes 63ab5b8906f69 ("iptables-legacy: Fix for mandatory lock waiting")Signed-off-by Phil Sutter <[email protected]>
Series applied.