##// END OF EJS Templates
tests: ensure run-tests handles multiple lines of churn...
timeless -
r28619:695c666f default
parent child Browse files
Show More
@@ -1,793 +1,817 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 error paths
24 error paths
25
25
26 #if symlink
26 #if symlink
27 $ ln -s `which true` hg
27 $ ln -s `which true` hg
28 $ run-tests.py --with-hg=./hg
28 $ run-tests.py --with-hg=./hg
29 warning: --with-hg should specify an hg script
29 warning: --with-hg should specify an hg script
30
30
31 # Ran 0 tests, 0 skipped, 0 warned, 0 failed.
31 # Ran 0 tests, 0 skipped, 0 warned, 0 failed.
32 $ rm hg
32 $ rm hg
33 #endif
33 #endif
34
34
35 #if execbit
35 #if execbit
36 $ touch hg
36 $ touch hg
37 $ run-tests.py --with-hg=./hg
37 $ run-tests.py --with-hg=./hg
38 Usage: run-tests.py [options] [tests]
38 Usage: run-tests.py [options] [tests]
39
39
40 run-tests.py: error: --with-hg must specify an executable hg script
40 run-tests.py: error: --with-hg must specify an executable hg script
41 [2]
41 [2]
42 $ rm hg
42 $ rm hg
43 #endif
43 #endif
44
44
45 a succesful test
45 a succesful test
46 =======================
46 =======================
47
47
48 $ cat > test-success.t << EOF
48 $ cat > test-success.t << EOF
49 > $ echo babar
49 > $ echo babar
50 > babar
50 > babar
51 > $ echo xyzzy
51 > $ echo xyzzy
52 > never happens (?)
52 > never happens (?)
53 > xyzzy
53 > xyzzy
54 > nor this (?)
54 > nor this (?)
55 > $ printf 'abc\ndef\nxyz\n'
55 > $ printf 'abc\ndef\nxyz\n'
56 > 123 (?)
56 > 123 (?)
57 > abc
57 > abc
58 > def (?)
58 > def (?)
59 > 456 (?)
59 > 456 (?)
60 > xyz
60 > xyz
61 > EOF
61 > EOF
62
62
63 $ rt
63 $ rt
64 .
64 .
65 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
65 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
66
66
67 failing test
67 failing test
68 ==================
68 ==================
69
69
70 test churn with globs
71 $ cat > test-failure.t <<EOF
72 > $ echo "bar-baz"; echo "bar-bad"
73 > bar*bad (glob)
74 > bar*baz (glob)
75 > EOF
76 $ rt test-failure.t
77
78 --- $TESTTMP/test-failure.t
79 +++ $TESTTMP/test-failure.t.err
80 @@ -1,3 +1,3 @@
81 $ echo "bar-baz"; echo "bar-bad"
82 + bar*baz (glob)
83 bar*bad (glob)
84 - bar*baz (glob)
85
86 ERROR: test-failure.t output changed
87 !
88 Failed test-failure.t: output changed
89 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
90 python hash seed: * (glob)
91 [1]
92
93 basic failing test
70 $ cat > test-failure.t << EOF
94 $ cat > test-failure.t << EOF
71 > $ echo babar
95 > $ echo babar
72 > rataxes
96 > rataxes
73 > This is a noop statement so that
97 > This is a noop statement so that
74 > this test is still more bytes than success.
98 > this test is still more bytes than success.
75 > pad pad pad pad............................................................
99 > pad pad pad pad............................................................
76 > pad pad pad pad............................................................
100 > pad pad pad pad............................................................
77 > EOF
101 > EOF
78
102
79 >>> fh = open('test-failure-unicode.t', 'wb')
103 >>> fh = open('test-failure-unicode.t', 'wb')
80 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
104 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
81 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
105 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
82
106
83 $ rt
107 $ rt
84
108
85 --- $TESTTMP/test-failure.t
109 --- $TESTTMP/test-failure.t
86 +++ $TESTTMP/test-failure.t.err
110 +++ $TESTTMP/test-failure.t.err
87 @@ -1,5 +1,5 @@
111 @@ -1,5 +1,5 @@
88 $ echo babar
112 $ echo babar
89 - rataxes
113 - rataxes
90 + babar
114 + babar
91 This is a noop statement so that
115 This is a noop statement so that
92 this test is still more bytes than success.
116 this test is still more bytes than success.
93 pad pad pad pad............................................................
117 pad pad pad pad............................................................
94
118
95 ERROR: test-failure.t output changed
119 ERROR: test-failure.t output changed
96 !.
120 !.
97 --- $TESTTMP/test-failure-unicode.t
121 --- $TESTTMP/test-failure-unicode.t
98 +++ $TESTTMP/test-failure-unicode.t.err
122 +++ $TESTTMP/test-failure-unicode.t.err
99 @@ -1,2 +1,2 @@
123 @@ -1,2 +1,2 @@
100 $ echo babar\xce\xb1 (esc)
124 $ echo babar\xce\xb1 (esc)
101 - l\xce\xb5\xce\xb5t (esc)
125 - l\xce\xb5\xce\xb5t (esc)
102 + babar\xce\xb1 (esc)
126 + babar\xce\xb1 (esc)
103
127
104 ERROR: test-failure-unicode.t output changed
128 ERROR: test-failure-unicode.t output changed
105 !
129 !
106 Failed test-failure.t: output changed
130 Failed test-failure.t: output changed
107 Failed test-failure-unicode.t: output changed
131 Failed test-failure-unicode.t: output changed
108 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
132 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
109 python hash seed: * (glob)
133 python hash seed: * (glob)
110 [1]
134 [1]
111
135
112 test --xunit support
136 test --xunit support
113 $ rt --xunit=xunit.xml
137 $ rt --xunit=xunit.xml
114
138
115 --- $TESTTMP/test-failure.t
139 --- $TESTTMP/test-failure.t
116 +++ $TESTTMP/test-failure.t.err
140 +++ $TESTTMP/test-failure.t.err
117 @@ -1,5 +1,5 @@
141 @@ -1,5 +1,5 @@
118 $ echo babar
142 $ echo babar
119 - rataxes
143 - rataxes
120 + babar
144 + babar
121 This is a noop statement so that
145 This is a noop statement so that
122 this test is still more bytes than success.
146 this test is still more bytes than success.
123 pad pad pad pad............................................................
147 pad pad pad pad............................................................
124
148
125 ERROR: test-failure.t output changed
149 ERROR: test-failure.t output changed
126 !.
150 !.
127 --- $TESTTMP/test-failure-unicode.t
151 --- $TESTTMP/test-failure-unicode.t
128 +++ $TESTTMP/test-failure-unicode.t.err
152 +++ $TESTTMP/test-failure-unicode.t.err
129 @@ -1,2 +1,2 @@
153 @@ -1,2 +1,2 @@
130 $ echo babar\xce\xb1 (esc)
154 $ echo babar\xce\xb1 (esc)
131 - l\xce\xb5\xce\xb5t (esc)
155 - l\xce\xb5\xce\xb5t (esc)
132 + babar\xce\xb1 (esc)
156 + babar\xce\xb1 (esc)
133
157
134 ERROR: test-failure-unicode.t output changed
158 ERROR: test-failure-unicode.t output changed
135 !
159 !
136 Failed test-failure.t: output changed
160 Failed test-failure.t: output changed
137 Failed test-failure-unicode.t: output changed
161 Failed test-failure-unicode.t: output changed
138 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
162 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
139 python hash seed: * (glob)
163 python hash seed: * (glob)
140 [1]
164 [1]
141 $ cat xunit.xml
165 $ cat xunit.xml
142 <?xml version="1.0" encoding="utf-8"?>
166 <?xml version="1.0" encoding="utf-8"?>
143 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
167 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
144 <testcase name="test-success.t" time="*"/> (glob)
168 <testcase name="test-success.t" time="*"/> (glob)
145 <testcase name="test-failure-unicode.t" time="*"> (glob)
169 <testcase name="test-failure-unicode.t" time="*"> (glob)
146 <![CDATA[--- $TESTTMP/test-failure-unicode.t
170 <![CDATA[--- $TESTTMP/test-failure-unicode.t
147 +++ $TESTTMP/test-failure-unicode.t.err
171 +++ $TESTTMP/test-failure-unicode.t.err
148 @@ -1,2 +1,2 @@
172 @@ -1,2 +1,2 @@
149 $ echo babar\xce\xb1 (esc)
173 $ echo babar\xce\xb1 (esc)
150 - l\xce\xb5\xce\xb5t (esc)
174 - l\xce\xb5\xce\xb5t (esc)
151 + babar\xce\xb1 (esc)
175 + babar\xce\xb1 (esc)
152 ]]> </testcase>
176 ]]> </testcase>
153 <testcase name="test-failure.t" time="*"> (glob)
177 <testcase name="test-failure.t" time="*"> (glob)
154 <![CDATA[--- $TESTTMP/test-failure.t
178 <![CDATA[--- $TESTTMP/test-failure.t
155 +++ $TESTTMP/test-failure.t.err
179 +++ $TESTTMP/test-failure.t.err
156 @@ -1,5 +1,5 @@
180 @@ -1,5 +1,5 @@
157 $ echo babar
181 $ echo babar
158 - rataxes
182 - rataxes
159 + babar
183 + babar
160 This is a noop statement so that
184 This is a noop statement so that
161 this test is still more bytes than success.
185 this test is still more bytes than success.
162 pad pad pad pad............................................................
186 pad pad pad pad............................................................
163 ]]> </testcase>
187 ]]> </testcase>
164 </testsuite>
188 </testsuite>
165
189
166 $ rm test-failure-unicode.t
190 $ rm test-failure-unicode.t
167
191
168 test for --retest
192 test for --retest
169 ====================
193 ====================
170
194
171 $ rt --retest
195 $ rt --retest
172
196
173 --- $TESTTMP/test-failure.t
197 --- $TESTTMP/test-failure.t
174 +++ $TESTTMP/test-failure.t.err
198 +++ $TESTTMP/test-failure.t.err
175 @@ -1,5 +1,5 @@
199 @@ -1,5 +1,5 @@
176 $ echo babar
200 $ echo babar
177 - rataxes
201 - rataxes
178 + babar
202 + babar
179 This is a noop statement so that
203 This is a noop statement so that
180 this test is still more bytes than success.
204 this test is still more bytes than success.
181 pad pad pad pad............................................................
205 pad pad pad pad............................................................
182
206
183 ERROR: test-failure.t output changed
207 ERROR: test-failure.t output changed
184 !
208 !
185 Failed test-failure.t: output changed
209 Failed test-failure.t: output changed
186 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
210 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
187 python hash seed: * (glob)
211 python hash seed: * (glob)
188 [1]
212 [1]
189
213
190 Selecting Tests To Run
214 Selecting Tests To Run
191 ======================
215 ======================
192
216
193 successful
217 successful
194
218
195 $ rt test-success.t
219 $ rt test-success.t
196 .
220 .
197 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
221 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
198
222
199 success w/ keyword
223 success w/ keyword
200 $ rt -k xyzzy
224 $ rt -k xyzzy
201 .
225 .
202 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
226 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
203
227
204 failed
228 failed
205
229
206 $ rt test-failure.t
230 $ rt test-failure.t
207
231
208 --- $TESTTMP/test-failure.t
232 --- $TESTTMP/test-failure.t
209 +++ $TESTTMP/test-failure.t.err
233 +++ $TESTTMP/test-failure.t.err
210 @@ -1,5 +1,5 @@
234 @@ -1,5 +1,5 @@
211 $ echo babar
235 $ echo babar
212 - rataxes
236 - rataxes
213 + babar
237 + babar
214 This is a noop statement so that
238 This is a noop statement so that
215 this test is still more bytes than success.
239 this test is still more bytes than success.
216 pad pad pad pad............................................................
240 pad pad pad pad............................................................
217
241
218 ERROR: test-failure.t output changed
242 ERROR: test-failure.t output changed
219 !
243 !
220 Failed test-failure.t: output changed
244 Failed test-failure.t: output changed
221 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
245 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
222 python hash seed: * (glob)
246 python hash seed: * (glob)
223 [1]
247 [1]
224
248
225 failure w/ keyword
249 failure w/ keyword
226 $ rt -k rataxes
250 $ rt -k rataxes
227
251
228 --- $TESTTMP/test-failure.t
252 --- $TESTTMP/test-failure.t
229 +++ $TESTTMP/test-failure.t.err
253 +++ $TESTTMP/test-failure.t.err
230 @@ -1,5 +1,5 @@
254 @@ -1,5 +1,5 @@
231 $ echo babar
255 $ echo babar
232 - rataxes
256 - rataxes
233 + babar
257 + babar
234 This is a noop statement so that
258 This is a noop statement so that
235 this test is still more bytes than success.
259 this test is still more bytes than success.
236 pad pad pad pad............................................................
260 pad pad pad pad............................................................
237
261
238 ERROR: test-failure.t output changed
262 ERROR: test-failure.t output changed
239 !
263 !
240 Failed test-failure.t: output changed
264 Failed test-failure.t: output changed
241 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
265 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
242 python hash seed: * (glob)
266 python hash seed: * (glob)
243 [1]
267 [1]
244
268
245 Verify that when a process fails to start we show a useful message
269 Verify that when a process fails to start we show a useful message
246 ==================================================================
270 ==================================================================
247
271
248 $ cat > test-serve-fail.t <<EOF
272 $ cat > test-serve-fail.t <<EOF
249 > $ echo 'abort: child process failed to start blah'
273 > $ echo 'abort: child process failed to start blah'
250 > EOF
274 > EOF
251 $ rt test-serve-fail.t
275 $ rt test-serve-fail.t
252
276
253 ERROR: test-serve-fail.t output changed
277 ERROR: test-serve-fail.t output changed
254 !
278 !
255 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
279 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
256 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
280 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
257 python hash seed: * (glob)
281 python hash seed: * (glob)
258 [1]
282 [1]
259 $ rm test-serve-fail.t
283 $ rm test-serve-fail.t
260
284
261 Verify that we can try other ports
285 Verify that we can try other ports
262 ===================================
286 ===================================
263 $ hg init inuse
287 $ hg init inuse
264 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
288 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
265 $ cat blocks.pid >> $DAEMON_PIDS
289 $ cat blocks.pid >> $DAEMON_PIDS
266 $ cat > test-serve-inuse.t <<EOF
290 $ cat > test-serve-inuse.t <<EOF
267 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
291 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
268 > $ cat hg.pid >> \$DAEMON_PIDS
292 > $ cat hg.pid >> \$DAEMON_PIDS
269 > EOF
293 > EOF
270 $ rt test-serve-inuse.t
294 $ rt test-serve-inuse.t
271 .
295 .
272 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
296 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
273 $ rm test-serve-inuse.t
297 $ rm test-serve-inuse.t
274
298
275 Running In Debug Mode
299 Running In Debug Mode
276 ======================
300 ======================
277
301
278 $ rt --debug 2>&1 | grep -v pwd
302 $ rt --debug 2>&1 | grep -v pwd
279 + echo *SALT* 0 0 (glob)
303 + echo *SALT* 0 0 (glob)
280 *SALT* 0 0 (glob)
304 *SALT* 0 0 (glob)
281 + echo babar
305 + echo babar
282 babar
306 babar
283 + echo *SALT* 6 0 (glob)
307 + echo *SALT* 6 0 (glob)
284 *SALT* 6 0 (glob)
308 *SALT* 6 0 (glob)
285 *+ echo *SALT* 0 0 (glob)
309 *+ echo *SALT* 0 0 (glob)
286 *SALT* 0 0 (glob)
310 *SALT* 0 0 (glob)
287 + echo babar
311 + echo babar
288 babar
312 babar
289 + echo *SALT* 2 0 (glob)
313 + echo *SALT* 2 0 (glob)
290 *SALT* 2 0 (glob)
314 *SALT* 2 0 (glob)
291 + echo xyzzy
315 + echo xyzzy
292 xyzzy
316 xyzzy
293 + echo *SALT* 6 0 (glob)
317 + echo *SALT* 6 0 (glob)
294 *SALT* 6 0 (glob)
318 *SALT* 6 0 (glob)
295 + printf *abc\ndef\nxyz\n* (glob)
319 + printf *abc\ndef\nxyz\n* (glob)
296 abc
320 abc
297 def
321 def
298 xyz
322 xyz
299 + echo *SALT* 12 0 (glob)
323 + echo *SALT* 12 0 (glob)
300 *SALT* 12 0 (glob)
324 *SALT* 12 0 (glob)
301 .
325 .
302 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
326 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
303
327
304 Parallel runs
328 Parallel runs
305 ==============
329 ==============
306
330
307 (duplicate the failing test to get predictable output)
331 (duplicate the failing test to get predictable output)
308 $ cp test-failure.t test-failure-copy.t
332 $ cp test-failure.t test-failure-copy.t
309
333
310 $ rt --jobs 2 test-failure*.t -n
334 $ rt --jobs 2 test-failure*.t -n
311 !!
335 !!
312 Failed test-failure*.t: output changed (glob)
336 Failed test-failure*.t: output changed (glob)
313 Failed test-failure*.t: output changed (glob)
337 Failed test-failure*.t: output changed (glob)
314 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
338 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
315 python hash seed: * (glob)
339 python hash seed: * (glob)
316 [1]
340 [1]
317
341
318 failures in parallel with --first should only print one failure
342 failures in parallel with --first should only print one failure
319 >>> f = open('test-nothing.t', 'w')
343 >>> f = open('test-nothing.t', 'w')
320 >>> f.write('foo\n' * 1024) and None
344 >>> f.write('foo\n' * 1024) and None
321 >>> f.write(' $ sleep 1') and None
345 >>> f.write(' $ sleep 1') and None
322 $ rt --jobs 2 --first
346 $ rt --jobs 2 --first
323
347
324 --- $TESTTMP/test-failure*.t (glob)
348 --- $TESTTMP/test-failure*.t (glob)
325 +++ $TESTTMP/test-failure*.t.err (glob)
349 +++ $TESTTMP/test-failure*.t.err (glob)
326 @@ -1,5 +1,5 @@
350 @@ -1,5 +1,5 @@
327 $ echo babar
351 $ echo babar
328 - rataxes
352 - rataxes
329 + babar
353 + babar
330 This is a noop statement so that
354 This is a noop statement so that
331 this test is still more bytes than success.
355 this test is still more bytes than success.
332 pad pad pad pad............................................................
356 pad pad pad pad............................................................
333
357
334 Failed test-failure*.t: output changed (glob)
358 Failed test-failure*.t: output changed (glob)
335 Failed test-nothing.t: output changed
359 Failed test-nothing.t: output changed
336 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
360 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
337 python hash seed: * (glob)
361 python hash seed: * (glob)
338 [1]
362 [1]
339
363
340
364
341 (delete the duplicated test file)
365 (delete the duplicated test file)
342 $ rm test-failure-copy.t test-nothing.t
366 $ rm test-failure-copy.t test-nothing.t
343
367
344
368
345 Interactive run
369 Interactive run
346 ===============
370 ===============
347
371
348 (backup the failing test)
372 (backup the failing test)
349 $ cp test-failure.t backup
373 $ cp test-failure.t backup
350
374
351 Refuse the fix
375 Refuse the fix
352
376
353 $ echo 'n' | rt -i
377 $ echo 'n' | rt -i
354
378
355 --- $TESTTMP/test-failure.t
379 --- $TESTTMP/test-failure.t
356 +++ $TESTTMP/test-failure.t.err
380 +++ $TESTTMP/test-failure.t.err
357 @@ -1,5 +1,5 @@
381 @@ -1,5 +1,5 @@
358 $ echo babar
382 $ echo babar
359 - rataxes
383 - rataxes
360 + babar
384 + babar
361 This is a noop statement so that
385 This is a noop statement so that
362 this test is still more bytes than success.
386 this test is still more bytes than success.
363 pad pad pad pad............................................................
387 pad pad pad pad............................................................
364 Accept this change? [n]
388 Accept this change? [n]
365 ERROR: test-failure.t output changed
389 ERROR: test-failure.t output changed
366 !.
390 !.
367 Failed test-failure.t: output changed
391 Failed test-failure.t: output changed
368 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
392 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
369 python hash seed: * (glob)
393 python hash seed: * (glob)
370 [1]
394 [1]
371
395
372 $ cat test-failure.t
396 $ cat test-failure.t
373 $ echo babar
397 $ echo babar
374 rataxes
398 rataxes
375 This is a noop statement so that
399 This is a noop statement so that
376 this test is still more bytes than success.
400 this test is still more bytes than success.
377 pad pad pad pad............................................................
401 pad pad pad pad............................................................
378 pad pad pad pad............................................................
402 pad pad pad pad............................................................
379
403
380 Interactive with custom view
404 Interactive with custom view
381
405
382 $ echo 'n' | rt -i --view echo
406 $ echo 'n' | rt -i --view echo
383 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
407 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
384 Accept this change? [n]* (glob)
408 Accept this change? [n]* (glob)
385 ERROR: test-failure.t output changed
409 ERROR: test-failure.t output changed
386 !.
410 !.
387 Failed test-failure.t: output changed
411 Failed test-failure.t: output changed
388 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
412 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
389 python hash seed: * (glob)
413 python hash seed: * (glob)
390 [1]
414 [1]
391
415
392 View the fix
416 View the fix
393
417
394 $ echo 'y' | rt --view echo
418 $ echo 'y' | rt --view echo
395 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
419 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
396
420
397 ERROR: test-failure.t output changed
421 ERROR: test-failure.t output changed
398 !.
422 !.
399 Failed test-failure.t: output changed
423 Failed test-failure.t: output changed
400 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
424 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
401 python hash seed: * (glob)
425 python hash seed: * (glob)
402 [1]
426 [1]
403
427
404 Accept the fix
428 Accept the fix
405
429
406 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
430 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
407 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
431 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
408 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
432 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
409 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
433 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
410 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
434 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
411 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
435 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
412 $ echo 'y' | rt -i 2>&1
436 $ echo 'y' | rt -i 2>&1
413
437
414 --- $TESTTMP/test-failure.t
438 --- $TESTTMP/test-failure.t
415 +++ $TESTTMP/test-failure.t.err
439 +++ $TESTTMP/test-failure.t.err
416 @@ -1,11 +1,11 @@
440 @@ -1,11 +1,11 @@
417 $ echo babar
441 $ echo babar
418 - rataxes
442 - rataxes
419 + babar
443 + babar
420 This is a noop statement so that
444 This is a noop statement so that
421 this test is still more bytes than success.
445 this test is still more bytes than success.
422 pad pad pad pad............................................................
446 pad pad pad pad............................................................
423 pad pad pad pad............................................................
447 pad pad pad pad............................................................
424 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
448 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
425 - saved backup bundle to $TESTTMP/foo.hg
449 - saved backup bundle to $TESTTMP/foo.hg
426 + saved backup bundle to $TESTTMP/foo.hg* (glob)
450 + saved backup bundle to $TESTTMP/foo.hg* (glob)
427 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
451 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
428 saved backup bundle to $TESTTMP/foo.hg* (glob)
452 saved backup bundle to $TESTTMP/foo.hg* (glob)
429 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
453 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
430 Accept this change? [n] ..
454 Accept this change? [n] ..
431 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
455 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
432
456
433 $ sed -e 's,(glob)$,&<,g' test-failure.t
457 $ sed -e 's,(glob)$,&<,g' test-failure.t
434 $ echo babar
458 $ echo babar
435 babar
459 babar
436 This is a noop statement so that
460 This is a noop statement so that
437 this test is still more bytes than success.
461 this test is still more bytes than success.
438 pad pad pad pad............................................................
462 pad pad pad pad............................................................
439 pad pad pad pad............................................................
463 pad pad pad pad............................................................
440 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
464 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
441 saved backup bundle to $TESTTMP/foo.hg (glob)<
465 saved backup bundle to $TESTTMP/foo.hg (glob)<
442 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
466 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
443 saved backup bundle to $TESTTMP/foo.hg (glob)<
467 saved backup bundle to $TESTTMP/foo.hg (glob)<
444 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
468 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
445 saved backup bundle to $TESTTMP/*.hg (glob)<
469 saved backup bundle to $TESTTMP/*.hg (glob)<
446
470
447 (reinstall)
471 (reinstall)
448 $ mv backup test-failure.t
472 $ mv backup test-failure.t
449
473
450 No Diff
474 No Diff
451 ===============
475 ===============
452
476
453 $ rt --nodiff
477 $ rt --nodiff
454 !.
478 !.
455 Failed test-failure.t: output changed
479 Failed test-failure.t: output changed
456 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
480 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
457 python hash seed: * (glob)
481 python hash seed: * (glob)
458 [1]
482 [1]
459
483
460 test --tmpdir support
484 test --tmpdir support
461 $ rt --tmpdir=$TESTTMP/keep test-success.t
485 $ rt --tmpdir=$TESTTMP/keep test-success.t
462
486
463 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
487 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
464 Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
488 Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
465 .
489 .
466 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
490 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
467
491
468 timeouts
492 timeouts
469 ========
493 ========
470 $ cat > test-timeout.t <<EOF
494 $ cat > test-timeout.t <<EOF
471 > $ sleep 2
495 > $ sleep 2
472 > $ echo pass
496 > $ echo pass
473 > pass
497 > pass
474 > EOF
498 > EOF
475 > echo '#require slow' > test-slow-timeout.t
499 > echo '#require slow' > test-slow-timeout.t
476 > cat test-timeout.t >> test-slow-timeout.t
500 > cat test-timeout.t >> test-slow-timeout.t
477 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
501 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
478 st
502 st
479 Skipped test-slow-timeout.t: missing feature: allow slow tests
503 Skipped test-slow-timeout.t: missing feature: allow slow tests
480 Failed test-timeout.t: timed out
504 Failed test-timeout.t: timed out
481 # Ran 1 tests, 1 skipped, 0 warned, 1 failed.
505 # Ran 1 tests, 1 skipped, 0 warned, 1 failed.
482 python hash seed: * (glob)
506 python hash seed: * (glob)
483 [1]
507 [1]
484 $ rt --timeout=1 --slowtimeout=3 \
508 $ rt --timeout=1 --slowtimeout=3 \
485 > test-timeout.t test-slow-timeout.t --allow-slow-tests
509 > test-timeout.t test-slow-timeout.t --allow-slow-tests
486 .t
510 .t
487 Failed test-timeout.t: timed out
511 Failed test-timeout.t: timed out
488 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
512 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
489 python hash seed: * (glob)
513 python hash seed: * (glob)
490 [1]
514 [1]
491 $ rm test-timeout.t test-slow-timeout.t
515 $ rm test-timeout.t test-slow-timeout.t
492
516
493 test for --time
517 test for --time
494 ==================
518 ==================
495
519
496 $ rt test-success.t --time
520 $ rt test-success.t --time
497 .
521 .
498 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
522 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
499 # Producing time report
523 # Producing time report
500 start end cuser csys real Test
524 start end cuser csys real Test
501 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
525 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
502
526
503 test for --time with --job enabled
527 test for --time with --job enabled
504 ====================================
528 ====================================
505
529
506 $ rt test-success.t --time --jobs 2
530 $ rt test-success.t --time --jobs 2
507 .
531 .
508 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
532 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
509 # Producing time report
533 # Producing time report
510 start end cuser csys real Test
534 start end cuser csys real Test
511 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
535 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
512
536
513 Skips
537 Skips
514 ================
538 ================
515 $ cat > test-skip.t <<EOF
539 $ cat > test-skip.t <<EOF
516 > $ echo xyzzy
540 > $ echo xyzzy
517 > #require false
541 > #require false
518 > EOF
542 > EOF
519 $ rt --nodiff
543 $ rt --nodiff
520 !.s
544 !.s
521 Skipped test-skip.t: missing feature: nail clipper
545 Skipped test-skip.t: missing feature: nail clipper
522 Failed test-failure.t: output changed
546 Failed test-failure.t: output changed
523 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
547 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
524 python hash seed: * (glob)
548 python hash seed: * (glob)
525 [1]
549 [1]
526
550
527 $ rt --keyword xyzzy
551 $ rt --keyword xyzzy
528 .s
552 .s
529 Skipped test-skip.t: missing feature: nail clipper
553 Skipped test-skip.t: missing feature: nail clipper
530 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
554 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
531
555
532 Skips with xml
556 Skips with xml
533 $ rt --keyword xyzzy \
557 $ rt --keyword xyzzy \
534 > --xunit=xunit.xml
558 > --xunit=xunit.xml
535 .s
559 .s
536 Skipped test-skip.t: missing feature: nail clipper
560 Skipped test-skip.t: missing feature: nail clipper
537 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
561 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
538 $ cat xunit.xml
562 $ cat xunit.xml
539 <?xml version="1.0" encoding="utf-8"?>
563 <?xml version="1.0" encoding="utf-8"?>
540 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
564 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
541 <testcase name="test-success.t" time="*"/> (glob)
565 <testcase name="test-success.t" time="*"/> (glob)
542 </testsuite>
566 </testsuite>
543
567
544 Missing skips or blacklisted skips don't count as executed:
568 Missing skips or blacklisted skips don't count as executed:
545 $ echo test-failure.t > blacklist
569 $ echo test-failure.t > blacklist
546 $ rt --blacklist=blacklist --json\
570 $ rt --blacklist=blacklist --json\
547 > test-failure.t test-bogus.t
571 > test-failure.t test-bogus.t
548 ss
572 ss
549 Skipped test-bogus.t: Doesn't exist
573 Skipped test-bogus.t: Doesn't exist
550 Skipped test-failure.t: blacklisted
574 Skipped test-failure.t: blacklisted
551 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
575 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
552 $ cat report.json
576 $ cat report.json
553 testreport ={
577 testreport ={
554 "test-bogus.t": {
578 "test-bogus.t": {
555 "result": "skip"
579 "result": "skip"
556 },
580 },
557 "test-failure.t": {
581 "test-failure.t": {
558 "result": "skip"
582 "result": "skip"
559 }
583 }
560 } (no-eol)
584 } (no-eol)
561 test for --json
585 test for --json
562 ==================
586 ==================
563
587
564 $ rt --json
588 $ rt --json
565
589
566 --- $TESTTMP/test-failure.t
590 --- $TESTTMP/test-failure.t
567 +++ $TESTTMP/test-failure.t.err
591 +++ $TESTTMP/test-failure.t.err
568 @@ -1,5 +1,5 @@
592 @@ -1,5 +1,5 @@
569 $ echo babar
593 $ echo babar
570 - rataxes
594 - rataxes
571 + babar
595 + babar
572 This is a noop statement so that
596 This is a noop statement so that
573 this test is still more bytes than success.
597 this test is still more bytes than success.
574 pad pad pad pad............................................................
598 pad pad pad pad............................................................
575
599
576 ERROR: test-failure.t output changed
600 ERROR: test-failure.t output changed
577 !.s
601 !.s
578 Skipped test-skip.t: missing feature: nail clipper
602 Skipped test-skip.t: missing feature: nail clipper
579 Failed test-failure.t: output changed
603 Failed test-failure.t: output changed
580 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
604 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
581 python hash seed: * (glob)
605 python hash seed: * (glob)
582 [1]
606 [1]
583
607
584 $ cat report.json
608 $ cat report.json
585 testreport ={
609 testreport ={
586 "test-failure.t": [\{] (re)
610 "test-failure.t": [\{] (re)
587 "csys": "\s*[\d\.]{4,5}", ? (re)
611 "csys": "\s*[\d\.]{4,5}", ? (re)
588 "cuser": "\s*[\d\.]{4,5}", ? (re)
612 "cuser": "\s*[\d\.]{4,5}", ? (re)
589 "diff": "---.+\+\+\+.+", ? (re)
613 "diff": "---.+\+\+\+.+", ? (re)
590 "end": "\s*[\d\.]{4,5}", ? (re)
614 "end": "\s*[\d\.]{4,5}", ? (re)
591 "result": "failure", ? (re)
615 "result": "failure", ? (re)
592 "start": "\s*[\d\.]{4,5}", ? (re)
616 "start": "\s*[\d\.]{4,5}", ? (re)
593 "time": "\s*[\d\.]{4,5}" (re)
617 "time": "\s*[\d\.]{4,5}" (re)
594 }, ? (re)
618 }, ? (re)
595 "test-skip.t": {
619 "test-skip.t": {
596 "csys": "\s*[\d\.]{4,5}", ? (re)
620 "csys": "\s*[\d\.]{4,5}", ? (re)
597 "cuser": "\s*[\d\.]{4,5}", ? (re)
621 "cuser": "\s*[\d\.]{4,5}", ? (re)
598 "diff": "", ? (re)
622 "diff": "", ? (re)
599 "end": "\s*[\d\.]{4,5}", ? (re)
623 "end": "\s*[\d\.]{4,5}", ? (re)
600 "result": "skip", ? (re)
624 "result": "skip", ? (re)
601 "start": "\s*[\d\.]{4,5}", ? (re)
625 "start": "\s*[\d\.]{4,5}", ? (re)
602 "time": "\s*[\d\.]{4,5}" (re)
626 "time": "\s*[\d\.]{4,5}" (re)
603 }, ? (re)
627 }, ? (re)
604 "test-success.t": [\{] (re)
628 "test-success.t": [\{] (re)
605 "csys": "\s*[\d\.]{4,5}", ? (re)
629 "csys": "\s*[\d\.]{4,5}", ? (re)
606 "cuser": "\s*[\d\.]{4,5}", ? (re)
630 "cuser": "\s*[\d\.]{4,5}", ? (re)
607 "diff": "", ? (re)
631 "diff": "", ? (re)
608 "end": "\s*[\d\.]{4,5}", ? (re)
632 "end": "\s*[\d\.]{4,5}", ? (re)
609 "result": "success", ? (re)
633 "result": "success", ? (re)
610 "start": "\s*[\d\.]{4,5}", ? (re)
634 "start": "\s*[\d\.]{4,5}", ? (re)
611 "time": "\s*[\d\.]{4,5}" (re)
635 "time": "\s*[\d\.]{4,5}" (re)
612 }
636 }
613 } (no-eol)
637 } (no-eol)
614
638
615 Test that failed test accepted through interactive are properly reported:
639 Test that failed test accepted through interactive are properly reported:
616
640
617 $ cp test-failure.t backup
641 $ cp test-failure.t backup
618 $ echo y | rt --json -i
642 $ echo y | rt --json -i
619
643
620 --- $TESTTMP/test-failure.t
644 --- $TESTTMP/test-failure.t
621 +++ $TESTTMP/test-failure.t.err
645 +++ $TESTTMP/test-failure.t.err
622 @@ -1,5 +1,5 @@
646 @@ -1,5 +1,5 @@
623 $ echo babar
647 $ echo babar
624 - rataxes
648 - rataxes
625 + babar
649 + babar
626 This is a noop statement so that
650 This is a noop statement so that
627 this test is still more bytes than success.
651 this test is still more bytes than success.
628 pad pad pad pad............................................................
652 pad pad pad pad............................................................
629 Accept this change? [n] ..s
653 Accept this change? [n] ..s
630 Skipped test-skip.t: missing feature: nail clipper
654 Skipped test-skip.t: missing feature: nail clipper
631 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
655 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
632
656
633 $ cat report.json
657 $ cat report.json
634 testreport ={
658 testreport ={
635 "test-failure.t": [\{] (re)
659 "test-failure.t": [\{] (re)
636 "csys": "\s*[\d\.]{4,5}", ? (re)
660 "csys": "\s*[\d\.]{4,5}", ? (re)
637 "cuser": "\s*[\d\.]{4,5}", ? (re)
661 "cuser": "\s*[\d\.]{4,5}", ? (re)
638 "diff": "", ? (re)
662 "diff": "", ? (re)
639 "end": "\s*[\d\.]{4,5}", ? (re)
663 "end": "\s*[\d\.]{4,5}", ? (re)
640 "result": "success", ? (re)
664 "result": "success", ? (re)
641 "start": "\s*[\d\.]{4,5}", ? (re)
665 "start": "\s*[\d\.]{4,5}", ? (re)
642 "time": "\s*[\d\.]{4,5}" (re)
666 "time": "\s*[\d\.]{4,5}" (re)
643 }, ? (re)
667 }, ? (re)
644 "test-skip.t": {
668 "test-skip.t": {
645 "csys": "\s*[\d\.]{4,5}", ? (re)
669 "csys": "\s*[\d\.]{4,5}", ? (re)
646 "cuser": "\s*[\d\.]{4,5}", ? (re)
670 "cuser": "\s*[\d\.]{4,5}", ? (re)
647 "diff": "", ? (re)
671 "diff": "", ? (re)
648 "end": "\s*[\d\.]{4,5}", ? (re)
672 "end": "\s*[\d\.]{4,5}", ? (re)
649 "result": "skip", ? (re)
673 "result": "skip", ? (re)
650 "start": "\s*[\d\.]{4,5}", ? (re)
674 "start": "\s*[\d\.]{4,5}", ? (re)
651 "time": "\s*[\d\.]{4,5}" (re)
675 "time": "\s*[\d\.]{4,5}" (re)
652 }, ? (re)
676 }, ? (re)
653 "test-success.t": [\{] (re)
677 "test-success.t": [\{] (re)
654 "csys": "\s*[\d\.]{4,5}", ? (re)
678 "csys": "\s*[\d\.]{4,5}", ? (re)
655 "cuser": "\s*[\d\.]{4,5}", ? (re)
679 "cuser": "\s*[\d\.]{4,5}", ? (re)
656 "diff": "", ? (re)
680 "diff": "", ? (re)
657 "end": "\s*[\d\.]{4,5}", ? (re)
681 "end": "\s*[\d\.]{4,5}", ? (re)
658 "result": "success", ? (re)
682 "result": "success", ? (re)
659 "start": "\s*[\d\.]{4,5}", ? (re)
683 "start": "\s*[\d\.]{4,5}", ? (re)
660 "time": "\s*[\d\.]{4,5}" (re)
684 "time": "\s*[\d\.]{4,5}" (re)
661 }
685 }
662 } (no-eol)
686 } (no-eol)
663 $ mv backup test-failure.t
687 $ mv backup test-failure.t
664
688
665 backslash on end of line with glob matching is handled properly
689 backslash on end of line with glob matching is handled properly
666
690
667 $ cat > test-glob-backslash.t << EOF
691 $ cat > test-glob-backslash.t << EOF
668 > $ echo 'foo bar \\'
692 > $ echo 'foo bar \\'
669 > foo * \ (glob)
693 > foo * \ (glob)
670 > EOF
694 > EOF
671
695
672 $ rt test-glob-backslash.t
696 $ rt test-glob-backslash.t
673 .
697 .
674 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
698 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
675
699
676 $ rm -f test-glob-backslash.t
700 $ rm -f test-glob-backslash.t
677
701
678 Test reusability for third party tools
702 Test reusability for third party tools
679 ======================================
703 ======================================
680
704
681 $ mkdir "$TESTTMP"/anothertests
705 $ mkdir "$TESTTMP"/anothertests
682 $ cd "$TESTTMP"/anothertests
706 $ cd "$TESTTMP"/anothertests
683
707
684 test that `run-tests.py` can execute hghave, even if it runs not in
708 test that `run-tests.py` can execute hghave, even if it runs not in
685 Mercurial source tree.
709 Mercurial source tree.
686
710
687 $ cat > test-hghave.t <<EOF
711 $ cat > test-hghave.t <<EOF
688 > #require true
712 > #require true
689 > $ echo foo
713 > $ echo foo
690 > foo
714 > foo
691 > EOF
715 > EOF
692 $ rt test-hghave.t
716 $ rt test-hghave.t
693 .
717 .
694 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
718 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
695
719
696 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
720 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
697 running is placed.
721 running is placed.
698
722
699 $ cat > test-runtestdir.t <<EOF
723 $ cat > test-runtestdir.t <<EOF
700 > - $TESTDIR, in which test-run-tests.t is placed
724 > - $TESTDIR, in which test-run-tests.t is placed
701 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
725 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
702 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
726 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
703 >
727 >
704 > #if windows
728 > #if windows
705 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
729 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
706 > #else
730 > #else
707 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
731 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
708 > #endif
732 > #endif
709 > $ test "\$RUNTESTDIR" = "$TESTDIR"
733 > $ test "\$RUNTESTDIR" = "$TESTDIR"
710 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
734 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
711 > #!/usr/bin/env python
735 > #!/usr/bin/env python
712 > #
736 > #
713 > # check-code - a style and portability checker for Mercurial
737 > # check-code - a style and portability checker for Mercurial
714 > EOF
738 > EOF
715 $ rt test-runtestdir.t
739 $ rt test-runtestdir.t
716 .
740 .
717 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
741 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
718
742
719 #if execbit
743 #if execbit
720
744
721 test that TESTDIR is referred in PATH
745 test that TESTDIR is referred in PATH
722
746
723 $ cat > custom-command.sh <<EOF
747 $ cat > custom-command.sh <<EOF
724 > #!/bin/sh
748 > #!/bin/sh
725 > echo "hello world"
749 > echo "hello world"
726 > EOF
750 > EOF
727 $ chmod +x custom-command.sh
751 $ chmod +x custom-command.sh
728 $ cat > test-testdir-path.t <<EOF
752 $ cat > test-testdir-path.t <<EOF
729 > $ custom-command.sh
753 > $ custom-command.sh
730 > hello world
754 > hello world
731 > EOF
755 > EOF
732 $ rt test-testdir-path.t
756 $ rt test-testdir-path.t
733 .
757 .
734 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
758 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
735
759
736 #endif
760 #endif
737
761
738 test support for --allow-slow-tests
762 test support for --allow-slow-tests
739 $ cat > test-very-slow-test.t <<EOF
763 $ cat > test-very-slow-test.t <<EOF
740 > #require slow
764 > #require slow
741 > $ echo pass
765 > $ echo pass
742 > pass
766 > pass
743 > EOF
767 > EOF
744 $ rt test-very-slow-test.t
768 $ rt test-very-slow-test.t
745 s
769 s
746 Skipped test-very-slow-test.t: missing feature: allow slow tests
770 Skipped test-very-slow-test.t: missing feature: allow slow tests
747 # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
771 # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
748 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
772 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
749 .
773 .
750 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
774 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
751
775
752 support for running a test outside the current directory
776 support for running a test outside the current directory
753 $ mkdir nonlocal
777 $ mkdir nonlocal
754 $ cat > nonlocal/test-is-not-here.t << EOF
778 $ cat > nonlocal/test-is-not-here.t << EOF
755 > $ echo pass
779 > $ echo pass
756 > pass
780 > pass
757 > EOF
781 > EOF
758 $ rt nonlocal/test-is-not-here.t
782 $ rt nonlocal/test-is-not-here.t
759 .
783 .
760 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
784 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
761
785
762 support for bisecting failed tests automatically
786 support for bisecting failed tests automatically
763 $ hg init bisect
787 $ hg init bisect
764 $ cd bisect
788 $ cd bisect
765 $ cat >> test-bisect.t <<EOF
789 $ cat >> test-bisect.t <<EOF
766 > $ echo pass
790 > $ echo pass
767 > pass
791 > pass
768 > EOF
792 > EOF
769 $ hg add test-bisect.t
793 $ hg add test-bisect.t
770 $ hg ci -m 'good'
794 $ hg ci -m 'good'
771 $ cat >> test-bisect.t <<EOF
795 $ cat >> test-bisect.t <<EOF
772 > $ echo pass
796 > $ echo pass
773 > fail
797 > fail
774 > EOF
798 > EOF
775 $ hg ci -m 'bad'
799 $ hg ci -m 'bad'
776 $ rt --known-good-rev=0 test-bisect.t
800 $ rt --known-good-rev=0 test-bisect.t
777
801
778 --- $TESTTMP/anothertests/bisect/test-bisect.t
802 --- $TESTTMP/anothertests/bisect/test-bisect.t
779 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
803 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
780 @@ -1,4 +1,4 @@
804 @@ -1,4 +1,4 @@
781 $ echo pass
805 $ echo pass
782 pass
806 pass
783 $ echo pass
807 $ echo pass
784 - fail
808 - fail
785 + pass
809 + pass
786
810
787 ERROR: test-bisect.t output changed
811 ERROR: test-bisect.t output changed
788 !
812 !
789 Failed test-bisect.t: output changed
813 Failed test-bisect.t: output changed
790 test-bisect.t broken by 72cbf122d116 (bad)
814 test-bisect.t broken by 72cbf122d116 (bad)
791 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
815 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
792 python hash seed: * (glob)
816 python hash seed: * (glob)
793 [1]
817 [1]
General Comments 0
You need to be logged in to leave comments. Login now