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 # TAP support: whitespace normalization (or lack thereof) in the testsuite
18 # progress output on console. We keep all these checks here in a single
19 # script so that a potential cosmetic change in the output format won't
20 # force us to tweak dozens of other tests (hopefully).
21 # See also related test 'tap-todo-skip-whitespace.test'.
26 cat > Makefile.am << 'END'
27 TEST_LOG_COMPILER = cat
33 spaces_a=${sp}${tab}${tab}${sp}${sp}${tab}
34 spaces_b=${tab}${tab}${sp}${tab}${sp}${sp}${sp}
36 #-----------------------------------------------------------------------
38 echo TESTS += numbers.test >> Makefile.am
40 cat > numbers.test <<END
44 ok${spaces_a}3${spaces_b}
47 not ok${spaces_b}6${spaces_a}
59 #-----------------------------------------------------------------------
61 echo TESTS += description.test >> Makefile.am
63 cat > description.test <<END
67 ok${spaces_a}+baz${spaces_b}
69 not ok -bar${spaces_a}
70 not ok${spaces_b}-baz${spaces_a}
71 ok u${spaces_b}v${spaces_a}w${sp}
72 not ok${spaces_a}x${spaces_a}y${tab}z${tab}
76 PASS: description.test 1 +foo
77 PASS: description.test 2 +bar
78 PASS: description.test 3 +baz
79 FAIL: description.test 4 -foo
80 FAIL: description.test 5 -bar
81 FAIL: description.test 6 -baz
82 PASS: description.test 7 u${spaces_b}v${spaces_a}w
83 FAIL: description.test 8 x${spaces_a}y${tab}z
86 #-----------------------------------------------------------------------
90 echo TESTS += bailout.test >> Makefile.am
92 cat > bailout.test <<END
94 Bail out!${tab}${sp}${sp}${tab}We're out of disk space.
99 ERROR: bailout.test - Bail out! We're out of disk space.
102 echo TESTS += bailout2.test >> Makefile.am
104 cat > bailout2.test <<END
106 Bail out!foo${tab}${sp}
111 ERROR: bailout2.test - Bail out! foo
114 #-----------------------------------------------------------------------
118 echo AM_TEST_LOG_DRIVER_FLAGS = --comments >> Makefile.am
119 echo TESTS += cmnt.test >> Makefile.am
121 cat > cmnt.test <<END
124 #Leading whitespace gets added
125 # ${tab}${tab} ${tab}Extra leading whitespace is stripped
126 # Trailing whitespace is stripped ${tab} ${tab}${tab}
127 # Middle${tab}whitespace is${tab} ${tab}${tab} kept
128 # ${tab} And only${tab}middle ${tab}whitespace ${tab}${tab} ${tab}
133 # cmnt.test: Leading whitespace gets added
134 # cmnt.test: Extra leading whitespace is stripped
135 # cmnt.test: Trailing whitespace is stripped
136 # cmnt.test: Middle${tab}whitespace is${tab} ${tab}${tab} kept
137 # cmnt.test: And only${tab}middle ${tab}whitespace
140 #-----------------------------------------------------------------------
142 # TODO: we should have more checks here ... (but let's not over-do FTM).
144 #-----------------------------------------------------------------------
148 . "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
150 # Don't care about exit status or number of test results, they should be
151 # checked for in many other tests.
152 $MAKE check >stdout || :
155 LC_ALL=C sort exp > t
158 # We need the sort below to account for parallel make usage.
159 LC_ALL=C grep '[a-z0-9][a-z0-9]*\.test' stdout | LC_ALL=C sort > got