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/>.
18 # - Automake can correctly handle conditionals contents for the
19 # LOG_DRIVER variables.
23 cp "$am_testaux_srcdir"/trivial-test-driver . \
24 || fatal_
"failed to fetch auxiliary script trivial-test-driver"
25 cp "$am_scriptdir"/tap-driver.pl . \
26 || fatal_
"failed to fetch auxiliary script tap-driver.pl"
28 cat >> configure.ac
<< END
29 AM_CONDITIONAL([COND1], [:])
30 AM_CONDITIONAL([COND2], [false])
31 AM_CONDITIONAL([COND3], [false])
32 AC_SUBST([PERL], ['$PERL'])
33 AC_SUBST([my_LOG_DRIVER], ['\${SHELL} \${top_srcdir}/trivial-test-driver'])
34 AM_SUBST_NOTMAKE([my_LOG_DRIVER])
41 cat > Makefile.am
<< 'END'
42 TESTS
= foo bar.
test baz.sh
43 EXTRA_DIST
= $
(TESTS
) tap-driver.pl trivial-test-driver
44 TEST_EXTENSIONS
= .
test .sh
46 SH_LOG_DRIVER
= $
(tap_rulez
)
48 LOG_DRIVER
+= @my_LOG_DRIVER@
52 tap_rulez
= $
(PERL
) $
(srcdir
)/tap-driver.pl
61 exit 1 # exit status should be ignored by the trivial-test-driver.
64 cat > bar.
test <<'END'
73 echo 'not ok 2 # TODO'
74 echo 'not ok 3 # TODO'
77 chmod a
+x foo bar.
test baz.sh
82 grep DRIVER Makefile.
in ||
exit 99 # For debugging.
84 grep '^my_LOG_DRIVER *=' Makefile.
in \
85 && fatal_
'unexpected $(my_LOG_DRIVER) in Makefile.in'
87 grep '^TEST_LOG_DRIVER =.*\$(SHELL).*/test-driver' Makefile.
in
89 $PERL -MTAP::Parser
-e 1 \
90 || skip_
"cannot import TAP::Parser perl module"
96 count_test_results total
=6 pass
=3 fail
=0 skip
=1 xfail
=2 xpass
=0 error
=0
97 grep '^PASS: foo, testcase 1 *$' stdout
98 grep '^SKIP: foo, testcase 2 *$' stdout
99 grep '^PASS: bar\.test *$' stdout
100 $EGREP 'PASS: baz\.sh 1( |$)' stdout
101 $EGREP 'XFAIL: baz\.sh 2( |$)' stdout
102 $EGREP 'XFAIL: baz\.sh 3( |$)' stdout
105 st
=0; $MAKE check
>stdout || st
=$?
111 test $st -eq 0 ||
exit 1
114 $MAKE distcheck
>stdout ||
{ cat stdout
; exit 1; }