Merge branch 'fix-pr13588-pax-hangs' into branch-1.13.2
[automake.git] / t / tap-diagnostic-custom.sh
blob978b526adde0e3eac04344e1f6d53f2618f6df90
1 #! /bin/sh
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)
7 # any later version.
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:
18 # - option '--diagnostic-string' to customize the string introducing
19 # TAP diagnostics
21 . test-init.sh
23 fetch_tap_driver
25 cat >> configure.ac <<END
26 AC_OUTPUT
27 END
29 cat > Makefile.am << 'END'
30 my_log_driver = $(srcdir)/tap-driver
31 my_log_compiler = cat
32 TEST_EXTENSIONS =
33 TESTS =
34 END
36 : > later.mk
38 # Quoting our comments below is an hack required to keep
39 # comments near the things they refer to.
40 i=0
41 for string in \
42 '## A letter' \
43 a \
44 '## A number' \
45 1023 \
46 '## A non-alphabetic character' \
47 @ \
48 '## Some metacharacters (we need to repeat the "$" for make)' \
49 '^>;&*"|$$' \
50 '## A whitespace character' \
51 " " \
52 '## A tab character' \
53 "$tab" \
54 '## A string with more whitespace' \
55 " ${tab}a b${tab} c" \
56 '## Note the we do not have the empty string here. We prefer to' \
57 '## leave its behaviour in this context undefined for the moment.'
59 case $string in '##'*) continue;; esac
60 i=$(($i + 1))
61 unindent >> Makefile.am << END
62 TEST_EXTENSIONS += .t$i
63 TESTS += foo$i.t$i
64 T${i}_LOG_COMPILER = \$(my_log_compiler)
65 T${i}_LOG_DRIVER = \$(my_log_driver)
66 AM_T${i}_LOG_DRIVER_FLAGS = \
67 --comments \
68 --diagnostic-string '$string'
69 END
70 unindent > foo$i.t$i <<END
71 1..1
72 ok 1
73 $string blah blah $i
74 END
75 echo "AM_T${i}_LOG_DRIVER_FLAGS = --no-comments" >> later.mk
76 done
78 $ACLOCAL
79 $AUTOCONF
80 $AUTOMAKE
82 ./configure
84 $MAKE check >stdout || { cat stdout; exit 1; }
85 cat stdout
86 count_test_results total=$i pass=$i fail=0 xpass=0 xfail=0 skip=0 error=0
88 cat later.mk >> Makefile
89 $MAKE check >stdout || { cat stdout; exit 1; }
90 cat stdout
91 $FGREP 'blah blah' stdout && exit 1