Home | History | Annotate | Line # | Download | only in ipf
t_nat_ipf_exec.sh revision 1.3
      1 # $NetBSD: t_nat_ipf_exec.sh,v 1.3 2010/12/18 13:06:51 pooka Exp $
      2 #
      3 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
      4 # All rights reserved.
      5 #
      6 # Redistribution and use in source and binary forms, with or without
      7 # modification, are permitted provided that the following conditions
      8 # are met:
      9 # 1. Redistributions of source code must retain the above copyright
     10 #    notice, this list of conditions and the following disclaimer.
     11 # 2. Redistributions in binary form must reproduce the above copyright
     12 #    notice, this list of conditions and the following disclaimer in the
     13 #    documentation and/or other materials provided with the distribution.
     14 #
     15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18 # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25 # POSSIBILITY OF SUCH DAMAGE.
     26 #
     27 #
     28 # (C)opyright 1993-1996 by Darren Reed.
     29 #
     30 # See the IPFILTER.LICENCE file for details on licencing.
     31 #
     32 
     33 natipftest()
     34 {
     35 	h_copydata $1
     36 	cp $(atf_get_srcdir)/regress/$1.nat nat
     37 	cp $(atf_get_srcdir)/regress/$1.ipf ipf
     38 
     39 	if [ $4 = hex ] ; then
     40 		format="-xF $3"
     41 	else
     42 		format="-F $3"
     43 	fi
     44 
     45 	case $2 in
     46 	single)
     47 		{ while read rule; do
     48 			atf_check -o save:save -x "echo \"$rule\" | \
     49 ipftest -R $5 $6 $format -b -r ipf -N - -i in"
     50 			cat save >>out
     51 			echo "-------------------------------" >>out
     52 		done; } <nat
     53 		;;
     54 	multi)
     55 		atf_check -o save:out ipftest -R $5 $6 \
     56 			$format -b -r ipf -N nat -i in
     57 		echo "-------------------------------" >>out
     58 		;;
     59 	esac
     60 
     61 	diff -u exp out || atf_fail "results differ"
     62 }
     63 
     64 test_case ni1 natipftest multi hex hex -T fr_update_ipid=1
     65 test_case ni2 natipftest single hex hex -T fr_update_ipid=1
     66 test_case ni3 natipftest single hex hex -T fr_update_ipid=1
     67 test_case ni4 natipftest single hex hex -T fr_update_ipid=1
     68 #broken_test_case ni5 natipftest single hex hex -T fr_update_ipid=1
     69 test_case ni6 natipftest multi hex hex -T fr_update_ipid=1
     70 test_case ni7 natipftest single hex hex -T fr_update_ipid=1
     71 test_case ni8 natipftest single hex hex -T fr_update_ipid=1
     72 test_case ni9 natipftest single hex hex -T fr_update_ipid=1
     73 #broken_test_case ni10 natipftest single hex hex -T fr_update_ipid=1
     74 #broken_test_case ni11 natipftest single hex hex -T fr_update_ipid=1
     75 #broken_test_case ni12 natipftest single hex hex -T fr_update_ipid=1
     76 test_case ni13 natipftest single hex hex -T fr_update_ipid=1
     77 test_case ni14 natipftest single hex hex -T fr_update_ipid=1
     78 test_case ni15 natipftest single hex hex -T fr_update_ipid=1
     79 test_case ni16 natipftest single hex hex -T fr_update_ipid=1
     80 #broken_test_case ni19 natipftest single hex hex -T fr_update_ipid=0
     81 #broken_test_case ni20 natipftest single hex hex -T fr_update_ipid=0
     82 test_case ni21 natipftest multi text text
     83 test_case ni23 natipftest multi text text -D
     84 
     85 atf_init_test_cases()
     86 {
     87 	atf_add_test_case ni1
     88 	atf_add_test_case ni2
     89 	atf_add_test_case ni3
     90 	atf_add_test_case ni4
     91 	atf_add_test_case ni6
     92 	atf_add_test_case ni7
     93 	atf_add_test_case ni8
     94 	atf_add_test_case ni9
     95 	atf_add_test_case ni13
     96 	atf_add_test_case ni14
     97 	atf_add_test_case ni15
     98 	atf_add_test_case ni16
     99 	atf_add_test_case ni21
    100 	atf_add_test_case ni23
    101 
    102 	#atf_add_test_case ni5
    103 	#atf_add_test_case ni10
    104 	#atf_add_test_case ni11
    105 	#atf_add_test_case ni12
    106 	#atf_add_test_case ni19
    107 	#atf_add_test_case ni20
    108 }
    109