##// END OF EJS Templates
tests: avoid duplicate install steps in test-run-tests...
Matt Mackall -
r27395:0622d6e1 default
parent child Browse files
Show More
@@ -1,675 +1,680 b''
1 This file tests the behavior of run-tests.py itself.
1 This file tests the behavior of run-tests.py itself.
2
2
3 Avoid interference from actual test env:
3 Avoid interference from actual test env:
4
4
5 $ unset HGTEST_JOBS
5 $ unset HGTEST_JOBS
6 $ unset HGTEST_TIMEOUT
6 $ unset HGTEST_TIMEOUT
7 $ unset HGTEST_PORT
7 $ unset HGTEST_PORT
8 $ unset HGTEST_SHELL
8 $ unset HGTEST_SHELL
9
9
10 Smoke test
10 Smoke test with install
11 ============
11 ============
12
12
13 $ run-tests.py $HGTEST_RUN_TESTS_PURE
13 $ run-tests.py $HGTEST_RUN_TESTS_PURE -l
14
14
15 # Ran 0 tests, 0 skipped, 0 warned, 0 failed.
15 # Ran 0 tests, 0 skipped, 0 warned, 0 failed.
16
16
17 Define a helper to avoid the install step
18 =============
19 $ rt()
20 > {
21 > run-tests.py --with-hg=`which hg` "$@"
22 > }
23
17 a succesful test
24 a succesful test
18 =======================
25 =======================
19
26
20 $ cat > test-success.t << EOF
27 $ cat > test-success.t << EOF
21 > $ echo babar
28 > $ echo babar
22 > babar
29 > babar
23 > $ echo xyzzy
30 > $ echo xyzzy
24 > never happens (?)
31 > never happens (?)
25 > xyzzy
32 > xyzzy
26 > nor this (?)
33 > nor this (?)
27 > EOF
34 > EOF
28
35
29 $ run-tests.py --with-hg=`which hg`
36 $ rt
30 .
37 .
31 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
38 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
32
39
33 failing test
40 failing test
34 ==================
41 ==================
35
42
36 $ cat > test-failure.t << EOF
43 $ cat > test-failure.t << EOF
37 > $ echo babar
44 > $ echo babar
38 > rataxes
45 > rataxes
39 > This is a noop statement so that
46 > This is a noop statement so that
40 > this test is still more bytes than success.
47 > this test is still more bytes than success.
41 > EOF
48 > EOF
42
49
43 >>> fh = open('test-failure-unicode.t', 'wb')
50 >>> fh = open('test-failure-unicode.t', 'wb')
44 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
51 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
45 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
52 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
46
53
47 $ run-tests.py --with-hg=`which hg`
54 $ rt
48
55
49 --- $TESTTMP/test-failure.t
56 --- $TESTTMP/test-failure.t
50 +++ $TESTTMP/test-failure.t.err
57 +++ $TESTTMP/test-failure.t.err
51 @@ -1,4 +1,4 @@
58 @@ -1,4 +1,4 @@
52 $ echo babar
59 $ echo babar
53 - rataxes
60 - rataxes
54 + babar
61 + babar
55 This is a noop statement so that
62 This is a noop statement so that
56 this test is still more bytes than success.
63 this test is still more bytes than success.
57
64
58 ERROR: test-failure.t output changed
65 ERROR: test-failure.t output changed
59 !.
66 !.
60 --- $TESTTMP/test-failure-unicode.t
67 --- $TESTTMP/test-failure-unicode.t
61 +++ $TESTTMP/test-failure-unicode.t.err
68 +++ $TESTTMP/test-failure-unicode.t.err
62 @@ -1,2 +1,2 @@
69 @@ -1,2 +1,2 @@
63 $ echo babar\xce\xb1 (esc)
70 $ echo babar\xce\xb1 (esc)
64 - l\xce\xb5\xce\xb5t (esc)
71 - l\xce\xb5\xce\xb5t (esc)
65 + babar\xce\xb1 (esc)
72 + babar\xce\xb1 (esc)
66
73
67 ERROR: test-failure-unicode.t output changed
74 ERROR: test-failure-unicode.t output changed
68 !
75 !
69 Failed test-failure.t: output changed
76 Failed test-failure.t: output changed
70 Failed test-failure-unicode.t: output changed
77 Failed test-failure-unicode.t: output changed
71 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
78 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
72 python hash seed: * (glob)
79 python hash seed: * (glob)
73 [1]
80 [1]
74
81
75 test --xunit support
82 test --xunit support
76 $ run-tests.py --with-hg=`which hg` --xunit=xunit.xml
83 $ rt --xunit=xunit.xml
77
84
78 --- $TESTTMP/test-failure.t
85 --- $TESTTMP/test-failure.t
79 +++ $TESTTMP/test-failure.t.err
86 +++ $TESTTMP/test-failure.t.err
80 @@ -1,4 +1,4 @@
87 @@ -1,4 +1,4 @@
81 $ echo babar
88 $ echo babar
82 - rataxes
89 - rataxes
83 + babar
90 + babar
84 This is a noop statement so that
91 This is a noop statement so that
85 this test is still more bytes than success.
92 this test is still more bytes than success.
86
93
87 ERROR: test-failure.t output changed
94 ERROR: test-failure.t output changed
88 !.
95 !.
89 --- $TESTTMP/test-failure-unicode.t
96 --- $TESTTMP/test-failure-unicode.t
90 +++ $TESTTMP/test-failure-unicode.t.err
97 +++ $TESTTMP/test-failure-unicode.t.err
91 @@ -1,2 +1,2 @@
98 @@ -1,2 +1,2 @@
92 $ echo babar\xce\xb1 (esc)
99 $ echo babar\xce\xb1 (esc)
93 - l\xce\xb5\xce\xb5t (esc)
100 - l\xce\xb5\xce\xb5t (esc)
94 + babar\xce\xb1 (esc)
101 + babar\xce\xb1 (esc)
95
102
96 ERROR: test-failure-unicode.t output changed
103 ERROR: test-failure-unicode.t output changed
97 !
104 !
98 Failed test-failure.t: output changed
105 Failed test-failure.t: output changed
99 Failed test-failure-unicode.t: output changed
106 Failed test-failure-unicode.t: output changed
100 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
107 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
101 python hash seed: * (glob)
108 python hash seed: * (glob)
102 [1]
109 [1]
103 $ cat xunit.xml
110 $ cat xunit.xml
104 <?xml version="1.0" encoding="utf-8"?>
111 <?xml version="1.0" encoding="utf-8"?>
105 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
112 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
106 <testcase name="test-success.t" time="*"/> (glob)
113 <testcase name="test-success.t" time="*"/> (glob)
107 <testcase name="test-failure-unicode.t" time="*"> (glob)
114 <testcase name="test-failure-unicode.t" time="*"> (glob)
108 <![CDATA[--- $TESTTMP/test-failure-unicode.t
115 <![CDATA[--- $TESTTMP/test-failure-unicode.t
109 +++ $TESTTMP/test-failure-unicode.t.err
116 +++ $TESTTMP/test-failure-unicode.t.err
110 @@ -1,2 +1,2 @@
117 @@ -1,2 +1,2 @@
111 $ echo babar\xce\xb1 (esc)
118 $ echo babar\xce\xb1 (esc)
112 - l\xce\xb5\xce\xb5t (esc)
119 - l\xce\xb5\xce\xb5t (esc)
113 + babar\xce\xb1 (esc)
120 + babar\xce\xb1 (esc)
114 ]]> </testcase>
121 ]]> </testcase>
115 <testcase name="test-failure.t" time="*"> (glob)
122 <testcase name="test-failure.t" time="*"> (glob)
116 <![CDATA[--- $TESTTMP/test-failure.t
123 <![CDATA[--- $TESTTMP/test-failure.t
117 +++ $TESTTMP/test-failure.t.err
124 +++ $TESTTMP/test-failure.t.err
118 @@ -1,4 +1,4 @@
125 @@ -1,4 +1,4 @@
119 $ echo babar
126 $ echo babar
120 - rataxes
127 - rataxes
121 + babar
128 + babar
122 This is a noop statement so that
129 This is a noop statement so that
123 this test is still more bytes than success.
130 this test is still more bytes than success.
124 ]]> </testcase>
131 ]]> </testcase>
125 </testsuite>
132 </testsuite>
126
133
127 $ rm test-failure-unicode.t
134 $ rm test-failure-unicode.t
128
135
129 test for --retest
136 test for --retest
130 ====================
137 ====================
131
138
132 $ run-tests.py --with-hg=`which hg` --retest
139 $ rt --retest
133
140
134 --- $TESTTMP/test-failure.t
141 --- $TESTTMP/test-failure.t
135 +++ $TESTTMP/test-failure.t.err
142 +++ $TESTTMP/test-failure.t.err
136 @@ -1,4 +1,4 @@
143 @@ -1,4 +1,4 @@
137 $ echo babar
144 $ echo babar
138 - rataxes
145 - rataxes
139 + babar
146 + babar
140 This is a noop statement so that
147 This is a noop statement so that
141 this test is still more bytes than success.
148 this test is still more bytes than success.
142
149
143 ERROR: test-failure.t output changed
150 ERROR: test-failure.t output changed
144 !
151 !
145 Failed test-failure.t: output changed
152 Failed test-failure.t: output changed
146 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
153 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
147 python hash seed: * (glob)
154 python hash seed: * (glob)
148 [1]
155 [1]
149
156
150 Selecting Tests To Run
157 Selecting Tests To Run
151 ======================
158 ======================
152
159
153 successful
160 successful
154
161
155 $ run-tests.py --with-hg=`which hg` test-success.t
162 $ rt test-success.t
156 .
163 .
157 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
164 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
158
165
159 success w/ keyword
166 success w/ keyword
160 $ run-tests.py --with-hg=`which hg` -k xyzzy
167 $ rt -k xyzzy
161 .
168 .
162 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
169 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
163
170
164 failed
171 failed
165
172
166 $ run-tests.py --with-hg=`which hg` test-failure.t
173 $ rt test-failure.t
167
174
168 --- $TESTTMP/test-failure.t
175 --- $TESTTMP/test-failure.t
169 +++ $TESTTMP/test-failure.t.err
176 +++ $TESTTMP/test-failure.t.err
170 @@ -1,4 +1,4 @@
177 @@ -1,4 +1,4 @@
171 $ echo babar
178 $ echo babar
172 - rataxes
179 - rataxes
173 + babar
180 + babar
174 This is a noop statement so that
181 This is a noop statement so that
175 this test is still more bytes than success.
182 this test is still more bytes than success.
176
183
177 ERROR: test-failure.t output changed
184 ERROR: test-failure.t output changed
178 !
185 !
179 Failed test-failure.t: output changed
186 Failed test-failure.t: output changed
180 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
187 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
181 python hash seed: * (glob)
188 python hash seed: * (glob)
182 [1]
189 [1]
183
190
184 failure w/ keyword
191 failure w/ keyword
185 $ run-tests.py --with-hg=`which hg` -k rataxes
192 $ rt -k rataxes
186
193
187 --- $TESTTMP/test-failure.t
194 --- $TESTTMP/test-failure.t
188 +++ $TESTTMP/test-failure.t.err
195 +++ $TESTTMP/test-failure.t.err
189 @@ -1,4 +1,4 @@
196 @@ -1,4 +1,4 @@
190 $ echo babar
197 $ echo babar
191 - rataxes
198 - rataxes
192 + babar
199 + babar
193 This is a noop statement so that
200 This is a noop statement so that
194 this test is still more bytes than success.
201 this test is still more bytes than success.
195
202
196 ERROR: test-failure.t output changed
203 ERROR: test-failure.t output changed
197 !
204 !
198 Failed test-failure.t: output changed
205 Failed test-failure.t: output changed
199 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
206 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
200 python hash seed: * (glob)
207 python hash seed: * (glob)
201 [1]
208 [1]
202
209
203 Verify that when a process fails to start we show a useful message
210 Verify that when a process fails to start we show a useful message
204 ==================================================================
211 ==================================================================
205 NOTE: there is currently a bug where this shows "2 failed" even though
212 NOTE: there is currently a bug where this shows "2 failed" even though
206 it's actually the same test being reported for failure twice.
213 it's actually the same test being reported for failure twice.
207
214
208 $ cat > test-serve-fail.t <<EOF
215 $ cat > test-serve-fail.t <<EOF
209 > $ echo 'abort: child process failed to start blah'
216 > $ echo 'abort: child process failed to start blah'
210 > EOF
217 > EOF
211 $ run-tests.py --with-hg=`which hg` test-serve-fail.t
218 $ rt test-serve-fail.t
212
219
213 ERROR: test-serve-fail.t output changed
220 ERROR: test-serve-fail.t output changed
214 !
221 !
215 ERROR: test-serve-fail.t output changed
222 ERROR: test-serve-fail.t output changed
216 !
223 !
217 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
224 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
218 Failed test-serve-fail.t: output changed
225 Failed test-serve-fail.t: output changed
219 # Ran 1 tests, 0 skipped, 0 warned, 2 failed.
226 # Ran 1 tests, 0 skipped, 0 warned, 2 failed.
220 python hash seed: * (glob)
227 python hash seed: * (glob)
221 [1]
228 [1]
222 $ rm test-serve-fail.t
229 $ rm test-serve-fail.t
223
230
224 Running In Debug Mode
231 Running In Debug Mode
225 ======================
232 ======================
226
233
227 $ run-tests.py --with-hg=`which hg` --debug 2>&1 | grep -v pwd
234 $ rt --debug 2>&1 | grep -v pwd
228 + echo *SALT* 0 0 (glob)
235 + echo *SALT* 0 0 (glob)
229 *SALT* 0 0 (glob)
236 *SALT* 0 0 (glob)
230 + echo babar
237 + echo babar
231 babar
238 babar
232 + echo *SALT* 4 0 (glob)
239 + echo *SALT* 4 0 (glob)
233 *SALT* 4 0 (glob)
240 *SALT* 4 0 (glob)
234 .+ echo *SALT* 0 0 (glob)
241 .+ echo *SALT* 0 0 (glob)
235 *SALT* 0 0 (glob)
242 *SALT* 0 0 (glob)
236 + echo babar
243 + echo babar
237 babar
244 babar
238 + echo *SALT* 2 0 (glob)
245 + echo *SALT* 2 0 (glob)
239 *SALT* 2 0 (glob)
246 *SALT* 2 0 (glob)
240 + echo xyzzy
247 + echo xyzzy
241 xyzzy
248 xyzzy
242 + echo *SALT* 6 0 (glob)
249 + echo *SALT* 6 0 (glob)
243 *SALT* 6 0 (glob)
250 *SALT* 6 0 (glob)
244 .
251 .
245 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
252 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
246
253
247 Parallel runs
254 Parallel runs
248 ==============
255 ==============
249
256
250 (duplicate the failing test to get predictable output)
257 (duplicate the failing test to get predictable output)
251 $ cp test-failure.t test-failure-copy.t
258 $ cp test-failure.t test-failure-copy.t
252
259
253 $ run-tests.py --with-hg=`which hg` --jobs 2 test-failure*.t -n
260 $ rt --jobs 2 test-failure*.t -n
254 !!
261 !!
255 Failed test-failure*.t: output changed (glob)
262 Failed test-failure*.t: output changed (glob)
256 Failed test-failure*.t: output changed (glob)
263 Failed test-failure*.t: output changed (glob)
257 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
264 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
258 python hash seed: * (glob)
265 python hash seed: * (glob)
259 [1]
266 [1]
260
267
261 failures in parallel with --first should only print one failure
268 failures in parallel with --first should only print one failure
262 >>> f = open('test-nothing.t', 'w')
269 >>> f = open('test-nothing.t', 'w')
263 >>> f.write('foo\n' * 1024) and None
270 >>> f.write('foo\n' * 1024) and None
264 >>> f.write(' $ sleep 1') and None
271 >>> f.write(' $ sleep 1') and None
265 $ run-tests.py --with-hg=`which hg` --jobs 2 --first
272 $ rt --jobs 2 --first
266
273
267 --- $TESTTMP/test-failure*.t (glob)
274 --- $TESTTMP/test-failure*.t (glob)
268 +++ $TESTTMP/test-failure*.t.err (glob)
275 +++ $TESTTMP/test-failure*.t.err (glob)
269 @@ -1,4 +1,4 @@
276 @@ -1,4 +1,4 @@
270 $ echo babar
277 $ echo babar
271 - rataxes
278 - rataxes
272 + babar
279 + babar
273 This is a noop statement so that
280 This is a noop statement so that
274 this test is still more bytes than success.
281 this test is still more bytes than success.
275
282
276 Failed test-failure*.t: output changed (glob)
283 Failed test-failure*.t: output changed (glob)
277 Failed test-nothing.t: output changed
284 Failed test-nothing.t: output changed
278 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
285 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
279 python hash seed: * (glob)
286 python hash seed: * (glob)
280 [1]
287 [1]
281
288
282
289
283 (delete the duplicated test file)
290 (delete the duplicated test file)
284 $ rm test-failure-copy.t test-nothing.t
291 $ rm test-failure-copy.t test-nothing.t
285
292
286
293
287 Interactive run
294 Interactive run
288 ===============
295 ===============
289
296
290 (backup the failing test)
297 (backup the failing test)
291 $ cp test-failure.t backup
298 $ cp test-failure.t backup
292
299
293 Refuse the fix
300 Refuse the fix
294
301
295 $ echo 'n' | run-tests.py --with-hg=`which hg` -i
302 $ echo 'n' | rt -i
296
303
297 --- $TESTTMP/test-failure.t
304 --- $TESTTMP/test-failure.t
298 +++ $TESTTMP/test-failure.t.err
305 +++ $TESTTMP/test-failure.t.err
299 @@ -1,4 +1,4 @@
306 @@ -1,4 +1,4 @@
300 $ echo babar
307 $ echo babar
301 - rataxes
308 - rataxes
302 + babar
309 + babar
303 This is a noop statement so that
310 This is a noop statement so that
304 this test is still more bytes than success.
311 this test is still more bytes than success.
305 Accept this change? [n]
312 Accept this change? [n]
306 ERROR: test-failure.t output changed
313 ERROR: test-failure.t output changed
307 !.
314 !.
308 Failed test-failure.t: output changed
315 Failed test-failure.t: output changed
309 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
316 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
310 python hash seed: * (glob)
317 python hash seed: * (glob)
311 [1]
318 [1]
312
319
313 $ cat test-failure.t
320 $ cat test-failure.t
314 $ echo babar
321 $ echo babar
315 rataxes
322 rataxes
316 This is a noop statement so that
323 This is a noop statement so that
317 this test is still more bytes than success.
324 this test is still more bytes than success.
318
325
319 Interactive with custom view
326 Interactive with custom view
320
327
321 $ echo 'n' | run-tests.py --with-hg=`which hg` -i --view echo
328 $ echo 'n' | rt -i --view echo
322 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
329 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
323 Accept this change? [n]* (glob)
330 Accept this change? [n]* (glob)
324 ERROR: test-failure.t output changed
331 ERROR: test-failure.t output changed
325 !.
332 !.
326 Failed test-failure.t: output changed
333 Failed test-failure.t: output changed
327 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
334 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
328 python hash seed: * (glob)
335 python hash seed: * (glob)
329 [1]
336 [1]
330
337
331 View the fix
338 View the fix
332
339
333 $ echo 'y' | run-tests.py --with-hg=`which hg` --view echo
340 $ echo 'y' | rt --view echo
334 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
341 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
335
342
336 ERROR: test-failure.t output changed
343 ERROR: test-failure.t output changed
337 !.
344 !.
338 Failed test-failure.t: output changed
345 Failed test-failure.t: output changed
339 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
346 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
340 python hash seed: * (glob)
347 python hash seed: * (glob)
341 [1]
348 [1]
342
349
343 Accept the fix
350 Accept the fix
344
351
345 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
352 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
346 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
353 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
347 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
354 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
348 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
355 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
349 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
356 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
350 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
357 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
351 $ echo 'y' | run-tests.py --with-hg=`which hg` -i 2>&1 | \
358 $ echo 'y' | rt -i 2>&1
352 > sed -e 's,(glob)$,&<,g'
353
359
354 --- $TESTTMP/test-failure.t
360 --- $TESTTMP/test-failure.t
355 +++ $TESTTMP/test-failure.t.err
361 +++ $TESTTMP/test-failure.t.err
356 @@ -1,9 +1,9 @@
362 @@ -1,9 +1,9 @@
357 $ echo babar
363 $ echo babar
358 - rataxes
364 - rataxes
359 + babar
365 + babar
360 This is a noop statement so that
366 This is a noop statement so that
361 this test is still more bytes than success.
367 this test is still more bytes than success.
362 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
368 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
363 - saved backup bundle to $TESTTMP/foo.hg
369 - saved backup bundle to $TESTTMP/foo.hg
364 + saved backup bundle to $TESTTMP/foo.hg (glob)<
370 + saved backup bundle to $TESTTMP/foo.hg* (glob)
365 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
371 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
366 saved backup bundle to $TESTTMP/foo.hg (glob)<
372 saved backup bundle to $TESTTMP/foo.hg* (glob)
367 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
373 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
368 Accept this change? [n] ..
374 Accept this change? [n] ..
369 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
375 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
370
376
371 $ sed -e 's,(glob)$,&<,g' test-failure.t
377 $ sed -e 's,(glob)$,&<,g' test-failure.t
372 $ echo babar
378 $ echo babar
373 babar
379 babar
374 This is a noop statement so that
380 This is a noop statement so that
375 this test is still more bytes than success.
381 this test is still more bytes than success.
376 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
382 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
377 saved backup bundle to $TESTTMP/foo.hg (glob)<
383 saved backup bundle to $TESTTMP/foo.hg (glob)<
378 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
384 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
379 saved backup bundle to $TESTTMP/foo.hg (glob)<
385 saved backup bundle to $TESTTMP/foo.hg (glob)<
380 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
386 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
381 saved backup bundle to $TESTTMP/*.hg (glob)<
387 saved backup bundle to $TESTTMP/*.hg (glob)<
382
388
383 (reinstall)
389 (reinstall)
384 $ mv backup test-failure.t
390 $ mv backup test-failure.t
385
391
386 No Diff
392 No Diff
387 ===============
393 ===============
388
394
389 $ run-tests.py --with-hg=`which hg` --nodiff
395 $ rt --nodiff
390 !.
396 !.
391 Failed test-failure.t: output changed
397 Failed test-failure.t: output changed
392 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
398 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
393 python hash seed: * (glob)
399 python hash seed: * (glob)
394 [1]
400 [1]
395
401
396 test --tmpdir support
402 test --tmpdir support
397 $ run-tests.py --with-hg=`which hg` --tmpdir=$TESTTMP/keep test-success.t
403 $ rt --tmpdir=$TESTTMP/keep test-success.t
398
404
399 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
405 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
400 Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
406 Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
401 .
407 .
402 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
408 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
403
409
404 timeouts
410 timeouts
405 ========
411 ========
406 $ cat > test-timeout.t <<EOF
412 $ cat > test-timeout.t <<EOF
407 > $ sleep 2
413 > $ sleep 2
408 > $ echo pass
414 > $ echo pass
409 > pass
415 > pass
410 > EOF
416 > EOF
411 > echo '#require slow' > test-slow-timeout.t
417 > echo '#require slow' > test-slow-timeout.t
412 > cat test-timeout.t >> test-slow-timeout.t
418 > cat test-timeout.t >> test-slow-timeout.t
413 $ run-tests.py --with-hg=`which hg` --timeout=1 --slowtimeout=3 \
419 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
414 > test-timeout.t test-slow-timeout.t
415 st
420 st
416 Skipped test-slow-timeout.t: skipped
421 Skipped test-slow-timeout.t: skipped
417 Failed test-timeout.t: timed out
422 Failed test-timeout.t: timed out
418 # Ran 1 tests, 1 skipped, 0 warned, 1 failed.
423 # Ran 1 tests, 1 skipped, 0 warned, 1 failed.
419 python hash seed: * (glob)
424 python hash seed: * (glob)
420 [1]
425 [1]
421 $ run-tests.py --with-hg=`which hg` --timeout=1 --slowtimeout=3 \
426 $ rt --timeout=1 --slowtimeout=3 \
422 > test-timeout.t test-slow-timeout.t --allow-slow-tests
427 > test-timeout.t test-slow-timeout.t --allow-slow-tests
423 .t
428 .t
424 Failed test-timeout.t: timed out
429 Failed test-timeout.t: timed out
425 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
430 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
426 python hash seed: * (glob)
431 python hash seed: * (glob)
427 [1]
432 [1]
428 $ rm test-timeout.t test-slow-timeout.t
433 $ rm test-timeout.t test-slow-timeout.t
429
434
430 test for --time
435 test for --time
431 ==================
436 ==================
432
437
433 $ run-tests.py --with-hg=`which hg` test-success.t --time
438 $ rt test-success.t --time
434 .
439 .
435 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
440 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
436 # Producing time report
441 # Producing time report
437 start end cuser csys real Test
442 start end cuser csys real Test
438 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
443 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
439
444
440 test for --time with --job enabled
445 test for --time with --job enabled
441 ====================================
446 ====================================
442
447
443 $ run-tests.py --with-hg=`which hg` test-success.t --time --jobs 2
448 $ rt test-success.t --time --jobs 2
444 .
449 .
445 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
450 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
446 # Producing time report
451 # Producing time report
447 start end cuser csys real Test
452 start end cuser csys real Test
448 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
453 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
449
454
450 Skips
455 Skips
451 ================
456 ================
452 $ cat > test-skip.t <<EOF
457 $ cat > test-skip.t <<EOF
453 > $ echo xyzzy
458 > $ echo xyzzy
454 > #require false
459 > #require false
455 > EOF
460 > EOF
456 $ run-tests.py --with-hg=`which hg` --nodiff
461 $ rt --nodiff
457 !.s
462 !.s
458 Skipped test-skip.t: skipped
463 Skipped test-skip.t: skipped
459 Failed test-failure.t: output changed
464 Failed test-failure.t: output changed
460 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
465 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
461 python hash seed: * (glob)
466 python hash seed: * (glob)
462 [1]
467 [1]
463
468
464 $ run-tests.py --with-hg=`which hg` --keyword xyzzy
469 $ rt --keyword xyzzy
465 .s
470 .s
466 Skipped test-skip.t: skipped
471 Skipped test-skip.t: skipped
467 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
472 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
468
473
469 Skips with xml
474 Skips with xml
470 $ run-tests.py --with-hg=`which hg` --keyword xyzzy \
475 $ rt --keyword xyzzy \
471 > --xunit=xunit.xml
476 > --xunit=xunit.xml
472 .s
477 .s
473 Skipped test-skip.t: skipped
478 Skipped test-skip.t: skipped
474 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
479 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
475 $ cat xunit.xml
480 $ cat xunit.xml
476 <?xml version="1.0" encoding="utf-8"?>
481 <?xml version="1.0" encoding="utf-8"?>
477 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
482 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
478 <testcase name="test-success.t" time="*"/> (glob)
483 <testcase name="test-success.t" time="*"/> (glob)
479 </testsuite>
484 </testsuite>
480
485
481 Missing skips or blacklisted skips don't count as executed:
486 Missing skips or blacklisted skips don't count as executed:
482 $ echo test-failure.t > blacklist
487 $ echo test-failure.t > blacklist
483 $ run-tests.py --with-hg=`which hg` --blacklist=blacklist \
488 $ rt --blacklist=blacklist \
484 > test-failure.t test-bogus.t
489 > test-failure.t test-bogus.t
485 ss
490 ss
486 Skipped test-bogus.t: Doesn't exist
491 Skipped test-bogus.t: Doesn't exist
487 Skipped test-failure.t: blacklisted
492 Skipped test-failure.t: blacklisted
488 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
493 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
489
494
490 #if json
495 #if json
491
496
492 test for --json
497 test for --json
493 ==================
498 ==================
494
499
495 $ run-tests.py --with-hg=`which hg` --json
500 $ rt --json
496
501
497 --- $TESTTMP/test-failure.t
502 --- $TESTTMP/test-failure.t
498 +++ $TESTTMP/test-failure.t.err
503 +++ $TESTTMP/test-failure.t.err
499 @@ -1,4 +1,4 @@
504 @@ -1,4 +1,4 @@
500 $ echo babar
505 $ echo babar
501 - rataxes
506 - rataxes
502 + babar
507 + babar
503 This is a noop statement so that
508 This is a noop statement so that
504 this test is still more bytes than success.
509 this test is still more bytes than success.
505
510
506 ERROR: test-failure.t output changed
511 ERROR: test-failure.t output changed
507 !.s
512 !.s
508 Skipped test-skip.t: skipped
513 Skipped test-skip.t: skipped
509 Failed test-failure.t: output changed
514 Failed test-failure.t: output changed
510 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
515 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
511 python hash seed: * (glob)
516 python hash seed: * (glob)
512 [1]
517 [1]
513
518
514 $ cat report.json
519 $ cat report.json
515 testreport ={
520 testreport ={
516 "test-failure.t": [\{] (re)
521 "test-failure.t": [\{] (re)
517 "csys": "\s*[\d\.]{4,5}", ? (re)
522 "csys": "\s*[\d\.]{4,5}", ? (re)
518 "cuser": "\s*[\d\.]{4,5}", ? (re)
523 "cuser": "\s*[\d\.]{4,5}", ? (re)
519 "end": "\s*[\d\.]{4,5}", ? (re)
524 "end": "\s*[\d\.]{4,5}", ? (re)
520 "result": "failure", ? (re)
525 "result": "failure", ? (re)
521 "start": "\s*[\d\.]{4,5}", ? (re)
526 "start": "\s*[\d\.]{4,5}", ? (re)
522 "time": "\s*[\d\.]{4,5}" (re)
527 "time": "\s*[\d\.]{4,5}" (re)
523 }, ? (re)
528 }, ? (re)
524 "test-skip.t": {
529 "test-skip.t": {
525 "csys": "\s*[\d\.]{4,5}", ? (re)
530 "csys": "\s*[\d\.]{4,5}", ? (re)
526 "cuser": "\s*[\d\.]{4,5}", ? (re)
531 "cuser": "\s*[\d\.]{4,5}", ? (re)
527 "end": "\s*[\d\.]{4,5}", ? (re)
532 "end": "\s*[\d\.]{4,5}", ? (re)
528 "result": "skip", ? (re)
533 "result": "skip", ? (re)
529 "start": "\s*[\d\.]{4,5}", ? (re)
534 "start": "\s*[\d\.]{4,5}", ? (re)
530 "time": "\s*[\d\.]{4,5}" (re)
535 "time": "\s*[\d\.]{4,5}" (re)
531 }, ? (re)
536 }, ? (re)
532 "test-success.t": [\{] (re)
537 "test-success.t": [\{] (re)
533 "csys": "\s*[\d\.]{4,5}", ? (re)
538 "csys": "\s*[\d\.]{4,5}", ? (re)
534 "cuser": "\s*[\d\.]{4,5}", ? (re)
539 "cuser": "\s*[\d\.]{4,5}", ? (re)
535 "end": "\s*[\d\.]{4,5}", ? (re)
540 "end": "\s*[\d\.]{4,5}", ? (re)
536 "result": "success", ? (re)
541 "result": "success", ? (re)
537 "start": "\s*[\d\.]{4,5}", ? (re)
542 "start": "\s*[\d\.]{4,5}", ? (re)
538 "time": "\s*[\d\.]{4,5}" (re)
543 "time": "\s*[\d\.]{4,5}" (re)
539 }
544 }
540 } (no-eol)
545 } (no-eol)
541
546
542 Test that failed test accepted through interactive are properly reported:
547 Test that failed test accepted through interactive are properly reported:
543
548
544 $ cp test-failure.t backup
549 $ cp test-failure.t backup
545 $ echo y | run-tests.py --with-hg=`which hg` --json -i
550 $ echo y | rt --json -i
546
551
547 --- $TESTTMP/test-failure.t
552 --- $TESTTMP/test-failure.t
548 +++ $TESTTMP/test-failure.t.err
553 +++ $TESTTMP/test-failure.t.err
549 @@ -1,4 +1,4 @@
554 @@ -1,4 +1,4 @@
550 $ echo babar
555 $ echo babar
551 - rataxes
556 - rataxes
552 + babar
557 + babar
553 This is a noop statement so that
558 This is a noop statement so that
554 this test is still more bytes than success.
559 this test is still more bytes than success.
555 Accept this change? [n] ..s
560 Accept this change? [n] ..s
556 Skipped test-skip.t: skipped
561 Skipped test-skip.t: skipped
557 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
562 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
558
563
559 $ cat report.json
564 $ cat report.json
560 testreport ={
565 testreport ={
561 "test-failure.t": [\{] (re)
566 "test-failure.t": [\{] (re)
562 "csys": "\s*[\d\.]{4,5}", ? (re)
567 "csys": "\s*[\d\.]{4,5}", ? (re)
563 "cuser": "\s*[\d\.]{4,5}", ? (re)
568 "cuser": "\s*[\d\.]{4,5}", ? (re)
564 "end": "\s*[\d\.]{4,5}", ? (re)
569 "end": "\s*[\d\.]{4,5}", ? (re)
565 "result": "success", ? (re)
570 "result": "success", ? (re)
566 "start": "\s*[\d\.]{4,5}", ? (re)
571 "start": "\s*[\d\.]{4,5}", ? (re)
567 "time": "\s*[\d\.]{4,5}" (re)
572 "time": "\s*[\d\.]{4,5}" (re)
568 }, ? (re)
573 }, ? (re)
569 "test-skip.t": {
574 "test-skip.t": {
570 "csys": "\s*[\d\.]{4,5}", ? (re)
575 "csys": "\s*[\d\.]{4,5}", ? (re)
571 "cuser": "\s*[\d\.]{4,5}", ? (re)
576 "cuser": "\s*[\d\.]{4,5}", ? (re)
572 "end": "\s*[\d\.]{4,5}", ? (re)
577 "end": "\s*[\d\.]{4,5}", ? (re)
573 "result": "skip", ? (re)
578 "result": "skip", ? (re)
574 "start": "\s*[\d\.]{4,5}", ? (re)
579 "start": "\s*[\d\.]{4,5}", ? (re)
575 "time": "\s*[\d\.]{4,5}" (re)
580 "time": "\s*[\d\.]{4,5}" (re)
576 }, ? (re)
581 }, ? (re)
577 "test-success.t": [\{] (re)
582 "test-success.t": [\{] (re)
578 "csys": "\s*[\d\.]{4,5}", ? (re)
583 "csys": "\s*[\d\.]{4,5}", ? (re)
579 "cuser": "\s*[\d\.]{4,5}", ? (re)
584 "cuser": "\s*[\d\.]{4,5}", ? (re)
580 "end": "\s*[\d\.]{4,5}", ? (re)
585 "end": "\s*[\d\.]{4,5}", ? (re)
581 "result": "success", ? (re)
586 "result": "success", ? (re)
582 "start": "\s*[\d\.]{4,5}", ? (re)
587 "start": "\s*[\d\.]{4,5}", ? (re)
583 "time": "\s*[\d\.]{4,5}" (re)
588 "time": "\s*[\d\.]{4,5}" (re)
584 }
589 }
585 } (no-eol)
590 } (no-eol)
586 $ mv backup test-failure.t
591 $ mv backup test-failure.t
587
592
588 #endif
593 #endif
589
594
590 backslash on end of line with glob matching is handled properly
595 backslash on end of line with glob matching is handled properly
591
596
592 $ cat > test-glob-backslash.t << EOF
597 $ cat > test-glob-backslash.t << EOF
593 > $ echo 'foo bar \\'
598 > $ echo 'foo bar \\'
594 > foo * \ (glob)
599 > foo * \ (glob)
595 > EOF
600 > EOF
596
601
597 $ run-tests.py --with-hg=`which hg` test-glob-backslash.t
602 $ rt test-glob-backslash.t
598 .
603 .
599 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
604 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
600
605
601 $ rm -f test-glob-backslash.t
606 $ rm -f test-glob-backslash.t
602
607
603 Test reusability for third party tools
608 Test reusability for third party tools
604 ======================================
609 ======================================
605
610
606 $ mkdir "$TESTTMP"/anothertests
611 $ mkdir "$TESTTMP"/anothertests
607 $ cd "$TESTTMP"/anothertests
612 $ cd "$TESTTMP"/anothertests
608
613
609 test that `run-tests.py` can execute hghave, even if it runs not in
614 test that `run-tests.py` can execute hghave, even if it runs not in
610 Mercurial source tree.
615 Mercurial source tree.
611
616
612 $ cat > test-hghave.t <<EOF
617 $ cat > test-hghave.t <<EOF
613 > #require true
618 > #require true
614 > $ echo foo
619 > $ echo foo
615 > foo
620 > foo
616 > EOF
621 > EOF
617 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-hghave.t
622 $ rt $HGTEST_RUN_TESTS_PURE test-hghave.t
618 .
623 .
619 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
624 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
620
625
621 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
626 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
622 running is placed.
627 running is placed.
623
628
624 $ cat > test-runtestdir.t <<EOF
629 $ cat > test-runtestdir.t <<EOF
625 > - $TESTDIR, in which test-run-tests.t is placed
630 > - $TESTDIR, in which test-run-tests.t is placed
626 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
631 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
627 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
632 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
628 >
633 >
629 > #if windows
634 > #if windows
630 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
635 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
631 > #else
636 > #else
632 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
637 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
633 > #endif
638 > #endif
634 > $ test "\$RUNTESTDIR" = "$TESTDIR"
639 > $ test "\$RUNTESTDIR" = "$TESTDIR"
635 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
640 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
636 > #!/usr/bin/env python
641 > #!/usr/bin/env python
637 > #
642 > #
638 > # check-code - a style and portability checker for Mercurial
643 > # check-code - a style and portability checker for Mercurial
639 > EOF
644 > EOF
640 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-runtestdir.t
645 $ rt $HGTEST_RUN_TESTS_PURE test-runtestdir.t
641 .
646 .
642 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
647 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
643
648
644 #if execbit
649 #if execbit
645
650
646 test that TESTDIR is referred in PATH
651 test that TESTDIR is referred in PATH
647
652
648 $ cat > custom-command.sh <<EOF
653 $ cat > custom-command.sh <<EOF
649 > #!/bin/sh
654 > #!/bin/sh
650 > echo "hello world"
655 > echo "hello world"
651 > EOF
656 > EOF
652 $ chmod +x custom-command.sh
657 $ chmod +x custom-command.sh
653 $ cat > test-testdir-path.t <<EOF
658 $ cat > test-testdir-path.t <<EOF
654 > $ custom-command.sh
659 > $ custom-command.sh
655 > hello world
660 > hello world
656 > EOF
661 > EOF
657 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-testdir-path.t
662 $ rt $HGTEST_RUN_TESTS_PURE test-testdir-path.t
658 .
663 .
659 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
664 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
660
665
661 #endif
666 #endif
662
667
663 test support for --allow-slow-tests
668 test support for --allow-slow-tests
664 $ cat > test-very-slow-test.t <<EOF
669 $ cat > test-very-slow-test.t <<EOF
665 > #require slow
670 > #require slow
666 > $ echo pass
671 > $ echo pass
667 > pass
672 > pass
668 > EOF
673 > EOF
669 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-very-slow-test.t
674 $ rt $HGTEST_RUN_TESTS_PURE test-very-slow-test.t
670 s
675 s
671 Skipped test-very-slow-test.t: skipped
676 Skipped test-very-slow-test.t: skipped
672 # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
677 # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
673 $ run-tests.py $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
678 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
674 .
679 .
675 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
680 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
General Comments 0
You need to be logged in to leave comments. Login now