comparison tests/tradcpp.sh @ 50:ce9347338583

ATF glue
author Joerg Sonnenberger <joerg@bec.de>
date Sun, 31 Mar 2013 05:39:50 +0200
parents
children bec1eb5ac326
comparison
equal deleted inserted replaced
48:0af03c5571e0 50:ce9347338583
1 test_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} "${tradcpp} ${options} ${source} 2\>\&1"; \
22 }"
23 }
24
25 atf_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 for testfile in $(atf_get_srcdir)/t*.c; do
31 local name=$(basename ${testfile%%.c})
32 test_case ${name} ${testfile} ${tradcpp}
33 atf_add_test_case ${name}
34 done
35 }