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