]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: check iptables retval, not echo
authorFlorian Westphal <fw@strlen.de>
Tue, 10 Jul 2018 10:58:24 +0000 (12:58 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 10 Jul 2018 10:59:30 +0000 (12:59 +0200)
Pablo reports that tests that should return nozero now fail.
Reason is that $? is checking return value of "echo" and not the script.

Fixes: 17c66a50608 ("iptables: tests: shell: Add README")
Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/tests/shell/run-tests.sh

index a39aecb68b271e37918857570fdddf2a52257c04..b6eb01c6e0102d97c8c9570fdf8d0e4d063182bb 100755 (executable)
@@ -65,13 +65,13 @@ do_test() {
 
        if [ "$VERBOSE" = "y" ]; then
                XT_MULTI=$xtables_multi unshare -n ${testfile}
+               rc_got=$?
        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
        fi
 
-       rc_got=$?
-
        if [ "$rc_got" == "$rc_spec" ] ; then
                msg_info "[OK]          $testfile"
                ((ok++))