]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ipfilter/test/nattest
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / ipfilter / test / nattest
1 #!/bin/sh
2 if [ $3 = hex ] ; then
3         format="-xF $2"
4 else
5         format="-F $2"
6 fi
7 if [ "$4" != "" ] ; then
8         case $4 in
9         -*)
10                 format="$4 $format"
11                 ;;
12         *)
13                 format="-T $4 $format"
14                 ;;
15         esac
16 fi
17 if [ -f /usr/ucb/touch ] ; then
18         TOUCH=/usr/ucb/touch
19 else
20         if [ -f /usr/bin/touch ] ; then
21                 TOUCH=/usr/bin/touch
22         else
23                 if [ -f /bin/touch ] ; then
24                         TOUCH=/bin/touch
25                 fi
26         fi
27 fi
28 echo "$1...";
29 /bin/cp /dev/null results/$1
30 ( while read rule; do
31         echo "$rule" | ../ipftest $format -RbN - -i input/$1 >> results/$1;
32         if [ $? -ne 0 ] ; then
33                 exit 1;
34         fi
35         echo "-------------------------------" >> results/$1
36 done ) < regress/$1
37 cmp expected/$1 results/$1
38 status=$?
39 if [ $status = 0 ] ; then
40         $TOUCH $1
41 fi
42 exit $status