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/>.
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.
31 cat >> configure.ac <<END
35 cat > Makefile.am << 'END'
36 TEST_LOG_DRIVER = $(srcdir)/tap-driver
37 ## Defining LOG_COMPILER should work and not intefere with the
39 TEST_LOG_COMPILER = cat
45 echo 'not ok 2 # TODO' >>$@-t
46 echo 'ok 3 # SKIP' >>$@-t
47 cat $@-t ;: For debugging.
51 cat > success.test << 'END'
64 ok 12 twelve twelve # TODO
66 not ok 14 fourteen # TODO
67 not ok 15 - fifteen # TODO
68 not ok 16 sixteen sixteen # TODO
71 ok 19 - nineteen # SKIP
72 ok 20 twenty twenty # SKIP
81 # Basilar usage and testsuite progress output.
83 run_make -O -e FAIL check
84 count_test_results total=20 pass=4 fail=4 xpass=4 xfail=4 skip=4 error=0
87 test -f test-suite.log
91 PASS: success.test 2 two
92 PASS: success.test 3 - three
93 PASS: success.test 4 four four
95 FAIL: success.test 6 six
96 FAIL: success.test 7 - seven
97 FAIL: success.test 8 eight eight
98 XPASS: success.test 9 # TODO
99 XPASS: success.test 10 ten # TODO
100 XPASS: success.test 11 - eleven # TODO
101 XPASS: success.test 12 twelve twelve # TODO
102 XFAIL: success.test 13 # TODO
103 XFAIL: success.test 14 fourteen # TODO
104 XFAIL: success.test 15 - fifteen # TODO
105 XFAIL: success.test 16 sixteen sixteen # TODO
106 SKIP: success.test 17 # SKIP
107 SKIP: success.test 18 eighteen # SKIP
108 SKIP: success.test 19 - nineteen # SKIP
109 SKIP: success.test 20 twenty twenty # SKIP
112 $FGREP ': success.test' stdout > got
118 # Override TESTS from the command line.
122 cat > bail.test <<'END'
128 run_make -O -e FAIL check TESTS=bail.test
129 count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
131 test ! -e success.log
133 test -f test-suite.log
135 grep '^ERROR: bail\.test - Bail out!' stdout
136 grep '^PASS:' stdout && exit 1
137 test $($FGREP -c ': bail.test' stdout) -eq 1
138 $FGREP 'success.test' stdout && exit 1
140 # Override TEST_LOGS from the command line, making it point to a test
141 # (ok.test) that has to be generated at make time.
145 run_make -O check TEST_LOGS=ok.log
146 count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
150 test ! -e success.log
152 test -f test-suite.log
154 $EGREP '(bail|success)\.test' stdout && exit 1
158 XFAIL: ok.test 2 # TODO
159 SKIP: ok.test 3 # SKIP
162 $FGREP ': ok.test' stdout > got