2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Custom test drivers: per-extension test drivers.
21 cat >> configure.ac << 'END'
25 cat > Makefile.am << 'END'
26 # Automake shouldn't match the '/test' in 'sub/test' as '.test' suffix.
27 TESTS = 1.chk 2.test 3 4.c.chk 5.suf sub/test
29 TEST_EXTENSIONS = .chk .test
31 CHK_LOG_DRIVER = ./chk-wrapper
32 TEST_LOG_DRIVER = $(SHELL) $(srcdir)/test-wrapper
33 LOG_DRIVER = noext-wrapper
35 AM_CHK_LOG_DRIVER_FLAGS = --am-chk
36 CHK_LOG_DRIVER_FLAGS = --chk
37 AM_TEST_LOG_DRIVER_FLAGS = -am-test
38 TEST_LOG_DRIVER_FLAGS = -test
39 AM_LOG_DRIVER_FLAGS = am
44 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
46 cat > wrapper.skel <<'END'
50 me=`echo "$0" | sed 's,^.*/,,'`
51 if test -z "$me"; then
52 echo "$0: cannot determine program name" >&2
56 am_log_wflags='@am_log_wflags@'
57 log_wflags='@log_wflags@'
63 while test $# -gt 0; do
65 --test-name) test_name=$2; shift;;
66 --log-file) log_file=$2; shift;;
67 --trs-file) trs_file=$2; shift;;
69 --expect-failure) shift;;
70 --color-tests) shift;;
71 --enable-hard-errors) shift;;
72 # Remembered in the same order they're passed in.
73 $am_log_wflags|$log_wflags) extra_opts="$extra_opts $1";;
74 # Explicitly terminate option list.
77 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
82 echo "$me" "$test_name" $extra_opts > "$log_file"
89 sed -e 's|@am_log_wflags@|--am-chk|' \
90 -e 's|@log_wflags@|--chk|' \
91 < wrapper.skel > chk-wrapper
93 sed -e 's|@am_log_wflags@|-am-test|' \
94 -e 's|@log_wflags@|-test|' \
95 < wrapper.skel > test-wrapper
97 sed -e 's|@am_log_wflags@|am|' \
98 -e 's|@log_wflags@|_|' \
99 < wrapper.skel > bin/noext-wrapper
101 # 'test-wrapper' is deliberately not made executable.
102 chmod a+x chk-wrapper bin/noext-wrapper
104 # Not needed anymore.
124 VERBOSE=yes $MAKE check
130 echo 'chk-wrapper 1.chk --am-chk --chk' > 1.exp
131 echo 'test-wrapper 2.test -am-test -test' > 2.exp
132 echo 'noext-wrapper 3 am _' > 3.exp
133 echo 'chk-wrapper 4.c.chk --am-chk --chk' > 4.c.exp
134 echo 'noext-wrapper 5.suf am _' > 5.suf.exp
135 echo 'noext-wrapper sub/test am _' > sub/test.exp
138 for x in 1 2 3 4.c 5.suf sub/test; do
140 diff $x.exp $x.log || st=1