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: check that we can easily support test protocols
18 # that allow multiple testcases in a single test script. This test not
19 # only checks implementation details in Automake's custom test drivers
20 # support, but also serves as a "usability test" for our APIs.
24 cp "$am_testauxdir"/trivial-test-driver . \
25 || fatal_ "failed to fetch auxiliary script trivial-test-driver"
27 cat >> configure.ac << 'END'
31 cat > Makefile.am << 'END'
33 T_LOG_DRIVER = $(SHELL) $(srcdir)/trivial-test-driver
42 pass-xpass-fail-xfail-skip-error.t
55 cat > fail2.t << 'END'
59 echo :PASS: this should be ignored
62 cat > pass-fail.t << 'END'
64 echo 'FAIL: this fails :-('
65 echo 'some randome message'
66 echo 'some randome warning' >&2
67 echo 'PASS: this passes :-)'
69 echo 'WARNING: blah blah' >&2
72 cat > pass4-skip.t << 'END'
74 echo PASS: on stdout >&1
75 echo PASS: on stderr >&2
79 echo this FAIL: should be ignored
80 echo FAIL as should this
84 cat > pass3-skip2-xfail.t << 'END'
85 echo %% pass4-skip2-xfail %%
87 echo 'PASS: --verbose'
88 echo 'SKIP: Oops, unsupported system.'
90 cp || echo "SKIP: cp cannot read users' mind" >&2
91 mv || echo "XFAIL: mv cannot read users' mind yet"
95 cat > pass-xpass-fail-xfail-skip-error.t << 'END'
102 echo %% pass-xpass-fail-xfail-skip-error %%
111 for vpath in : false; do
122 $MAKE check >stdout && { cat stdout; cat test-suite.log; exit 1; }
125 # Couple of sanity checks. These might need to be updated if the
126 # 'trivial-test-driver' script is changed.
127 $FGREP INVALID.NAME stdout test-suite.log && exit 1
128 test -f BAD.LOG && exit 1
129 test -f BAD.TRS && exit 1
130 # These log files must all have been created by the testsuite.
136 cat pass3-skip2-xfail.log
137 cat pass-xpass-fail-xfail-skip-error.log
139 count_test_results total=23 pass=10 fail=5 skip=4 xfail=2 xpass=1 error=1
141 tst=pass-xpass-fail-xfail-skip-error
142 grep "^PASS: $tst\.t, testcase 1" stdout
143 grep "^FAIL: $tst\.t, testcase 2" stdout
144 grep "^XFAIL: $tst\.t, testcase 3" stdout
145 grep "^XPASS: $tst\.t, testcase 4" stdout
146 grep "^SKIP: $tst\.t, testcase 5" stdout
147 grep "^ERROR: $tst\.t, testcase 6" stdout
149 # Check that the content of, and only of, the test logs with at least
150 # one failing test case has been copied into 'test-suite.log'. Note
151 # that test logs containing skipped or xfailed test cases are *not*
152 # copied into 'test-suite.log' -- a behaviour that deliberately differs
153 # from the one of the built-in Automake test drivers.
154 grep '%%' test-suite.log # For debugging.
155 grep '%% fail %%' test-suite.log
156 grep '%% fail2 %%' test-suite.log
157 grep '%% pass-fail %%' test-suite.log
158 grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log
159 test $(grep -c '%% ' test-suite.log) -eq 4
161 TESTS='pass.t pass3-skip2-xfail.t' $MAKE -e check >stdout \
162 || { cat stdout; cat test-suite.log; exit 1; }
165 count_test_results total=7 pass=4 fail=0 skip=2 xfail=1 xpass=0 error=0