1# $NetBSD: t_filter_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 33dotest() 34{ 35 h_copydata $1 36 37 { while read rule; do 38 atf_check -x "echo \"$rule\" | ipftest -F \ 39$2 -Rbr - -i in $4 $5 >>out" 40 echo "--------" >>out 41 done; } <reg 42 43 diff -u exp out || atf_fail "results differ" 44} 45 46mtest() 47{ 48 h_copydata $1 49 50 atf_check -o save:out ipftest -F $2 -Rbr reg -i in 51 echo "--------" >>out 52 53 diff -u exp out || atf_fail "results differ" 54} 55 56dotest6() 57{ 58 h_copydata $(echo ${1} | tr _ .) 59 60 ipftest -6 -r /dev/null -i /dev/null >/dev/null 2>&1 \ 61 || atf_skip "skipping IPv6 tests" 62 63 { while read rule; do 64 atf_check -o save:save -x "echo \"$rule\" | \ 65ipftest -F $2 -6br - -i in" 66 cat save >>out 67 echo "--------" >>out 68 done; } <reg 69 70 diff -u exp out || atf_fail "results differ" 71} 72 73test_case f1 dotest text text 74test_case f2 dotest text text 75test_case f3 dotest text text 76test_case f4 dotest text text 77test_case f5 dotest text text 78test_case f6 dotest text text 79test_case f7 dotest text text 80test_case f8 dotest text text 81test_case f9 dotest text text 82test_case f10 dotest text text 83test_case f11 dotest text text -D 84test_case f12 dotest hex hex 85test_case f13 dotest hex hex 86test_case f14 dotest text text 87test_case f15 mtest text text 88test_case f16 mtest text text 89test_case f17 mtest hex hex 90test_case f18 mtest text text 91#broken_test_case f19 dotest text text -T fr_statemax=3 92test_case f20 mtest text text 93test_case f24 mtest hex text 94test_case ipv6_1 dotest6 hex hex 95test_case ipv6_2 dotest6 hex hex 96test_case ipv6_3 dotest6 hex hex 97test_case ipv6_5 dotest6 hex hex 98test_case ipv6_6 dotest6 hex text 99 100atf_init_test_cases() 101{ 102 atf_add_test_case f1 103 atf_add_test_case f2 104 atf_add_test_case f3 105 atf_add_test_case f4 106 atf_add_test_case f5 107 atf_add_test_case f6 108 atf_add_test_case f7 109 atf_add_test_case f8 110 atf_add_test_case f9 111 atf_add_test_case f10 112 atf_add_test_case f11 113 atf_add_test_case f12 114 atf_add_test_case f13 115 atf_add_test_case f14 116 atf_add_test_case f15 117 atf_add_test_case f16 118 atf_add_test_case f17 119 atf_add_test_case f18 120 atf_add_test_case f20 121 atf_add_test_case f24 122 atf_add_test_case ipv6_1 123 atf_add_test_case ipv6_2 124 atf_add_test_case ipv6_3 125 atf_add_test_case ipv6_5 126 atf_add_test_case ipv6_6 127 128 #atf_add_test_case f19 129} 130