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 # - LOG_COMPILER support;
19 # - basic support for TODO and SKIP directives, and "Bail out!" magic;
20 # - testsuite progress output on console;
21 # - runtime overriding of TESTS and TEST_LOGS;
22 # - correct counts of test results (both in summary and in progress
24 # Note that some of the features checked here are checked in other
25 # test cases too, usually in a more thorough and detailed way.
32 cat >> configure.ac <<END
36 cat > Makefile.am << 'END'
37 TEST_LOG_DRIVER = $(srcdir)/tap-driver
38 ## Defining LOG_COMPILER should work and not intefere with the
40 TEST_LOG_COMPILER = cat
46 echo 'not ok 2 # TODO' >>$@-t
47 echo 'ok 3 # SKIP' >>$@-t
48 cat $@-t ;: For debugging.
52 cat > success.test << 'END'
65 ok 12 twelve twelve # TODO
67 not ok 14 fourteen # TODO
68 not ok 15 - fifteen # TODO
69 not ok 16 sixteen sixteen # TODO
72 ok 19 - nineteen # SKIP
73 ok 20 twenty twenty # SKIP
82 # Basilar usage and testsuite progress output.
84 $MAKE check >stdout && { cat stdout; Exit 1; }
87 count_test_results total=20 pass=4 fail=4 xpass=4 xfail=4 skip=4 error=0
90 test -f test-suite.log
94 PASS: success.test 2 two
95 PASS: success.test 3 - three
96 PASS: success.test 4 four four
98 FAIL: success.test 6 six
99 FAIL: success.test 7 - seven
100 FAIL: success.test 8 eight eight
101 XPASS: success.test 9 # TODO
102 XPASS: success.test 10 ten # TODO
103 XPASS: success.test 11 - eleven # TODO
104 XPASS: success.test 12 twelve twelve # TODO
105 XFAIL: success.test 13 # TODO
106 XFAIL: success.test 14 fourteen # TODO
107 XFAIL: success.test 15 - fifteen # TODO
108 XFAIL: success.test 16 sixteen sixteen # TODO
109 SKIP: success.test 17 # SKIP
110 SKIP: success.test 18 eighteen # SKIP
111 SKIP: success.test 19 - nineteen # SKIP
112 SKIP: success.test 20 twenty twenty # SKIP
115 $FGREP ': success.test' stdout > got
121 # Override TESTS from the command line.
125 cat > bail.test <<'END'
131 TESTS=bail.test $MAKE -e check >stdout && { cat stdout; Exit 1; }
134 count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
136 test ! -f success.log
138 test -f test-suite.log
140 grep '^ERROR: bail\.test - Bail out!' stdout
141 grep '^PASS:' stdout && Exit 1
142 test `$FGREP -c ': bail.test' stdout` -eq 1
143 $FGREP 'success.test' stdout && Exit 1
145 # Override TEST_LOGS from the command line, making it point to a test
146 # (ok.test) that has to be generated at make time.
150 TEST_LOGS=ok.log $MAKE -e check >stdout || { cat stdout; Exit 1; }
153 count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
157 test ! -f success.log
159 test -f test-suite.log
161 $EGREP '(bail|success)\.test' stdout && Exit 1
165 XFAIL: ok.test 2 # TODO
166 SKIP: ok.test 3 # SKIP
169 $FGREP ': ok.test' stdout > got