]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/netbsd-tests/ipf/t_filter_parse.sh
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / netbsd-tests / ipf / t_filter_parse.sh
1 # $NetBSD: t_filter_parse.sh,v 1.11 2014/06/29 09:27:58 darrenr 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 itest()
34 {
35         h_copydata $1
36
37         case $3 in
38         ipf)
39                 atf_check -o file:exp -e ignore ipf -Rnvf reg
40                 ;;
41         ipftest)
42                 atf_check -o file:exp ipftest -D -r reg -i /dev/null
43                 ;;
44         esac
45 }
46
47 itest_i19()
48 {
49         cp "$(atf_get_srcdir)/expected/i19.dist" .
50
51         if [ "`grep LOG_SECURITY /usr/include/sys/syslog.h 2>&1`" = "" ] ; then
52                 if [ "`grep LOG_AUDIT /usr/include/sys/syslog.h 2>&1`" = "" ] ; then
53                                 sed -e 's/security/!!!/g' i19.dist > i19.p1;
54                 else
55                                 sed -e 's/security/audit/g' i19.dist > i19.p1;
56                 fi
57         else
58                 cp i19.dist i19.p1;
59         fi
60         if [ "`grep LOG_AUTHPRIV /usr/include/sys/syslog.h 2>&1`" = "" ] ; then
61                 sed -e 's/authpriv/!!!/g' i19.p1 > i19.p2;
62         else
63                 cp i19.p1 i19.p2;
64         fi
65         if [ "`grep LOG_LOGALERT /usr/include/sys/syslog.h 2>&1`" = "" ] ; then
66                 sed -e 's/logalert/!!!/g' i19.p2 > i19.p1;
67         else
68                 cp i19.p2 i19.p1;
69         fi
70         if [ "`grep LOG_FTP /usr/include/sys/syslog.h 2>&1`" = "" ] ; then
71                 sed -e 's/ftp/!!!/g' i19.p1 > i19.p2;
72         else
73                 cp i19.p1 i19.p2;
74         fi
75         if [ "`egrep 'LOG_CRON.*15' /usr/include/sys/syslog.h 2>&1`" != "" ] ; then
76                 sed -e 's/cron/cron2/g' i19.p2 > i19;
77         else
78                 cp i19.p2 i19;
79         fi
80         /bin/rm i19.p?
81
82         mv i19 exp
83         itest "$@"
84 }
85
86 test_case i1 itest text ipf
87 test_case i2 itest text ipf
88 test_case i3 itest text ipf
89 test_case i4 itest text ipf
90 test_case i5 itest text ipf
91 test_case i6 itest text ipf
92 test_case i7 itest text ipf
93 test_case i8 itest text ipf
94 test_case i9 itest text ipf
95 test_case i10 itest text ipf
96 test_case i11 itest text ipf
97 test_case i12 itest text ipf
98 test_case i13 itest text ipf
99 test_case i14 itest text ipf
100 test_case i15 itest text ipf
101 test_case i16 itest text ipf
102 failing_test_case i17 itest "Known to be broken" text ipftest
103 test_case i18 itest text ipf
104 test_case i19 itest_i19 text ipf
105 test_case i20 itest text ipf
106 test_case i21 itest text ipf
107 test_case i22 itest text ipf
108 test_case i23 itest text ipf
109
110 atf_init_test_cases()
111 {
112         atf_add_test_case i1
113         atf_add_test_case i2
114         atf_add_test_case i3
115         atf_add_test_case i4
116         atf_add_test_case i5
117         atf_add_test_case i6
118         atf_add_test_case i7
119         atf_add_test_case i8
120         atf_add_test_case i9
121         atf_add_test_case i10
122         atf_add_test_case i11
123         atf_add_test_case i12
124         atf_add_test_case i13
125         atf_add_test_case i14
126         atf_add_test_case i15
127         atf_add_test_case i16
128         atf_add_test_case i17
129         atf_add_test_case i18
130         atf_add_test_case i19
131         atf_add_test_case i20
132         atf_add_test_case i21
133         atf_add_test_case i22
134         atf_add_test_case i23
135 }