Skip to contentSkip to conversation

tests: shell: validate error reporting with include and glob

PATCH New Pablo Neira Ayuso 1 participant 1 message Feb 13, 2020 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 tests: shell: validate error reporting with include and glob

---
 tests/shell/testcases/include/0018include_error_0 | 34 ++++++++++++
 tests/shell/testcases/include/0019include_error_0 | 63 +++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100755 tests/shell/testcases/include/0018include_error_0
 create mode 100755 tests/shell/testcases/include/0019include_error_0
tests/shell/testcases/include/0018include_error_0 new file +34 -0
new file mode 100755
index 000000000000..ae2dba3cfbe8
@@ -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
tests/shell/testcases/include/0019include_error_0 new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.11.0