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.
22 cat >> configure.
in << 'END'
26 cat > Makefile.am
<< 'END'
27 # Automake shouldn't match the '/test' in 'sub/test' as '.test' suffix.
28 TESTS
= 1.chk
2.
test 3 4.c.chk
5.suf sub
/test
30 TEST_EXTENSIONS
= .chk .
test
32 CHK_LOG_DRIVER
= .
/chk-wrapper
33 TEST_LOG_DRIVER
= $
(SHELL
) $
(srcdir
)/test-wrapper
34 LOG_DRIVER
= noext-wrapper
36 AM_CHK_LOG_DRIVER_FLAGS
= --am-chk
37 CHK_LOG_DRIVER_FLAGS
= --chk
38 AM_TEST_LOG_DRIVER_FLAGS
= -am-test
39 TEST_LOG_DRIVER_FLAGS
= -test
40 AM_LOG_DRIVER_FLAGS
= am
45 PATH
=`pwd`/bin
$PATH_SEPARATOR$PATH; export PATH
47 cat > wrapper.skel
<<'END'
51 me=`echo "$0" | sed 's,^.*/,,'`
52 if test -z "$me"; then
53 echo "$0: cannot determine program name" >&2
57 am_log_wflags='@am_log_wflags@'
58 log_wflags='@log_wflags@'
64 while test $# -gt 0; do
66 --test-name) test_name=$2; shift;;
67 --log-file) log_file=$2; shift;;
68 --trs-file) trs_file=$2; shift;;
70 --expect-failure) shift;;
71 --color-tests) shift;;
72 --enable-hard-errors) shift;;
73 # Remembered in the same order they're passed in.
74 $am_log_wflags|$log_wflags) extra_opts="$extra_opts $1";;
75 # Explicitly terminate option list.
78 *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
83 echo "$me" "$test_name" $extra_opts > "$log_file"
90 sed -e 's|@am_log_wflags@|--am-chk|' \
91 -e 's|@log_wflags@|--chk|' \
92 < wrapper.skel
> chk-wrapper
94 sed -e 's|@am_log_wflags@|-am-test|' \
95 -e 's|@log_wflags@|-test|' \
96 < wrapper.skel
> test-wrapper
98 sed -e 's|@am_log_wflags@|am|' \
99 -e 's|@log_wflags@|_|' \
100 < wrapper.skel
> bin
/noext-wrapper
102 # `test-wrapper' is deliberately not made executable.
103 chmod a
+x chk-wrapper bin
/noext-wrapper
105 # Not needed anymore.
125 VERBOSE
=yes $MAKE check
131 echo 'chk-wrapper 1.chk --am-chk --chk' > 1.exp
132 echo 'test-wrapper 2.test -am-test -test' > 2.exp
133 echo 'noext-wrapper 3 am _' > 3.exp
134 echo 'chk-wrapper 4.c.chk --am-chk --chk' > 4.c.exp
135 echo 'noext-wrapper 5.suf am _' > 5.suf.exp
136 echo 'noext-wrapper sub/test am _' > sub
/test.exp
139 for x
in 1 2 3 4.c
5.suf sub
/test; do
141 diff $x.exp
$x.log || st
=1