2 # Copyright (C) 2011-2013 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_testaux_srcdir"/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 run_make -O -e FAIL check || { cat test-suite.log; exit 1; }
124 # Couple of sanity checks. These might need to be updated if the
125 # 'trivial-test-driver' script is changed.
126 $FGREP INVALID.NAME stdout test-suite.log && exit 1
127 test -f BAD.LOG && exit 1
128 test -f BAD.TRS && exit 1
129 # These log files must all have been created by the testsuite.
135 cat pass3-skip2-xfail.log
136 cat pass-xpass-fail-xfail-skip-error.log
138 count_test_results total=23 pass=10 fail=5 skip=4 xfail=2 xpass=1 error=1
140 tst=pass-xpass-fail-xfail-skip-error
141 grep "^PASS: $tst\.t, testcase 1" stdout
142 grep "^FAIL: $tst\.t, testcase 2" stdout
143 grep "^XFAIL: $tst\.t, testcase 3" stdout
144 grep "^XPASS: $tst\.t, testcase 4" stdout
145 grep "^SKIP: $tst\.t, testcase 5" stdout
146 grep "^ERROR: $tst\.t, testcase 6" stdout
148 # Check that the content of, and only of, the test logs with at least
149 # one failing test case has been copied into 'test-suite.log'. Note
150 # that test logs containing skipped or xfailed test cases are *not*
151 # copied into 'test-suite.log' -- a behaviour that deliberately differs
152 # from the one of the built-in Automake test drivers.
153 grep '%%' test-suite.log # For debugging.
154 grep '%% fail %%' test-suite.log
155 grep '%% fail2 %%' test-suite.log
156 grep '%% pass-fail %%' test-suite.log
157 grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log
158 test $(grep -c '%% ' test-suite.log) -eq 4
160 run_make -O TESTS='pass.t pass3-skip2-xfail.t' check
162 count_test_results total=7 pass=4 fail=0 skip=2 xfail=1 xpass=0 error=0