Mercurial > ~dholland > hg > tradcpp > index.cgi
annotate tests/tradcpp.sh @ 97:83ad94eec98f
don't rely on netbsd cdefs.h
author | David A. Holland |
---|---|
date | Mon, 10 Jun 2013 23:46:47 -0400 |
parents | 937d310debaa |
children |
rev | line source |
---|---|
50 | 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() { \ | |
53
937d310debaa
Don't leak full path into output. Print FAILED like dhtest does.
Joerg Sonnenberger <joerg@bec.de>
parents:
51
diff
changeset
|
21 atf_check -s eq:0 -o ${stdout} -x '${tradcpp} ${options} ${source} 2>&1 || echo FAILED'; \ |
50 | 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 | |
53
937d310debaa
Don't leak full path into output. Print FAILED like dhtest does.
Joerg Sonnenberger <joerg@bec.de>
parents:
51
diff
changeset
|
30 cd $(atf_get_srcdir) |
937d310debaa
Don't leak full path into output. Print FAILED like dhtest does.
Joerg Sonnenberger <joerg@bec.de>
parents:
51
diff
changeset
|
31 for testfile in t*.c; do |
937d310debaa
Don't leak full path into output. Print FAILED like dhtest does.
Joerg Sonnenberger <joerg@bec.de>
parents:
51
diff
changeset
|
32 local name=${testfile%%.c} |
50 | 33 test_case ${name} ${testfile} ${tradcpp} |
34 atf_add_test_case ${name} | |
35 done | |
36 } |