summaryrefslogtreecommitdiff
path: root/t/test-extensions-funny-chars.sh
blob: c9faf9a9f3e3c39b85947fbd20f561e527308d4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#! /bin/sh
# Copyright (C) 2011-2015 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Make sure that Automake can handle "funny chars" in TEST_EXTENSIONS,
# as long as they can be used in GNU make variable names.

. test-init.sh

fetch_tap_driver

echo AC_OUTPUT >> configure.ac

cat >> Makefile.am <<'END'
TEST_EXTENSIONS = .@ .2 .f-o-o .l!Nu.x
TESTS = foo.@ bar.f-o-o baz.2 zardoz.l!Nu.x
XFAIL_TESTS = zardoz.l!Nu.x
@_LOG_COMPILER = $(SHELL)
2_LOG_COMPILER = $(SHELL)
F-O-O_LOG_DRIVER = $(srcdir)/tap-driver
L!NU.X_LOG_COMPILER = false
EXTRA_DIST = $(TESTS) tap-driver
END

touch foo.@ bar.f-o-o zardoz.l!Nu.x \
  || skip_ "your file system doesn't support funny characters"

# Try to ensure this file fails if executed directly.
cat > foo.@ << 'END'
#! /bin/false
echo @K @K @K
exit 0
END
cp foo.@ baz.2
# We don't want them to be executable, either.  So do this for
# extra safety.
chmod a-x foo.@ baz.2

cat > bar.f-o-o << 'END'
#! /bin/sh
echo 1..4
echo "ok - good"
echo "ok 2 # SKIP"
echo "not ok 3 # TODO"
echo ok
END
chmod a+x bar.f-o-o

cat > zardoz.l!Nu.x << 'END'
#! /bin/sh
echo Hello Zardoz
exit 0
END
chmod a+x zardoz.l!Nu.x

count_all ()
{
  count_test_results total=7 pass=4 fail=0 skip=1 xfail=2 xpass=0 error=0
  grep '^PASS: foo\.@$'                 stdout
  grep '^PASS: baz\.2$'                 stdout
  grep '^XFAIL: zardoz.l!Nu\.x$'        stdout
  grep '^PASS: bar\.f-o-o 1 - good'     stdout
  grep '^SKIP: bar\.f-o-o 2 # SKIP'     stdout
  grep '^XFAIL: bar\.f-o-o 3 # TODO'    stdout
  grep '^PASS: bar\.f-o-o 4$'           stdout
}

$ACLOCAL
$AUTOCONF
$AUTOMAKE -a

./configure

run_make -e IGNORE -O check
ls -l
cat test-suite.log
cat foo.log
grep '@K @K @K' foo.log
cat baz.log
grep '@K @K @K' baz.log
cat bar.log
cat zardoz.log
grep 'Hello Zardoz' zardoz.log && exit 1
test $am_make_rc -eq 0
count_all

$MAKE clean
test ! -f test-suite.log
test ! -f foo.log
test ! -f bar.log
test ! -f baz.log
test ! -f zardoz.log

run_make -e IGNORE -O check TESTS=zardoz L!NU.X_LOG_COMPILER=/bin/sh
count_test_results total=1 pass=0 fail=0 skip=0 xfail=0 xpass=1 error=0
cat test-suite.log
test ! -f foo.log
test ! -f bar.log
test ! -f baz.log
cat zardoz.log
grep 'Hello Zardoz' zardoz.log
test $am_make_rc -gt 0

run_make -O recheck
count_test_results total=1 pass=0 fail=0 skip=0 xfail=1 xpass=0 error=0
grep '^XFAIL: zardoz.l!Nu\.x$' stdout

run_make -O recheck
count_test_results total=0 pass=0 fail=0 skip=0 xfail=0 xpass=0 error=0

run_make -O distcheck
count_all

: