Debian Codegraph @

tests/shell/testcases/bogons/assert_failures

raw
1 #!/bin/bash
2
3 dir=$(dirname $0)/nft-f/
4 jsondir=$(dirname $0)/nft-j-f/
5
6 tmpfile=$(mktemp)
7
8 cleanup()
9 {
10 rm -f "$tmpfile"
11 }
12
13 trap cleanup EXIT
14
15 die_on_error()
16 {
17 local rv="$1"
18 local fname="$2"
19
20 if [ $rv -ne 1 ]; then
21 echo "Bogus input file $fname did not cause expected error code" 1>&2
22 exit 111
23 fi
24
25 if grep AddressSanitizer "$tmpfile"; then
26 echo "Address sanitizer splat for $fname" 1>&2
27 cat "$tmpfile"
28 exit 111
29 fi
30 }
31
32 for f in $dir/*; do
33 echo "Check $f"
34 $NFT --check -f "$f" 2> "$tmpfile"
35
36 die_on_error $? "$f"
37 done
38
39 if [ "$NFT_TEST_HAVE_json" = "n" ];then
40 # Intentionally do not skip if we lack json input,
41 # we ran all the tests that we could.
42 exit 0
43 fi
44
45 for f in $jsondir/*; do
46 echo "Check json input $f"
47 $NFT --check -j -f "$f" 2> "$tmpfile"
48
49 die_on_error $? "$f"
50 done