diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2016-01-13 19:29:09 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-03-03 19:55:25 +0100 |
commit | 3fb3bb60337483c6dd578a4ae4ffccf4829b726e (patch) | |
tree | a2453f9f7dedb778bb3f2965f1de89cb858a7e5c /tests/shell/testcases/listing/0003table_0 | |
parent | cae7b659d179ea0bb411cc185bfcba4822b763c9 (diff) |
tests/listing: add some listing tests
Let's test what is shown with the 'list' command, for ruleset, tables and sets.
In order to ease debug in case of failure, if the diff tool is in the system,
then a textual diff is printed.
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/listing/0003table_0')
-rwxr-xr-x | tests/shell/testcases/listing/0003table_0 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/shell/testcases/listing/0003table_0 b/tests/shell/testcases/listing/0003table_0 new file mode 100755 index 00000000..1b288e43 --- /dev/null +++ b/tests/shell/testcases/listing/0003table_0 @@ -0,0 +1,25 @@ +#!/bin/bash + +# list table show what is expected + +EXPECTED="table ip test { +}" + +set -e + +$NFT add table test + +GET="$($NFT list table test)" +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi + +# also this way +GET="$($NFT list table ip test)" +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi |