annotate tests/tradcpp.sh @ 206:9aa91d3fe3a3 release-0.5.3

release 0.5.3
author David A. Holland
date Mon, 21 Jan 2019 21:21:46 -0500
parents 937d310debaa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
1 test_case() {
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
2 local name="$1"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
3 local source="$2"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
4 local tradcpp="$3"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
5 local descr="Test tradcpp behavior"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
6 atf_test_case ${name}
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
7 if [ -e "$(atf_get_srcdir)/${name}.txt" ]; then
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
8 descr=$(cat "$(atf_get_srcdir)/${name}.txt")
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
9 fi
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
10 eval "${name}_head() { \
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
11 atf_set descr \"${descr}\"; \
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
12 atf_set require.progs \"/usr/bin/tradcpp\"; \
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
13 }"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
14 local stdout="file:$(atf_get_srcdir)/${name}.good"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
15 local options=""
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
16 local options_file="$(atf_get_srcdir)/${name}.cmdline"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
17 if [ -e ${options_file} ]; then
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
18 options=$(cat ${options_file})
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
19 fi
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
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
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
22 }"
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
23 }
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
24
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
25 atf_init_test_cases() {
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
26 local tradcpp=$(make -V .OBJDIR -C $(atf_get_srcdir)/..)/tradcpp
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
27 if [ ! -x ${tradcpp} ]; then
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
28 tradcpp=/usr/bin/tradcpp
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
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
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
33 test_case ${name} ${testfile} ${tradcpp}
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
34 atf_add_test_case ${name}
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
35 done
ce9347338583 ATF glue
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
36 }