summaryrefslogtreecommitdiff
path: root/t/parallel-tests-per-suffix-deps.sh
blob: 65b2385326c3536cd2aae0b41d5bb12281683185 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#! /bin/sh
# Copyright (C) 2012 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/>.

# The user should be able to easily specify extra dependencies for
# the test cases, depending on their extension (or lack thereof).
# We do so with the help of "${prefix}LOG_DEPENDENCIES" variables.
# See the last wishlist in automake bug#11287.

. test-init.sh

cat >> configure.ac <<'END'
AC_SUBST([EXEEXT], [.bin])
AC_OUTPUT
END

cat > Makefile.am << 'END'
TEST_EXTENSIONS = .test .sh
TESTS = foo.test foo2.test bar.sh baz zard.oz quux.bin mu.test.bin

TEST_LOG_DEPENDENCIES = test-dep
SH_LOG_DEPENDENCIES = sh-dep1 sh-dep2
LOG_DEPENDENCIES = dep

DEPS = test-dep sh-dep1 sh-dep2 dep new-test-dep
$(DEPS):
	echo dummy > $@
CLEANFILES = $(DEPS)

.PHONY: setup
setup:
	chmod a+x $(TESTS)
EXTRA_DIST = $(TESTS)
END

cat > foo.test <<'END'
#! /bin/sh
test -f test-dep || test -f new-test-dep
END

cat > foo2.test <<'END'
#! /bin/sh
test -f test-dep
END

cp foo2.test mu.test.bin

cat > bar.sh <<'END'
#! /bin/sh
test -f sh-dep1 && test -f sh-dep2
END

cat > baz <<'END'
#! /bin/sh
test -f dep
END

cp baz quux.bin

cat > zard.oz <<'END'
#! /bin/sh
test -f dep
END

$ACLOCAL
$AUTOCONF
$AUTOMAKE -a

./configure

$MAKE setup

cleanup () { rm -f test-dep sh-dep1 sh-dep2 dep; }

$MAKE check -j4
test ! -f new-test-dep
test -f test-dep
test -f sh-dep1
test -f sh-dep2
test -f dep
test -f quux.log  # Sanity check.
test -f mu.log    # Likewise.

cleanup

$MAKE check TESTS=foo.test
test -f test-dep
test ! -f sh-dep1
test ! -f sh-dep2
test ! -f dep

cleanup
rm -f bar.log
$MAKE check TESTS=bar.sh AM_LAZY_CHECK=yes
test ! -f test-dep
test -f sh-dep1
test -f sh-dep2
test ! -f dep

cleanup
$MAKE check TESTS=baz
test ! -f test-dep
test ! -f sh-dep1
test ! -f sh-dep2
test -f dep

cleanup
$MAKE check TESTS='foo bar'
test -f test-dep
test -f sh-dep1
test -f sh-dep2
test ! -f dep

cleanup
$MAKE check TESTS=zard.oz
test ! -f test-dep
test ! -f sh-dep1
test ! -f sh-dep2
test -f dep

cleanup
$MAKE check TESTS=mu.test.bin
test -f test-dep
test ! -f sh-dep1
test ! -f sh-dep2
test ! -f dep

cleanup
$MAKE check TESTS='quux.bin bar.sh'
test ! -f test-dep
test -f sh-dep1
test -f sh-dep2
test -f dep

cleanup
$MAKE check TESTS=foo TEST_LOG_DEPENDENCIES=new-test-dep
test -f new-test-dep
test ! -f test-dep
test ! -f sh-dep1
test ! -f sh-dep2
test ! -f dep

cleanup
$MAKE check TESTS=baz XFAIL_TESTS=baz LOG_DEPENDENCIES=
test ! -f dep
grep ':test-result: XFAIL' baz.trs

$MAKE distcheck

: