From ee641319e1944ca32d9fd1d287cda625f3fd477d Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Wed, 6 Jul 2016 22:25:54 +0200 Subject: [PATCH] Use autoconf log compiler for test suite 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. --- Makefile.am | 10 ++++++++-- tests/test.sh | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index cf62303d..938e33df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/tests/test.sh b/tests/test.sh index 9110e647..b28d9455 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,5 +1,3 @@ -#!/bin/sh - field() { awk ' /^output:/ { sub(/\\n/, "\n"); } @@ -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}" @@ -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)