Path: blob/main/usr.bin/awk/tests/bugs-fixed/bug_fix_test.sh
34879 views
#1# Copyright 2014 EMC Corp.2# All rights reserved.3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions are6# met:7#8# * Redistributions of source code must retain the above copyright9# notice, this list of conditions and the following disclaimer.10# * Redistributions in binary form must reproduce the above copyright11# notice, this list of conditions and the following disclaimer in the12# documentation and/or other materials provided with the distribution.13#14# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS15# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT16# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR17# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT18# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,19# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT20# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,21# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY22# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT23# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE24# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.25#2627export LANG=C.UTF-828SRCDIR=$(atf_get_srcdir)2930check()31{32local tc=${1%.awk}; shift33local in_flag out_flag err_flag3435awk=awk3637local out_file="${SRCDIR}/${tc}.ok"38[ -f "${out_file}" ] && out_flag="-o file:${out_file}"39local err_file="${SRCDIR}/${tc}.err"40[ -f "${err_file}" ] && err_flag="-e file:${err_file} -s exit:2"41local in_file="${SRCDIR}/${tc}.in"42[ -f "${in_file}" ] && in_flag="${in_file}"4344(cd ${SRCDIR} ; atf_check ${out_flag} ${err_flag} ${awk} -f "${tc}.awk" ${in_flag})45}4647add_testcase()48{49local tc=${1%.awk}50local tc_escaped word5152case "${tc%.*}" in53*-*)54local IFS="-"55for word in ${tc}; do56tc_escaped="${tc_escaped:+${tc_escaped}_}${word}"57done58;;59*)60tc_escaped=${tc}61;;62esac6364atf_test_case ${tc_escaped}65eval "${tc_escaped}_body() { check ${tc}; }"66atf_add_test_case ${tc_escaped}67}6869atf_init_test_cases()70{71for path in $(find -s "${SRCDIR}" -name '*.awk'); do72add_testcase ${path##*/}73done74}757677