tests: shell: Merge and extend return codes test
Phil Sutter
reviewerPATCH 1/1 tests: shell: Merge and extend return codes test
Merge scripts for iptables and ip6tables, they were widely identical. Also extend the test by one check (removing a non-existent rule with valid chain and target) and quote the error messages where differences are deliberately ignored.
Signed-off-by Phil Sutter <[email protected]>
--- .../testcases/ip6tables/0004-return-codes_0 | 39 -------- .../testcases/iptables/0004-return-codes_0 | 92 ++++++++++--------- 2 files changed, 50 insertions(+), 81 deletions(-) delete mode 100755 iptables/tests/shell/testcases/ip6tables/0004-return-codes_0
iptables/tests/shell/testcases/ip6tables/0004-return-codes_0 deleted +0 -39
@@ -1,39 +0,0 @@ -#!/bin/sh - -# make sure error return codes are as expected useful cases -# (e.g. commands to check ruleset state) - -global_rc=0 - -cmd() { # (rc, cmd, [args ...]) - rc_exp=$1; shift - - $XT_MULTI "$@" - rc=$? - - [ $rc -eq $rc_exp ] || { - echo "---> expected $rc_exp, got $rc for command '$@'" - global_rc=1 - } -} - -# test chain creation -cmd 0 ip6tables -N foo -cmd 1 ip6tables -N foo -# iptables-nft allows this - bug or feature? -#cmd 2 ip6tables -N "invalid name" - -# test rule adding -cmd 0 ip6tables -A INPUT -j ACCEPT -cmd 1 ip6tables -A noexist -j ACCEPT -cmd 2 ip6tables -I INPUT -j foobar - -# test rule checking -cmd 0 ip6tables -C INPUT -j ACCEPT -cmd 1 ip6tables -C FORWARD -j ACCEPT -cmd 1 ip6tables -C nonexist -j ACCEPT -cmd 2 ip6tables -C INPUT -j foobar -cmd 2 ip6tables -C INPUT -m foobar -j ACCEPT -cmd 3 ip6tables -t foobar -C INPUT -j ACCEPT - -exit $global_rc
iptables/tests/shell/testcases/iptables/0004-return-codes_0 +50 -42
117 lines not on this page · raw message
Signature · 1 line
2.27.0