1*31615c96Sdhollandtest_case() { 2*31615c96Sdholland local name="$1" 3*31615c96Sdholland local source="$2" 4*31615c96Sdholland local tradcpp="$3" 5*31615c96Sdholland local descr="Test tradcpp behavior" 6*31615c96Sdholland atf_test_case ${name} 7*31615c96Sdholland if [ -e "$(atf_get_srcdir)/${name}.txt" ]; then 8*31615c96Sdholland descr=$(cat "$(atf_get_srcdir)/${name}.txt") 9*31615c96Sdholland fi 10*31615c96Sdholland eval "${name}_head() { \ 11*31615c96Sdholland atf_set descr \"${descr}\"; \ 12*31615c96Sdholland atf_set require.progs \"/usr/bin/tradcpp\"; \ 13*31615c96Sdholland }" 14*31615c96Sdholland local stdout="file:$(atf_get_srcdir)/${name}.good" 15*31615c96Sdholland local options="" 16*31615c96Sdholland local options_file="$(atf_get_srcdir)/${name}.cmdline" 17*31615c96Sdholland if [ -e ${options_file} ]; then 18*31615c96Sdholland options=$(cat ${options_file}) 19*31615c96Sdholland fi 20*31615c96Sdholland eval "${name}_body() { \ 21*31615c96Sdholland atf_check -s eq:0 -o ${stdout} -x '${tradcpp} ${options} ${source} 2>&1 || echo FAILED'; \ 22*31615c96Sdholland }" 23*31615c96Sdholland} 24*31615c96Sdholland 25*31615c96Sdhollandatf_init_test_cases() { 26*31615c96Sdholland local tradcpp=$(make -V .OBJDIR -C $(atf_get_srcdir)/..)/tradcpp 27*31615c96Sdholland if [ ! -x ${tradcpp} ]; then 28*31615c96Sdholland tradcpp=/usr/bin/tradcpp 29*31615c96Sdholland fi 30*31615c96Sdholland cd $(atf_get_srcdir) 31*31615c96Sdholland for testfile in t*.c; do 32*31615c96Sdholland local name=${testfile%%.c} 33*31615c96Sdholland test_case ${name} ${testfile} ${tradcpp} 34*31615c96Sdholland atf_add_test_case ${name} 35*31615c96Sdholland done 36*31615c96Sdholland} 37