File: assert_failures

package info (click to toggle)
nftables 1.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,384 kB
  • sloc: ansic: 50,901; sh: 20,277; yacc: 5,861; python: 1,746; lex: 1,367; makefile: 392
file content (50 lines) | stat: -rwxr-xr-x 795 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

dir=$(dirname $0)/nft-f/
jsondir=$(dirname $0)/nft-j-f/

tmpfile=$(mktemp)

cleanup()
{
	rm -f "$tmpfile"
}

trap cleanup EXIT

die_on_error()
{
	local rv="$1"
	local fname="$2"

	if [ $rv -ne 1 ]; then
		echo "Bogus input file $fname did not cause expected error code" 1>&2
		exit 111
	fi

	if grep AddressSanitizer "$tmpfile"; then
		echo "Address sanitizer splat for $fname" 1>&2
		cat "$tmpfile"
		exit 111
	fi
}

for f in $dir/*; do
	echo "Check $f"
	$NFT --check -f "$f" 2> "$tmpfile"

	die_on_error $? "$f"
done

if [ "$NFT_TEST_HAVE_json" = "n" ];then
	# Intentionally do not skip if we lack json input,
	# we ran all the tests that we could.
	exit 0
fi

for f in $jsondir/*; do
	echo "Check json input $f"
	$NFT --check -j -f "$f" 2> "$tmpfile"

	die_on_error $? "$f"
done