]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: shell: Support running for legacy/nft only
authorPhil Sutter <phil@nwl.cc>
Wed, 25 Sep 2019 10:54:55 +0000 (12:54 +0200)
committerPhil Sutter <phil@nwl.cc>
Mon, 30 Sep 2019 06:11:13 +0000 (08:11 +0200)
After some changes, one might want to test a single variant only. Allow
this by supporting -n/--nft and -l/--legacy parameters, each disabling
the other variant.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Florian Westphal <fw@strlen.de>
iptables/tests/shell/run-tests.sh

index 7bef09f74643d8275a92e947a9b08380e063765c..d71c13729b3ee5f90964cd3870c06011a0287022 100755 (executable)
@@ -38,6 +38,14 @@ while [ -n "$1" ]; do
                HOST=y
                shift
                ;;
+       -l|--legacy)
+               LEGACY_ONLY=y
+               shift
+               ;;
+       -n|--nft)
+               NFT_ONLY=y
+               shift
+               ;;
        *${RETURNCODE_SEPARATOR}+([0-9]))
                SINGLE+=" $1"
                VERBOSE=y
@@ -98,19 +106,23 @@ do_test() {
 }
 
 echo ""
-for testfile in $(find_tests);do
-       do_test "$testfile" "$XTABLES_LEGACY_MULTI"
-done
-msg_info "legacy results: [OK] $ok [FAILED] $failed [TOTAL] $((ok+failed))"
+if [ "$NFT_ONLY" != "y" ]; then
+       for testfile in $(find_tests);do
+               do_test "$testfile" "$XTABLES_LEGACY_MULTI"
+       done
+       msg_info "legacy results: [OK] $ok [FAILED] $failed [TOTAL] $((ok+failed))"
 
+fi
 legacy_ok=$ok
 legacy_fail=$failed
 ok=0
 failed=0
-for testfile in $(find_tests);do
-       do_test "$testfile" "$XTABLES_NFT_MULTI"
-done
-msg_info "nft results: [OK] $ok [FAILED] $failed [TOTAL] $((ok+failed))"
+if [ "$LEGACY_ONLY" != "y" ]; then
+       for testfile in $(find_tests);do
+               do_test "$testfile" "$XTABLES_NFT_MULTI"
+       done
+       msg_info "nft results: [OK] $ok [FAILED] $failed [TOTAL] $((ok+failed))"
+fi
 
 ok=$((legacy_ok+ok))
 failed=$((legacy_fail+failed))