blob: 6b3f6c7a46ff3e924d069b70ee3e7934d33f4a86 (
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
# file : tests/recipe/buildscript/testscript
# license : MIT; see accompanying LICENSE file
+mkdir build
+cat <<EOI >=build/bootstrap.build
project = test
amalgamation =
subprojects =
using config
using test
EOI
+cat <<EOI >=build/root.build
EOI
: update
:
{
: success
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
{{
cp $path($<) $path($>)
}}
EOI
$* 2>'cp file{foo}';
cat <<<foo >'bar';
# While at it, make sure there is no rebuild.
#
$* 2>/'info: dir{./} is up to date';
$* clean 2>-
}
: error
:
: Test that the target file is removed on error and is created on subsequent
: successful update.
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
{{
diag concat $<
t = $path($>)
p = $path($<)
cp $p $t
cat $(p).baz >>$t
}}
EOI
$* 2>>~%EOE% != 0;
concat file{bar.}
%cat: unable to print '.+bar.baz': .+%
buildfile:10:3: error: cat exited with code 1
%.+
EOE
test -f foo != 0;
echo 'baz' >=bar.baz;
$* 2>'concat file{bar.}';
cat <<<foo >>EOO;
bar
baz
EOO
$* clean 2>-
}
}
: clean
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
{{
cp $path($<) $path($>)
}}
% [diag=clean] clean
{{
t = $path($>)
rm $t $(t).d
}}
EOI
$* 2>-;
# Rely on the cleanup machinery to verify that the build output files are
# removed.
#
$* clean 2>'clean file{foo}'
}
: test
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
{{
cp $path($<) $path($>)
}}
% [diag=test] test
{{
cat <$path($<) >?$path($>)
}}
EOI
$* test 2>>EOE;
cp file{foo}
test file{foo}
EOE
$* clean 2>-
}
: diff-label
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
{{
echo 'baz' >? $path($<)
}}
EOI
$* 2>>/~%EOE% != 0;
%.+
%--- .+/bar%
+++ stdout
%.+
EOE
$* clean 2>-
}
: timeout
:
if ($cxx.target.class != 'windows')
{
: update
:
{
: expired
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
% [diag=update]
{{
cp $path($<) $path($>)
timeout 1
^sleep 5
}}
EOI
$* 2>>~%EOE% != 0;
update file{foo}
buildfile:6:3: error: ^sleep terminated: execution timeout expired
info: while updating file{foo}
%.+
EOE
$* clean 2>-
}
: successful-timeout
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
% [diag=update]
{{
cp $path($<) $path($>)
timeout --success 1
^sleep 5
}}
EOI
$* 2>>EOE;
update file{foo}
EOE
$* clean 2>-
}
}
: test
:
{
: expired
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
{{
cp $path($<) $path($>)
}}
% [diag=test] test
{{
^sleep 5
}}
EOI
$* test config.test.timeout=1 2>>~%EOE% != 0;
cp file{foo}
test file{foo}
buildfile:7:3: error: ^sleep terminated: execution timeout expired
info: while testing file{foo}
%.+
EOE
$* test config.test.timeout=/1 2>>~%EOE% != 0;
test file{foo}
buildfile:7:3: error: ^sleep terminated: execution timeout expired
info: while testing file{foo}
%.+
EOE
$* clean 2>-
}
: not-expired
:
{
echo 'bar' >=bar;
cat <<EOI >=buildfile;
foo: bar
% [diag=cp]
{{
^sleep 4
cp $path($<) $path($>)
}}
% [diag=test] test
{{
^sleep 1
}}
EOI
$* test config.test.timeout=3 2>>EOE;
cp file{foo}
test file{foo}
EOE
$* clean 2>-
}
}
}
|