t_npf.sh revision 1.3
11.3Sozaki# $NetBSD: t_npf.sh,v 1.3 2017/08/03 03:16:27 ozaki-r Exp $ 21.1Smartin# 31.1Smartin# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. 41.1Smartin# All rights reserved. 51.1Smartin# 61.1Smartin# Redistribution and use in source and binary forms, with or without 71.1Smartin# modification, are permitted provided that the following conditions 81.1Smartin# are met: 91.1Smartin# 1. Redistributions of source code must retain the above copyright 101.1Smartin# notice, this list of conditions and the following disclaimer. 111.1Smartin# 2. Redistributions in binary form must reproduce the above copyright 121.1Smartin# notice, this list of conditions and the following disclaimer in the 131.1Smartin# documentation and/or other materials provided with the distribution. 141.1Smartin# 151.1Smartin# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 161.1Smartin# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 171.1Smartin# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 181.1Smartin# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 191.1Smartin# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 201.1Smartin# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 211.1Smartin# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 221.1Smartin# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 231.1Smartin# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 241.1Smartin# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 251.1Smartin# POSSIBILITY OF SUCH DAMAGE. 261.1Smartin# 271.1Smartin 281.1Smartinrun_test() 291.1Smartin{ 301.1Smartin local name="${1}" 311.1Smartin 321.1Smartin atf_check -o ignore -e ignore npfctl debug "$(atf_get_srcdir)/npftest.conf" ./npf.plist 331.1Smartin atf_check -o ignore npftest -c npf.plist -T "${name}" 341.1Smartin} 351.1Smartin 361.1Smartinadd_test() 371.1Smartin{ 381.1Smartin local name="${1}"; shift 391.1Smartin local desc="${*}"; 401.1Smartin 411.1Smartin atf_test_case "npf_${name}" 421.3Sozaki eval "npf_${name}_head() { 431.3Sozaki atf_set descr \"${desc}\" 441.3Sozaki atf_set require.progs npfctl npftest 451.3Sozaki } 461.3Sozaki npf_${name}_body() { 471.3Sozaki run_test ${name} 481.1Smartin }" 491.1Smartin atf_add_test_case "npf_${name}" 501.1Smartin} 511.1Smartin 521.1Smartinatf_init_test_cases() 531.1Smartin{ 541.1Smartin LIST=/tmp/t_npf.$$ 551.1Smartin trap "rm -f $LIST" EXIT 561.1Smartin 571.2Smartin sh -ec 'npftest -L || printf "dummy\tnone\n"' > $LIST 2>/dev/null 581.1Smartin 591.1Smartin while read tag desc 601.1Smartin do 611.1Smartin add_test "${tag}" "${desc}" 621.1Smartin done < $LIST 631.1Smartin} 64