diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-02-13 12:13:11 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-02-13 13:04:56 +0100 |
commit | 79cb0868d22525a8812bc8b390f50d29f25ebf27 (patch) | |
tree | c8554773323e3c55e540036cd9e3bf6ef28e7e4a /tests/shell/testcases/include/0018include_error_0 | |
parent | 29bcd213fb3dfeb933575478b1714f122ae48440 (diff) |
tests: shell: validate error reporting with include and glob
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/include/0018include_error_0')
-rwxr-xr-x | tests/shell/testcases/include/0018include_error_0 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/shell/testcases/include/0018include_error_0 b/tests/shell/testcases/include/0018include_error_0 new file mode 100755 index 00000000..ae2dba3c --- /dev/null +++ b/tests/shell/testcases/include/0018include_error_0 @@ -0,0 +1,34 @@ +#!/bin/bash + +tmpfile1=$(mktemp) +if [ ! -w $tmpfile1 ] ; then + echo "Failed to create tmp file" >&2 + exit 1 +fi + +touch $tmpfile1 + +RULESET="include \"$tmpfile1\" +) +" + +tmpfile2=$(mktemp) +if [ ! -w $tmpfile2 ] ; then + echo "Failed to create tmp file" >&2 + exit 1 +fi + +tmpfile3=$(mktemp) +if [ ! -w $tmpfile3 ] ; then + echo "Failed to create tmp file" >&2 + exit 1 +fi + +echo "/dev/stdin:2:1-1: Error: syntax error, unexpected ')' +) +^" > $tmpfile3 + +$NFT -I/tmp/ -f - <<< "$RULESET" 2> $tmpfile2 +$DIFF -u $tmpfile2 $tmpfile3 + +rm $tmpfile1 $tmpfile2 $tmpfile3 |