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 # More on TAP support:
18 # - more than one TAP-generating test script in $(TESTS)
20 # - use with parallel make (if supported)
21 # - basic use of diagnostic messages (lines beginning with "#")
22 # - flags for TAP driver defined through AC_SUBST in configure.ac
23 # - messages generated by the testsuite harness reference the
24 # correct test script(s)
25 # - "make distcheck" works
31 cat >> configure.ac
<<END
32 AC_SUBST([AM_TEST_LOG_DRIVER_FLAGS], ['--comments'])
36 cat > Makefile.am
<< 'END'
37 TEST_LOG_DRIVER
= $
(srcdir
)/tap-driver
38 TESTS
= 1.
test 2.
test 3.
test
39 EXTRA_DIST
= $
(TESTS
) tap-driver
46 if test -f not-skip; then
47 echo "not ok 2 zardoz"
49 echo "ok 2 zardoz # SKIP"
57 echo "not ok # TODO not implemented"
64 echo ok - blah blah blah
65 echo '# Some diagnostic'
66 if test -f bail-out; then
67 echo 'Bail out! Kernel Panic'
79 # Try a VPATH and by default serial build first, and then an in-tree
80 # and by default parallel build.
83 if test $try -eq 0; then
89 elif test $try -eq 1; then
90 # In-tree parallel build.
94 # Degree of parallelism already specified by the user: do
99 # Some make implementations (e.g., HP-UX) don't grok '-j',
100 # some require no space between '-j' and the number of jobs
101 # (e.g., older GNU make versions), and some *do* require a
102 # space between '-j' and the number of jobs (e.g., Solaris
103 # dmake). We need a runtime test to see what works.
104 echo 'all:' > Makefile
105 for run_make
in "$MAKE -j3" "$MAKE -j 3" "$MAKE"; do
112 fatal_
"internal error, invalid value of '$try' for \$try"
116 ls -l # For debugging.
120 # Use append mode here to avoid dropping output. See automake bug#11413.
122 $run_make check
>>stdout ||
{ cat stdout
; exit 1; }
124 count_test_results total
=6 pass
=4 fail
=0 xpass
=0 xfail
=1 skip
=1 error
=0
125 grep '^PASS: 1\.test 1 - mu$' stdout
126 grep '^SKIP: 1\.test 2 zardoz # SKIP$' stdout
127 test $
(grep -c '1\.test' stdout
) -eq 2
128 grep '^PASS: 2\.test 1$' stdout
129 grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
130 grep '^PASS: 2\.test 3$' stdout
131 test $
(grep -c '2\.test' stdout
) -eq 3
132 grep '^PASS: 3\.test 1 - blah blah blah$' stdout
133 grep '^# 3\.test: Some diagnostic$' stdout
134 test $
(grep -c '3\.test' stdout
) -eq 2
140 # Use append mode here to avoid dropping output. See automake bug#11413.
142 $run_make check
>>stdout
&& { cat stdout
; exit 1; }
144 count_test_results total
=7 pass
=4 fail
=1 xpass
=0 xfail
=1 skip
=0 error
=1
145 grep '^PASS: 1\.test 1 - mu$' stdout
146 grep '^FAIL: 1\.test 2 zardoz$' stdout
147 test $
(grep -c '1\.test' stdout
) -eq 2
148 grep '^PASS: 2\.test 1$' stdout
149 grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
150 grep '^PASS: 2\.test 3$' stdout
151 test $
(grep -c '2\.test' stdout
) -eq 3
152 grep '^PASS: 3\.test 1 - blah blah blah$' stdout
153 grep '^# 3\.test: Some diagnostic$' stdout
154 grep '^ERROR: 3\.test - Bail out! Kernel Panic$' stdout
155 test $
(grep -c '3\.test' stdout
) -eq 3