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