am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / tap-no-spurious.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # TAP support:
18 #  - don't spuriously recognize lines that are "almost" TAP lines as
19 #    real TAP lines
20
21 . test-init.sh
22
23 . tap-setup.sh
24
25 echo 1..5 > all.test
26
27 # The only recognized directives are "TODO" and "SKIP".
28 # So the following should count as passed tests.
29 cat >> all.test <<END
30 ok 1 # XFAIL
31 ok 2 # SKIPPED
32 ok 3 # TO DO
33 ok 4 # TODOALL
34 ok 5 # FIXME
35 END
36
37 # According to documentation of Test::Harness::TAP(3):
38 #
39 #    Lines written to standard output matching /^(not )?ok\b/
40 #    must be interpreted as test lines. All other lines must
41 #    not be considered test output.
42
43 cat >> all.test <<END
44  ok
45  ok 1
46 ${tab}ok
47 ${tab}ok 1
48  not ok
49  not ok 1
50 ${tab}not ok
51 ${tab}not ok 1
52 notok
53 notok 1
54 not${tab}ok
55 not${tab}ok 1
56 not  ok
57 not  ok 1
58 no ok
59 no ok 1
60 # ok
61 # not ok
62 # ok 1
63 # not ok 1
64 #ok
65 #not ok
66 #ok 1
67 #not ok 1
68 END
69
70 set +x # Don't pollute logs too much.
71 for r in 'ok' 'not ok'; do
72   for s1 in \
73     a b c d e f g h i j k l m n o p q r s t u v w x y z \
74     A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
75     0 1 2 3 4 5 6 7 8 9 _ ab 0a 23 a1B2c _o _x_y_
76   do
77     for s2 in '' @ % + - = / . : \; \* \? \& \! \# \$ \< \> \\; do
78       printf '%s\n' "$r$s1$s2"
79     done
80   done
81 done >> all.test
82 set -x # Reset shell xtraces.
83
84 # The prove(1) utility doesn't bail out on these, so our driver
85 # shouldn't either.
86 # See comments in 'tap-bailout-leading-space.sh' for an explanation
87 # of why we don't have a whitespace-prepended "Bail out!" line here.
88 cat >> all.test <<'END'
89 bailout
90 bailout!
91 bail out
92 bail out!
93 Bailout
94 Bailout!
95 Bail out
96  Bail out
97 #Bail out!
98 # Bail out!
99 END
100
101
102 # Debugging info and minor sanity check.
103 cat all.test \
104   && test $(grep -c '^ok1$' all.test) -eq 1 \
105   && test $(grep -c '^not ok1$' all.test) -eq 1 \
106   || framework_failure_ "creating all.test"
107
108 run_make -O check
109 count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0
110
111 :