Skip to content

Commit

Permalink
Use autoconf log compiler for test suite
Browse files Browse the repository at this point in the history
Using the log compiler feature of autoconf will run the test runner for
each test-case instead of treating all test-cases as a single test.
  • Loading branch information
mptre committed Jul 9, 2016
1 parent a6811d3 commit ee64131
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ bin_PROGRAMS=src/pick
dist_src_pick_SOURCES=src/pick.c src/compat.h src/compat.c
dist_man_MANS=man/man1/pick.1

TESTS=tests/test.sh
TESTS=tests/01.t tests/02.t tests/03.t tests/04.t tests/05.t tests/06.t \
tests/07.t tests/08.t tests/09.t tests/10.t tests/11.t tests/12.t \
tests/13.t tests/14.t tests/15.t tests/16.t tests/17.t tests/18.t \
tests/19.t tests/20.t tests/21.t tests/22.t tests/23.t tests/24.t \
tests/25.t tests/26.t
TEST_EXTENSIONS=.t
T_LOG_COMPILER=sh tests/test.sh
check_PROGRAMS=tests/test
tests_test_SOURCES=tests/test.sh tests/test.c
tests_test_SOURCES=tests/test.c
# Required by posix_openpt on Linux.
tests_test_CFLAGS=-D_XOPEN_SOURCE=600

Expand Down
10 changes: 7 additions & 3 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/sh

field() {
awk '
/^output:/ { sub(/\\n/, "\n"); }
Expand All @@ -22,7 +20,14 @@ pick() {
$DIR/test -i "$input" -- $args <"$in"
}

usage() {
echo "usage: sh tests/test.sh file ..." 1>&2
exit 1
}

main() {
[ $# -eq 0 ] && usage

DIR=$(dirname "$0")
PATH="${DIR}/../src:${PATH}"

Expand All @@ -32,7 +37,6 @@ main() {
err=$(mktemp -t pick.XXXXXX)
trap 'rm "$in" "$exp" "$act" "$err"' EXIT

[ $# -eq 0 ] && set $(find "$DIR" -name '*.t')
for a
do
e=$(field exit <"$a" || echo 0)
Expand Down

0 comments on commit ee64131

Please sign in to comment.