summaryrefslogtreecommitdiffstats
path: root/tests/runtest.sh
blob: 028e9684f01bf325e388e7fb7b22defd99a71b3c (plain)
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
#!/bin/sh

tests="init"
tests+=" ipmap macipmap portmap"
tests+=" iphash nethash ipporthash"
tests+=" iptree iptreemap"

for types in $tests; do
    ipset -X test >/dev/null 2>&1
    while read ret cmd; do
	case $ret in
	    \#)
	    	if [ "$cmd" = "eof" ]; then
	    		break
	    	fi
	    	what=$cmd
		continue
		;;
	    *)
		;;
	esac
	echo -ne "$types: $what: "
	eval $cmd >/dev/null 2>&1
	r=$?
	# echo $ret $r
	if [ "$ret" = "$r" ]; then
		echo "OK"
	else
		echo "FAILED"
		echo "Failed test: $cmd"
		exit 1
	fi
	# sleep 1
    done < $types.t
done
for x in $tests; do
	case $x in
	init)
		;;
	*)
		rmmod ip_set_$x >/dev/null 2>&1
		;;
	esac
done
rmmod ip_set >/dev/null 2>&1
echo "All tests are OK"