diff options
author | Phil Sutter <phil@nwl.cc> | 2019-05-14 18:26:54 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2019-09-23 13:02:43 +0200 |
commit | 77d7191ebeed4a84dbe78ea1f5371a81e8132f19 (patch) | |
tree | be5b1dea85659ce9cfab52c7c291320c8c38bc43 /iptables/tests | |
parent | 55b53089a5d4bad1c182325bb36809d5bd091e42 (diff) |
tests/shell: Make ebtables-basic test more verbose
Print expected entries count if it doesn't match.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/tests')
-rwxr-xr-x | iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0 | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0 b/iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0 index b0db216a..c7f24a38 100755 --- a/iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0 +++ b/iptables/tests/shell/testcases/ebtables/0001-ebtables-basic_0 @@ -1,5 +1,9 @@ #!/bin/sh +get_entries_count() { # (chain) + $XT_MULTI ebtables -L $1 | sed -n 's/.*entries: \([0-9]*\).*/\1/p' +} + set -x case "$XT_MULTI" in */xtables-nft-multi) @@ -28,32 +32,32 @@ case "$XT_MULTI" in exit 1 fi - $XT_MULTI ebtables -L FOO | grep -q 'entries: 0' - if [ $? -ne 0 ]; then - echo "Unexpected entries count in empty unreferenced chain" + entries=$(get_entries_count FOO) + if [ $entries -ne 0 ]; then + echo "Unexpected entries count in empty unreferenced chain (expected 0, have $entries)" $XT_MULTI ebtables -L exit 1 fi $XT_MULTI ebtables -A FORWARD -j FOO - $XT_MULTI ebtables -L FORWARD | grep -q 'entries: 1' - if [ $? -ne 0 ]; then - echo "Unexpected entries count in FORWARD chain" + entries=$(get_entries_count FORWARD) + if [ $entries -ne 1 ]; then + echo "Unexpected entries count in FORWARD chain (expected 1, have $entries)" $XT_MULTI ebtables -L exit 1 fi - $XT_MULTI ebtables -L FOO | grep -q 'entries: 0' - if [ $? -ne 0 ]; then - echo "Unexpected entries count in empty referenced chain" + entries=$(get_entries_count FOO) + if [ $entries -ne 0 ]; then + echo "Unexpected entries count in empty referenced chain (expected 0, have $entries)" $XT_MULTI ebtables -L exit 1 fi $XT_MULTI ebtables -A FOO -j ACCEPT - $XT_MULTI ebtables -L FOO | grep -q 'entries: 1' - if [ $? -ne 0 ]; then - echo "Unexpected entries count in non-empty referenced chain" + entries=$(get_entries_count FOO) + if [ $entries -ne 1 ]; then + echo "Unexpected entries count in non-empty referenced chain (expected 1, have $entries)" $XT_MULTI ebtables -L exit 1 fi |