2 # Copyright (C) 2011 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 # - diagnostic messages (TAP lines with leading "#")
19 # - flags '--comments' and '--no-comments' of the TAP test driver
24 .
"$testsrcdir"/tap-setup.sh || fatal_
"sourcing tap-setup.sh"
26 metacharacters
=\''"\$!&()[]<>#;^?*'
37 # Shell metacharacters here: $metacharacters
38 .# Leading characters before "#", not a TAP diagnostic line.
39 x # Leading characters before "#", not a TAP diagnostic line.
40 # Leading whitespace before "#", not a TAP diagnostic line.
41 ${tab}# Leading whitespace before "#", not a TAP diagnostic line.
42 ${tab} # Leading whitespace before "#", not a TAP diagnostic line.
46 # all.test: Hi! I'm a comment.
47 # all.test: Tests begin.
49 XFAIL: all.test 2 - foo # TODO
50 SKIP: all.test 3 - bar # SKIP
51 # all.test: Tests end.
52 PASS: all.test 4 - zardoz
53 # all.test: Shell metacharacters here: $metacharacters
56 $MAKE check
>stdout ||
{ cat stdout
; Exit
1; }
58 $EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout
&& Exit
1
59 count_test_results total
=4 pass
=2 fail
=0 xpass
=0 xfail
=1 skip
=1 error
=0
61 echo 'AM_TEST_LOG_DRIVER_FLAGS = --comments' >> Makefile
62 $MAKE check
>stdout ||
{ cat stdout
; Exit
1; }
64 $FGREP ' all.test' stdout
> got
68 count_test_results total
=4 pass
=2 fail
=0 xpass
=0 xfail
=1 skip
=1 error
=0
70 TEST_LOG_DRIVER_FLAGS
="--no-comments" $MAKE -e check
>stdout \
71 ||
{ cat stdout
; Exit
1; }
73 $EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout
&& Exit
1
74 count_test_results total
=4 pass
=2 fail
=0 xpass
=0 xfail
=1 skip
=1 error
=0
76 # The "#"-prepended lines here shouldn't be parsed as test results.
92 $MAKE check
>stdout ||
{ cat stdout
; Exit
1; }
94 count_test_results total
=1 pass
=1 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
96 # Diagnostic without leading whitespace, or with extra leading whitespace,
97 # is ok. Be laxer in the grepping checks, to allow for whitespace
98 # normalization by the TAP driver.
110 # ${tab} ${tab}${tab}foo bar${tab}baz ${tab}
113 $MAKE check
>stdout ||
{ cat stdout
; Exit
1; }
115 count_test_results total
=1 pass
=1 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
117 grep "^# all.test:${ws0p}foo$" stdout
118 grep "^# all.test:${ws0p}bar${ws0p}$" stdout
119 grep "^# all.test:${ws1p}zardoz${ws0p}$" stdout
120 grep "^# all.test:${ws1p}foo bar${tab}baz${ws0p}$" stdout
122 test `grep -c '^# all\.test:' stdout` -eq 4