##// END OF EJS Templates
tests: allow the true command to be provided by coreutils...
pacien -
r49134:bc04a761 stable
parent child Browse files
Show More
@@ -1,2085 +1,2085 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 $ . "$TESTDIR/helper-runtests.sh"
5 $ . "$TESTDIR/helper-runtests.sh"
6
6
7 Smoke test with install
7 Smoke test with install
8 ============
8 ============
9 $ "$PYTHON" $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE -l
9 $ "$PYTHON" $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE -l
10 running 0 tests using 0 parallel processes
10 running 0 tests using 0 parallel processes
11
11
12 # Ran 0 tests, 0 skipped, 0 failed.
12 # Ran 0 tests, 0 skipped, 0 failed.
13
13
14 Define a helper to avoid the install step
14 Define a helper to avoid the install step
15 =============
15 =============
16 $ rt()
16 $ rt()
17 > {
17 > {
18 > "$PYTHON" $TESTDIR/run-tests.py --with-hg=$HGTEST_REAL_HG -j1 "$@"
18 > "$PYTHON" $TESTDIR/run-tests.py --with-hg=$HGTEST_REAL_HG -j1 "$@"
19 > }
19 > }
20
20
21 error paths
21 error paths
22
22
23 #if symlink
23 #if symlink
24 $ ln -s `which true` hg
24 $ ln -s `which true` hg
25 $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
25 $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
26 warning: --with-hg should specify an hg script, not: true
26 ^warning: --with-hg should specify an hg script, not: (true|coreutils)$ (re)
27 running 0 tests using 0 parallel processes
27 running 0 tests using 0 parallel processes
28
28
29 # Ran 0 tests, 0 skipped, 0 failed.
29 # Ran 0 tests, 0 skipped, 0 failed.
30 $ rm hg
30 $ rm hg
31 #endif
31 #endif
32
32
33 #if execbit
33 #if execbit
34 $ touch hg
34 $ touch hg
35 $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
35 $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
36 usage: run-tests.py [options] [tests]
36 usage: run-tests.py [options] [tests]
37 run-tests.py: error: --with-hg must specify an executable hg script
37 run-tests.py: error: --with-hg must specify an executable hg script
38 [2]
38 [2]
39 $ rm hg
39 $ rm hg
40 #endif
40 #endif
41
41
42 Features for testing optional lines
42 Features for testing optional lines
43 ===================================
43 ===================================
44
44
45 $ cat > hghaveaddon.py <<EOF
45 $ cat > hghaveaddon.py <<EOF
46 > import hghave
46 > import hghave
47 > @hghave.check("custom", "custom hghave feature")
47 > @hghave.check("custom", "custom hghave feature")
48 > def has_custom():
48 > def has_custom():
49 > return True
49 > return True
50 > @hghave.check("missing", "missing hghave feature")
50 > @hghave.check("missing", "missing hghave feature")
51 > def has_missing():
51 > def has_missing():
52 > return False
52 > return False
53 > EOF
53 > EOF
54
54
55 an empty test
55 an empty test
56 =======================
56 =======================
57
57
58 $ touch test-empty.t
58 $ touch test-empty.t
59 $ rt
59 $ rt
60 running 1 tests using 1 parallel processes
60 running 1 tests using 1 parallel processes
61 .
61 .
62 # Ran 1 tests, 0 skipped, 0 failed.
62 # Ran 1 tests, 0 skipped, 0 failed.
63 $ rm test-empty.t
63 $ rm test-empty.t
64
64
65 a succesful test
65 a succesful test
66 =======================
66 =======================
67
67
68 $ cat > test-success.t << EOF
68 $ cat > test-success.t << EOF
69 > $ echo babar
69 > $ echo babar
70 > babar
70 > babar
71 > $ echo xyzzy
71 > $ echo xyzzy
72 > dont_print (?)
72 > dont_print (?)
73 > nothing[42]line (re) (?)
73 > nothing[42]line (re) (?)
74 > never*happens (glob) (?)
74 > never*happens (glob) (?)
75 > more_nothing (?)
75 > more_nothing (?)
76 > xyzzy
76 > xyzzy
77 > nor this (?)
77 > nor this (?)
78 > $ printf 'abc\ndef\nxyz\n'
78 > $ printf 'abc\ndef\nxyz\n'
79 > 123 (?)
79 > 123 (?)
80 > abc
80 > abc
81 > def (?)
81 > def (?)
82 > 456 (?)
82 > 456 (?)
83 > xyz
83 > xyz
84 > $ printf 'zyx\nwvu\ntsr\n'
84 > $ printf 'zyx\nwvu\ntsr\n'
85 > abc (?)
85 > abc (?)
86 > zyx (custom !)
86 > zyx (custom !)
87 > wvu
87 > wvu
88 > no_print (no-custom !)
88 > no_print (no-custom !)
89 > tsr (no-missing !)
89 > tsr (no-missing !)
90 > missing (missing !)
90 > missing (missing !)
91 > EOF
91 > EOF
92
92
93 $ rt
93 $ rt
94 running 1 tests using 1 parallel processes
94 running 1 tests using 1 parallel processes
95 .
95 .
96 # Ran 1 tests, 0 skipped, 0 failed.
96 # Ran 1 tests, 0 skipped, 0 failed.
97
97
98 failing test
98 failing test
99 ==================
99 ==================
100
100
101 test churn with globs
101 test churn with globs
102 $ cat > test-failure.t <<EOF
102 $ cat > test-failure.t <<EOF
103 > $ echo "bar-baz"; echo "bar-bad"; echo foo
103 > $ echo "bar-baz"; echo "bar-bad"; echo foo
104 > bar*bad (glob)
104 > bar*bad (glob)
105 > bar*baz (glob)
105 > bar*baz (glob)
106 > | fo (re)
106 > | fo (re)
107 > EOF
107 > EOF
108 $ rt test-failure.t
108 $ rt test-failure.t
109 running 1 tests using 1 parallel processes
109 running 1 tests using 1 parallel processes
110
110
111 --- $TESTTMP/test-failure.t
111 --- $TESTTMP/test-failure.t
112 +++ $TESTTMP/test-failure.t.err
112 +++ $TESTTMP/test-failure.t.err
113 @@ -1,4 +1,4 @@
113 @@ -1,4 +1,4 @@
114 $ echo "bar-baz"; echo "bar-bad"; echo foo
114 $ echo "bar-baz"; echo "bar-bad"; echo foo
115 + bar*baz (glob)
115 + bar*baz (glob)
116 bar*bad (glob)
116 bar*bad (glob)
117 - bar*baz (glob)
117 - bar*baz (glob)
118 - | fo (re)
118 - | fo (re)
119 + foo
119 + foo
120
120
121 ERROR: test-failure.t output changed
121 ERROR: test-failure.t output changed
122 !
122 !
123 Failed test-failure.t: output changed
123 Failed test-failure.t: output changed
124 # Ran 1 tests, 0 skipped, 1 failed.
124 # Ran 1 tests, 0 skipped, 1 failed.
125 python hash seed: * (glob)
125 python hash seed: * (glob)
126 [1]
126 [1]
127
127
128 test how multiple globs gets matched with lines in output
128 test how multiple globs gets matched with lines in output
129 $ cat > test-failure-globs.t <<EOF
129 $ cat > test-failure-globs.t <<EOF
130 > $ echo "context"; echo "context"; \
130 > $ echo "context"; echo "context"; \
131 > echo "key: 1"; echo "value: not a"; \
131 > echo "key: 1"; echo "value: not a"; \
132 > echo "key: 2"; echo "value: not b"; \
132 > echo "key: 2"; echo "value: not b"; \
133 > echo "key: 3"; echo "value: c"; \
133 > echo "key: 3"; echo "value: c"; \
134 > echo "key: 4"; echo "value: d"
134 > echo "key: 4"; echo "value: d"
135 > context
135 > context
136 > context
136 > context
137 > key: 1
137 > key: 1
138 > value: a
138 > value: a
139 > key: 2
139 > key: 2
140 > value: b
140 > value: b
141 > key: 3
141 > key: 3
142 > value: * (glob)
142 > value: * (glob)
143 > key: 4
143 > key: 4
144 > value: * (glob)
144 > value: * (glob)
145 > EOF
145 > EOF
146 $ rt test-failure-globs.t
146 $ rt test-failure-globs.t
147 running 1 tests using 1 parallel processes
147 running 1 tests using 1 parallel processes
148
148
149 --- $TESTTMP/test-failure-globs.t
149 --- $TESTTMP/test-failure-globs.t
150 +++ $TESTTMP/test-failure-globs.t.err
150 +++ $TESTTMP/test-failure-globs.t.err
151 @@ -2,9 +2,9 @@
151 @@ -2,9 +2,9 @@
152 context
152 context
153 context
153 context
154 key: 1
154 key: 1
155 - value: a
155 - value: a
156 + value: not a
156 + value: not a
157 key: 2
157 key: 2
158 - value: b
158 - value: b
159 + value: not b
159 + value: not b
160 key: 3
160 key: 3
161 value: * (glob)
161 value: * (glob)
162 key: 4
162 key: 4
163
163
164 ERROR: test-failure-globs.t output changed
164 ERROR: test-failure-globs.t output changed
165 !
165 !
166 Failed test-failure-globs.t: output changed
166 Failed test-failure-globs.t: output changed
167 # Ran 1 tests, 0 skipped, 1 failed.
167 # Ran 1 tests, 0 skipped, 1 failed.
168 python hash seed: * (glob)
168 python hash seed: * (glob)
169 [1]
169 [1]
170 $ rm test-failure-globs.t
170 $ rm test-failure-globs.t
171
171
172 test diff colorisation
172 test diff colorisation
173
173
174 #if no-windows pygments
174 #if no-windows pygments
175 $ rt test-failure.t --color always
175 $ rt test-failure.t --color always
176 running 1 tests using 1 parallel processes
176 running 1 tests using 1 parallel processes
177
177
178 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
178 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
179 \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
179 \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
180 \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
180 \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
181 $ echo "bar-baz"; echo "bar-bad"; echo foo
181 $ echo "bar-baz"; echo "bar-bad"; echo foo
182 \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc)
182 \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc)
183 bar*bad (glob)
183 bar*bad (glob)
184 \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc)
184 \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc)
185 \x1b[38;5;124m- | fo (re)\x1b[39m (esc)
185 \x1b[38;5;124m- | fo (re)\x1b[39m (esc)
186 \x1b[38;5;34m+ foo\x1b[39m (esc)
186 \x1b[38;5;34m+ foo\x1b[39m (esc)
187
187
188 \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
188 \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
189 !
189 !
190 \x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc)
190 \x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc)
191 # Ran 1 tests, 0 skipped, 1 failed.
191 # Ran 1 tests, 0 skipped, 1 failed.
192 python hash seed: * (glob)
192 python hash seed: * (glob)
193 [1]
193 [1]
194
194
195 $ rt test-failure.t 2> tmp.log
195 $ rt test-failure.t 2> tmp.log
196 running 1 tests using 1 parallel processes
196 running 1 tests using 1 parallel processes
197 [1]
197 [1]
198 $ cat tmp.log
198 $ cat tmp.log
199
199
200 --- $TESTTMP/test-failure.t
200 --- $TESTTMP/test-failure.t
201 +++ $TESTTMP/test-failure.t.err
201 +++ $TESTTMP/test-failure.t.err
202 @@ -1,4 +1,4 @@
202 @@ -1,4 +1,4 @@
203 $ echo "bar-baz"; echo "bar-bad"; echo foo
203 $ echo "bar-baz"; echo "bar-bad"; echo foo
204 + bar*baz (glob)
204 + bar*baz (glob)
205 bar*bad (glob)
205 bar*bad (glob)
206 - bar*baz (glob)
206 - bar*baz (glob)
207 - | fo (re)
207 - | fo (re)
208 + foo
208 + foo
209
209
210 ERROR: test-failure.t output changed
210 ERROR: test-failure.t output changed
211 !
211 !
212 Failed test-failure.t: output changed
212 Failed test-failure.t: output changed
213 # Ran 1 tests, 0 skipped, 1 failed.
213 # Ran 1 tests, 0 skipped, 1 failed.
214 python hash seed: * (glob)
214 python hash seed: * (glob)
215 #endif
215 #endif
216
216
217 $ cat > test-failure.t << EOF
217 $ cat > test-failure.t << EOF
218 > $ true
218 > $ true
219 > should go away (true !)
219 > should go away (true !)
220 > $ true
220 > $ true
221 > should stay (false !)
221 > should stay (false !)
222 >
222 >
223 > Should remove first line, not second or third
223 > Should remove first line, not second or third
224 > $ echo 'testing'
224 > $ echo 'testing'
225 > baz*foo (glob) (true !)
225 > baz*foo (glob) (true !)
226 > foobar*foo (glob) (false !)
226 > foobar*foo (glob) (false !)
227 > te*ting (glob) (true !)
227 > te*ting (glob) (true !)
228 >
228 >
229 > Should keep first two lines, remove third and last
229 > Should keep first two lines, remove third and last
230 > $ echo 'testing'
230 > $ echo 'testing'
231 > test.ng (re) (true !)
231 > test.ng (re) (true !)
232 > foo.ar (re) (false !)
232 > foo.ar (re) (false !)
233 > b.r (re) (true !)
233 > b.r (re) (true !)
234 > missing (?)
234 > missing (?)
235 > awol (true !)
235 > awol (true !)
236 >
236 >
237 > The "missing" line should stay, even though awol is dropped
237 > The "missing" line should stay, even though awol is dropped
238 > $ echo 'testing'
238 > $ echo 'testing'
239 > test.ng (re) (true !)
239 > test.ng (re) (true !)
240 > foo.ar (?)
240 > foo.ar (?)
241 > awol
241 > awol
242 > missing (?)
242 > missing (?)
243 > EOF
243 > EOF
244 $ rt test-failure.t
244 $ rt test-failure.t
245 running 1 tests using 1 parallel processes
245 running 1 tests using 1 parallel processes
246
246
247 --- $TESTTMP/test-failure.t
247 --- $TESTTMP/test-failure.t
248 +++ $TESTTMP/test-failure.t.err
248 +++ $TESTTMP/test-failure.t.err
249 @@ -1,11 +1,9 @@
249 @@ -1,11 +1,9 @@
250 $ true
250 $ true
251 - should go away (true !)
251 - should go away (true !)
252 $ true
252 $ true
253 should stay (false !)
253 should stay (false !)
254
254
255 Should remove first line, not second or third
255 Should remove first line, not second or third
256 $ echo 'testing'
256 $ echo 'testing'
257 - baz*foo (glob) (true !)
257 - baz*foo (glob) (true !)
258 foobar*foo (glob) (false !)
258 foobar*foo (glob) (false !)
259 te*ting (glob) (true !)
259 te*ting (glob) (true !)
260
260
261 foo.ar (re) (false !)
261 foo.ar (re) (false !)
262 missing (?)
262 missing (?)
263 @@ -13,13 +11,10 @@
263 @@ -13,13 +11,10 @@
264 $ echo 'testing'
264 $ echo 'testing'
265 test.ng (re) (true !)
265 test.ng (re) (true !)
266 foo.ar (re) (false !)
266 foo.ar (re) (false !)
267 - b.r (re) (true !)
267 - b.r (re) (true !)
268 missing (?)
268 missing (?)
269 - awol (true !)
269 - awol (true !)
270
270
271 The "missing" line should stay, even though awol is dropped
271 The "missing" line should stay, even though awol is dropped
272 $ echo 'testing'
272 $ echo 'testing'
273 test.ng (re) (true !)
273 test.ng (re) (true !)
274 foo.ar (?)
274 foo.ar (?)
275 - awol
275 - awol
276 missing (?)
276 missing (?)
277
277
278 ERROR: test-failure.t output changed
278 ERROR: test-failure.t output changed
279 !
279 !
280 Failed test-failure.t: output changed
280 Failed test-failure.t: output changed
281 # Ran 1 tests, 0 skipped, 1 failed.
281 # Ran 1 tests, 0 skipped, 1 failed.
282 python hash seed: * (glob)
282 python hash seed: * (glob)
283 [1]
283 [1]
284
284
285 basic failing test
285 basic failing test
286 $ cat > test-failure.t << EOF
286 $ cat > test-failure.t << EOF
287 > $ echo babar
287 > $ echo babar
288 > rataxes
288 > rataxes
289 > This is a noop statement so that
289 > This is a noop statement so that
290 > this test is still more bytes than success.
290 > this test is still more bytes than success.
291 > pad pad pad pad............................................................
291 > pad pad pad pad............................................................
292 > pad pad pad pad............................................................
292 > pad pad pad pad............................................................
293 > pad pad pad pad............................................................
293 > pad pad pad pad............................................................
294 > pad pad pad pad............................................................
294 > pad pad pad pad............................................................
295 > pad pad pad pad............................................................
295 > pad pad pad pad............................................................
296 > pad pad pad pad............................................................
296 > pad pad pad pad............................................................
297 > EOF
297 > EOF
298
298
299 >>> fh = open('test-failure-unicode.t', 'wb')
299 >>> fh = open('test-failure-unicode.t', 'wb')
300 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
300 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
301 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
301 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
302
302
303 $ rt
303 $ rt
304 running 3 tests using 1 parallel processes
304 running 3 tests using 1 parallel processes
305
305
306 --- $TESTTMP/test-failure.t
306 --- $TESTTMP/test-failure.t
307 +++ $TESTTMP/test-failure.t.err
307 +++ $TESTTMP/test-failure.t.err
308 @@ -1,5 +1,5 @@
308 @@ -1,5 +1,5 @@
309 $ echo babar
309 $ echo babar
310 - rataxes
310 - rataxes
311 + babar
311 + babar
312 This is a noop statement so that
312 This is a noop statement so that
313 this test is still more bytes than success.
313 this test is still more bytes than success.
314 pad pad pad pad............................................................
314 pad pad pad pad............................................................
315
315
316 ERROR: test-failure.t output changed
316 ERROR: test-failure.t output changed
317 !.
317 !.
318 --- $TESTTMP/test-failure-unicode.t
318 --- $TESTTMP/test-failure-unicode.t
319 +++ $TESTTMP/test-failure-unicode.t.err
319 +++ $TESTTMP/test-failure-unicode.t.err
320 @@ -1,2 +1,2 @@
320 @@ -1,2 +1,2 @@
321 $ echo babar\xce\xb1 (esc)
321 $ echo babar\xce\xb1 (esc)
322 - l\xce\xb5\xce\xb5t (esc)
322 - l\xce\xb5\xce\xb5t (esc)
323 + babar\xce\xb1 (esc)
323 + babar\xce\xb1 (esc)
324
324
325 ERROR: test-failure-unicode.t output changed
325 ERROR: test-failure-unicode.t output changed
326 !
326 !
327 Failed test-failure-unicode.t: output changed
327 Failed test-failure-unicode.t: output changed
328 Failed test-failure.t: output changed
328 Failed test-failure.t: output changed
329 # Ran 3 tests, 0 skipped, 2 failed.
329 # Ran 3 tests, 0 skipped, 2 failed.
330 python hash seed: * (glob)
330 python hash seed: * (glob)
331 [1]
331 [1]
332
332
333 test --outputdir
333 test --outputdir
334 $ mkdir output
334 $ mkdir output
335 $ rt --outputdir output
335 $ rt --outputdir output
336 running 3 tests using 1 parallel processes
336 running 3 tests using 1 parallel processes
337
337
338 --- $TESTTMP/test-failure.t
338 --- $TESTTMP/test-failure.t
339 +++ $TESTTMP/output/test-failure.t.err
339 +++ $TESTTMP/output/test-failure.t.err
340 @@ -1,5 +1,5 @@
340 @@ -1,5 +1,5 @@
341 $ echo babar
341 $ echo babar
342 - rataxes
342 - rataxes
343 + babar
343 + babar
344 This is a noop statement so that
344 This is a noop statement so that
345 this test is still more bytes than success.
345 this test is still more bytes than success.
346 pad pad pad pad............................................................
346 pad pad pad pad............................................................
347
347
348 ERROR: test-failure.t output changed
348 ERROR: test-failure.t output changed
349 !.
349 !.
350 --- $TESTTMP/test-failure-unicode.t
350 --- $TESTTMP/test-failure-unicode.t
351 +++ $TESTTMP/output/test-failure-unicode.t.err
351 +++ $TESTTMP/output/test-failure-unicode.t.err
352 @@ -1,2 +1,2 @@
352 @@ -1,2 +1,2 @@
353 $ echo babar\xce\xb1 (esc)
353 $ echo babar\xce\xb1 (esc)
354 - l\xce\xb5\xce\xb5t (esc)
354 - l\xce\xb5\xce\xb5t (esc)
355 + babar\xce\xb1 (esc)
355 + babar\xce\xb1 (esc)
356
356
357 ERROR: test-failure-unicode.t output changed
357 ERROR: test-failure-unicode.t output changed
358 !
358 !
359 Failed test-failure-unicode.t: output changed
359 Failed test-failure-unicode.t: output changed
360 Failed test-failure.t: output changed
360 Failed test-failure.t: output changed
361 # Ran 3 tests, 0 skipped, 2 failed.
361 # Ran 3 tests, 0 skipped, 2 failed.
362 python hash seed: * (glob)
362 python hash seed: * (glob)
363 [1]
363 [1]
364 $ ls -a output
364 $ ls -a output
365 .
365 .
366 ..
366 ..
367 .testtimes
367 .testtimes
368 test-failure-unicode.t.err
368 test-failure-unicode.t.err
369 test-failure.t.err
369 test-failure.t.err
370
370
371 test --xunit support
371 test --xunit support
372 $ rt --xunit=xunit.xml
372 $ rt --xunit=xunit.xml
373 running 3 tests using 1 parallel processes
373 running 3 tests using 1 parallel processes
374
374
375 --- $TESTTMP/test-failure.t
375 --- $TESTTMP/test-failure.t
376 +++ $TESTTMP/test-failure.t.err
376 +++ $TESTTMP/test-failure.t.err
377 @@ -1,5 +1,5 @@
377 @@ -1,5 +1,5 @@
378 $ echo babar
378 $ echo babar
379 - rataxes
379 - rataxes
380 + babar
380 + babar
381 This is a noop statement so that
381 This is a noop statement so that
382 this test is still more bytes than success.
382 this test is still more bytes than success.
383 pad pad pad pad............................................................
383 pad pad pad pad............................................................
384
384
385 ERROR: test-failure.t output changed
385 ERROR: test-failure.t output changed
386 !.
386 !.
387 --- $TESTTMP/test-failure-unicode.t
387 --- $TESTTMP/test-failure-unicode.t
388 +++ $TESTTMP/test-failure-unicode.t.err
388 +++ $TESTTMP/test-failure-unicode.t.err
389 @@ -1,2 +1,2 @@
389 @@ -1,2 +1,2 @@
390 $ echo babar\xce\xb1 (esc)
390 $ echo babar\xce\xb1 (esc)
391 - l\xce\xb5\xce\xb5t (esc)
391 - l\xce\xb5\xce\xb5t (esc)
392 + babar\xce\xb1 (esc)
392 + babar\xce\xb1 (esc)
393
393
394 ERROR: test-failure-unicode.t output changed
394 ERROR: test-failure-unicode.t output changed
395 !
395 !
396 Failed test-failure-unicode.t: output changed
396 Failed test-failure-unicode.t: output changed
397 Failed test-failure.t: output changed
397 Failed test-failure.t: output changed
398 # Ran 3 tests, 0 skipped, 2 failed.
398 # Ran 3 tests, 0 skipped, 2 failed.
399 python hash seed: * (glob)
399 python hash seed: * (glob)
400 [1]
400 [1]
401 $ cat xunit.xml
401 $ cat xunit.xml
402 <?xml version="1.0" encoding="utf-8"?>
402 <?xml version="1.0" encoding="utf-8"?>
403 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
403 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
404 <testcase name="test-success.t" time="*"/> (glob)
404 <testcase name="test-success.t" time="*"/> (glob)
405 <testcase name="test-failure-unicode.t" time="*"> (glob)
405 <testcase name="test-failure-unicode.t" time="*"> (glob)
406 <failure message="output changed" type="output-mismatch"><![CDATA[--- $TESTTMP/test-failure-unicode.t (py38 !)
406 <failure message="output changed" type="output-mismatch"><![CDATA[--- $TESTTMP/test-failure-unicode.t (py38 !)
407 <failure message="output changed" type="output-mismatch"> (no-py38 !)
407 <failure message="output changed" type="output-mismatch"> (no-py38 !)
408 <![CDATA[--- $TESTTMP/test-failure-unicode.t (no-py38 !)
408 <![CDATA[--- $TESTTMP/test-failure-unicode.t (no-py38 !)
409 +++ $TESTTMP/test-failure-unicode.t.err
409 +++ $TESTTMP/test-failure-unicode.t.err
410 @@ -1,2 +1,2 @@
410 @@ -1,2 +1,2 @@
411 $ echo babar\xce\xb1 (esc)
411 $ echo babar\xce\xb1 (esc)
412 - l\xce\xb5\xce\xb5t (esc)
412 - l\xce\xb5\xce\xb5t (esc)
413 + babar\xce\xb1 (esc)
413 + babar\xce\xb1 (esc)
414 ]]></failure> (py38 !)
414 ]]></failure> (py38 !)
415 ]]> </failure> (no-py38 !)
415 ]]> </failure> (no-py38 !)
416 </testcase>
416 </testcase>
417 <testcase name="test-failure.t" time="*"> (glob)
417 <testcase name="test-failure.t" time="*"> (glob)
418 <failure message="output changed" type="output-mismatch"><![CDATA[--- $TESTTMP/test-failure.t (py38 !)
418 <failure message="output changed" type="output-mismatch"><![CDATA[--- $TESTTMP/test-failure.t (py38 !)
419 <failure message="output changed" type="output-mismatch"> (no-py38 !)
419 <failure message="output changed" type="output-mismatch"> (no-py38 !)
420 <![CDATA[--- $TESTTMP/test-failure.t (no-py38 !)
420 <![CDATA[--- $TESTTMP/test-failure.t (no-py38 !)
421 +++ $TESTTMP/test-failure.t.err
421 +++ $TESTTMP/test-failure.t.err
422 @@ -1,5 +1,5 @@
422 @@ -1,5 +1,5 @@
423 $ echo babar
423 $ echo babar
424 - rataxes
424 - rataxes
425 + babar
425 + babar
426 This is a noop statement so that
426 This is a noop statement so that
427 this test is still more bytes than success.
427 this test is still more bytes than success.
428 pad pad pad pad............................................................
428 pad pad pad pad............................................................
429 ]]></failure> (py38 !)
429 ]]></failure> (py38 !)
430 ]]> </failure> (no-py38 !)
430 ]]> </failure> (no-py38 !)
431 </testcase>
431 </testcase>
432 </testsuite>
432 </testsuite>
433
433
434 $ cat .testtimes
434 $ cat .testtimes
435 test-empty.t * (glob)
435 test-empty.t * (glob)
436 test-failure-globs.t * (glob)
436 test-failure-globs.t * (glob)
437 test-failure-unicode.t * (glob)
437 test-failure-unicode.t * (glob)
438 test-failure.t * (glob)
438 test-failure.t * (glob)
439 test-success.t * (glob)
439 test-success.t * (glob)
440
440
441 $ rt --list-tests
441 $ rt --list-tests
442 test-failure-unicode.t
442 test-failure-unicode.t
443 test-failure.t
443 test-failure.t
444 test-success.t
444 test-success.t
445
445
446 $ rt --list-tests --json
446 $ rt --list-tests --json
447 test-failure-unicode.t
447 test-failure-unicode.t
448 test-failure.t
448 test-failure.t
449 test-success.t
449 test-success.t
450 $ cat report.json
450 $ cat report.json
451 testreport ={
451 testreport ={
452 "test-failure-unicode.t": {
452 "test-failure-unicode.t": {
453 "result": "success"
453 "result": "success"
454 },
454 },
455 "test-failure.t": {
455 "test-failure.t": {
456 "result": "success"
456 "result": "success"
457 },
457 },
458 "test-success.t": {
458 "test-success.t": {
459 "result": "success"
459 "result": "success"
460 }
460 }
461 } (no-eol)
461 } (no-eol)
462
462
463 $ rt --list-tests --xunit=xunit.xml
463 $ rt --list-tests --xunit=xunit.xml
464 test-failure-unicode.t
464 test-failure-unicode.t
465 test-failure.t
465 test-failure.t
466 test-success.t
466 test-success.t
467 $ cat xunit.xml
467 $ cat xunit.xml
468 <?xml version="1.0" encoding="utf-8"?>
468 <?xml version="1.0" encoding="utf-8"?>
469 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
469 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
470 <testcase name="test-failure-unicode.t"/>
470 <testcase name="test-failure-unicode.t"/>
471 <testcase name="test-failure.t"/>
471 <testcase name="test-failure.t"/>
472 <testcase name="test-success.t"/>
472 <testcase name="test-success.t"/>
473 </testsuite>
473 </testsuite>
474
474
475 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
475 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
476 test-failure-unicode.t
476 test-failure-unicode.t
477 test-failure.t
477 test-failure.t
478 $ cat output/report.json
478 $ cat output/report.json
479 testreport ={
479 testreport ={
480 "test-failure-unicode.t": {
480 "test-failure-unicode.t": {
481 "result": "success"
481 "result": "success"
482 },
482 },
483 "test-failure.t": {
483 "test-failure.t": {
484 "result": "success"
484 "result": "success"
485 }
485 }
486 } (no-eol)
486 } (no-eol)
487 $ cat xunit.xml
487 $ cat xunit.xml
488 <?xml version="1.0" encoding="utf-8"?>
488 <?xml version="1.0" encoding="utf-8"?>
489 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
489 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
490 <testcase name="test-failure-unicode.t"/>
490 <testcase name="test-failure-unicode.t"/>
491 <testcase name="test-failure.t"/>
491 <testcase name="test-failure.t"/>
492 </testsuite>
492 </testsuite>
493
493
494 $ rm test-failure-unicode.t
494 $ rm test-failure-unicode.t
495
495
496 test for --retest
496 test for --retest
497 ====================
497 ====================
498
498
499 $ rt --retest
499 $ rt --retest
500 running 1 tests using 1 parallel processes
500 running 1 tests using 1 parallel processes
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,5 +1,5 @@
504 @@ -1,5 +1,5 @@
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 pad pad pad pad............................................................
510 pad pad pad pad............................................................
511
511
512 ERROR: test-failure.t output changed
512 ERROR: test-failure.t output changed
513 !
513 !
514 Failed test-failure.t: output changed
514 Failed test-failure.t: output changed
515 # Ran 1 tests, 0 skipped, 1 failed.
515 # Ran 1 tests, 0 skipped, 1 failed.
516 python hash seed: * (glob)
516 python hash seed: * (glob)
517 [1]
517 [1]
518
518
519 --retest works with --outputdir
519 --retest works with --outputdir
520 $ rm -r output
520 $ rm -r output
521 $ mkdir output
521 $ mkdir output
522 $ mv test-failure.t.err output
522 $ mv test-failure.t.err output
523 $ rt --retest --outputdir output
523 $ rt --retest --outputdir output
524 running 1 tests using 1 parallel processes
524 running 1 tests using 1 parallel processes
525
525
526 --- $TESTTMP/test-failure.t
526 --- $TESTTMP/test-failure.t
527 +++ $TESTTMP/output/test-failure.t.err
527 +++ $TESTTMP/output/test-failure.t.err
528 @@ -1,5 +1,5 @@
528 @@ -1,5 +1,5 @@
529 $ echo babar
529 $ echo babar
530 - rataxes
530 - rataxes
531 + babar
531 + babar
532 This is a noop statement so that
532 This is a noop statement so that
533 this test is still more bytes than success.
533 this test is still more bytes than success.
534 pad pad pad pad............................................................
534 pad pad pad pad............................................................
535
535
536 ERROR: test-failure.t output changed
536 ERROR: test-failure.t output changed
537 !
537 !
538 Failed test-failure.t: output changed
538 Failed test-failure.t: output changed
539 # Ran 1 tests, 0 skipped, 1 failed.
539 # Ran 1 tests, 0 skipped, 1 failed.
540 python hash seed: * (glob)
540 python hash seed: * (glob)
541 [1]
541 [1]
542
542
543 Selecting Tests To Run
543 Selecting Tests To Run
544 ======================
544 ======================
545
545
546 successful
546 successful
547
547
548 $ rt test-success.t
548 $ rt test-success.t
549 running 1 tests using 1 parallel processes
549 running 1 tests using 1 parallel processes
550 .
550 .
551 # Ran 1 tests, 0 skipped, 0 failed.
551 # Ran 1 tests, 0 skipped, 0 failed.
552
552
553 success w/ keyword
553 success w/ keyword
554 $ rt -k xyzzy
554 $ rt -k xyzzy
555 running 2 tests using 1 parallel processes
555 running 2 tests using 1 parallel processes
556 .
556 .
557 # Ran 2 tests, 1 skipped, 0 failed.
557 # Ran 2 tests, 1 skipped, 0 failed.
558
558
559 failed
559 failed
560
560
561 $ rt test-failure.t
561 $ rt test-failure.t
562 running 1 tests using 1 parallel processes
562 running 1 tests using 1 parallel processes
563
563
564 --- $TESTTMP/test-failure.t
564 --- $TESTTMP/test-failure.t
565 +++ $TESTTMP/test-failure.t.err
565 +++ $TESTTMP/test-failure.t.err
566 @@ -1,5 +1,5 @@
566 @@ -1,5 +1,5 @@
567 $ echo babar
567 $ echo babar
568 - rataxes
568 - rataxes
569 + babar
569 + babar
570 This is a noop statement so that
570 This is a noop statement so that
571 this test is still more bytes than success.
571 this test is still more bytes than success.
572 pad pad pad pad............................................................
572 pad pad pad pad............................................................
573
573
574 ERROR: test-failure.t output changed
574 ERROR: test-failure.t output changed
575 !
575 !
576 Failed test-failure.t: output changed
576 Failed test-failure.t: output changed
577 # Ran 1 tests, 0 skipped, 1 failed.
577 # Ran 1 tests, 0 skipped, 1 failed.
578 python hash seed: * (glob)
578 python hash seed: * (glob)
579 [1]
579 [1]
580
580
581 failure w/ keyword
581 failure w/ keyword
582 $ rt -k rataxes
582 $ rt -k rataxes
583 running 2 tests using 1 parallel processes
583 running 2 tests using 1 parallel processes
584
584
585 --- $TESTTMP/test-failure.t
585 --- $TESTTMP/test-failure.t
586 +++ $TESTTMP/test-failure.t.err
586 +++ $TESTTMP/test-failure.t.err
587 @@ -1,5 +1,5 @@
587 @@ -1,5 +1,5 @@
588 $ echo babar
588 $ echo babar
589 - rataxes
589 - rataxes
590 + babar
590 + babar
591 This is a noop statement so that
591 This is a noop statement so that
592 this test is still more bytes than success.
592 this test is still more bytes than success.
593 pad pad pad pad............................................................
593 pad pad pad pad............................................................
594
594
595 ERROR: test-failure.t output changed
595 ERROR: test-failure.t output changed
596 !
596 !
597 Failed test-failure.t: output changed
597 Failed test-failure.t: output changed
598 # Ran 2 tests, 1 skipped, 1 failed.
598 # Ran 2 tests, 1 skipped, 1 failed.
599 python hash seed: * (glob)
599 python hash seed: * (glob)
600 [1]
600 [1]
601
601
602 Verify that when a process fails to start we show a useful message
602 Verify that when a process fails to start we show a useful message
603 ==================================================================
603 ==================================================================
604
604
605 $ cat > test-serve-fail.t <<EOF
605 $ cat > test-serve-fail.t <<EOF
606 > $ echo 'abort: child process failed to start blah'
606 > $ echo 'abort: child process failed to start blah'
607 > EOF
607 > EOF
608 $ rt test-serve-fail.t
608 $ rt test-serve-fail.t
609 running 1 tests using 1 parallel processes
609 running 1 tests using 1 parallel processes
610
610
611 --- $TESTTMP/test-serve-fail.t
611 --- $TESTTMP/test-serve-fail.t
612 +++ $TESTTMP/test-serve-fail.t.err
612 +++ $TESTTMP/test-serve-fail.t.err
613 @@ -1* +1,2 @@ (glob)
613 @@ -1* +1,2 @@ (glob)
614 $ echo 'abort: child process failed to start blah'
614 $ echo 'abort: child process failed to start blah'
615 + abort: child process failed to start blah
615 + abort: child process failed to start blah
616
616
617 ERROR: test-serve-fail.t output changed
617 ERROR: test-serve-fail.t output changed
618 !
618 !
619 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
619 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
620 # Ran 1 tests, 0 skipped, 1 failed.
620 # Ran 1 tests, 0 skipped, 1 failed.
621 python hash seed: * (glob)
621 python hash seed: * (glob)
622 [1]
622 [1]
623 $ rm test-serve-fail.t
623 $ rm test-serve-fail.t
624
624
625 Verify that we can try other ports
625 Verify that we can try other ports
626 ===================================
626 ===================================
627
627
628 Extensions aren't inherited by the invoked run-tests.py. An extension
628 Extensions aren't inherited by the invoked run-tests.py. An extension
629 introducing a repository requirement could cause this to fail. So we force
629 introducing a repository requirement could cause this to fail. So we force
630 HGRCPATH to get a clean environment.
630 HGRCPATH to get a clean environment.
631
631
632 $ HGRCPATH= hg init inuse
632 $ HGRCPATH= hg init inuse
633 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
633 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
634 $ cat blocks.pid >> $DAEMON_PIDS
634 $ cat blocks.pid >> $DAEMON_PIDS
635 $ cat > test-serve-inuse.t <<EOF
635 $ cat > test-serve-inuse.t <<EOF
636 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
636 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
637 > $ cat hg.pid >> \$DAEMON_PIDS
637 > $ cat hg.pid >> \$DAEMON_PIDS
638 > EOF
638 > EOF
639 $ rt test-serve-inuse.t
639 $ rt test-serve-inuse.t
640 running 1 tests using 1 parallel processes
640 running 1 tests using 1 parallel processes
641 .
641 .
642 # Ran 1 tests, 0 skipped, 0 failed.
642 # Ran 1 tests, 0 skipped, 0 failed.
643 $ rm test-serve-inuse.t
643 $ rm test-serve-inuse.t
644 $ killdaemons.py $DAEMON_PIDS
644 $ killdaemons.py $DAEMON_PIDS
645
645
646 Running In Debug Mode
646 Running In Debug Mode
647 ======================
647 ======================
648
648
649 $ rt --debug 2>&1 | grep -v pwd
649 $ rt --debug 2>&1 | grep -v pwd
650 running 2 tests using 1 parallel processes
650 running 2 tests using 1 parallel processes
651 + echo *SALT* 0 0 (glob)
651 + echo *SALT* 0 0 (glob)
652 *SALT* 0 0 (glob)
652 *SALT* 0 0 (glob)
653 + echo babar
653 + echo babar
654 babar
654 babar
655 + echo *SALT* 10 0 (glob)
655 + echo *SALT* 10 0 (glob)
656 *SALT* 10 0 (glob)
656 *SALT* 10 0 (glob)
657 *+ echo *SALT* 0 0 (glob)
657 *+ echo *SALT* 0 0 (glob)
658 *SALT* 0 0 (glob)
658 *SALT* 0 0 (glob)
659 + echo babar
659 + echo babar
660 babar
660 babar
661 + echo *SALT* 2 0 (glob)
661 + echo *SALT* 2 0 (glob)
662 *SALT* 2 0 (glob)
662 *SALT* 2 0 (glob)
663 + echo xyzzy
663 + echo xyzzy
664 xyzzy
664 xyzzy
665 + echo *SALT* 9 0 (glob)
665 + echo *SALT* 9 0 (glob)
666 *SALT* 9 0 (glob)
666 *SALT* 9 0 (glob)
667 + printf *abc\ndef\nxyz\n* (glob)
667 + printf *abc\ndef\nxyz\n* (glob)
668 abc
668 abc
669 def
669 def
670 xyz
670 xyz
671 + echo *SALT* 15 0 (glob)
671 + echo *SALT* 15 0 (glob)
672 *SALT* 15 0 (glob)
672 *SALT* 15 0 (glob)
673 + printf *zyx\nwvu\ntsr\n* (glob)
673 + printf *zyx\nwvu\ntsr\n* (glob)
674 zyx
674 zyx
675 wvu
675 wvu
676 tsr
676 tsr
677 + echo *SALT* 22 0 (glob)
677 + echo *SALT* 22 0 (glob)
678 *SALT* 22 0 (glob)
678 *SALT* 22 0 (glob)
679 .
679 .
680 # Ran 2 tests, 0 skipped, 0 failed.
680 # Ran 2 tests, 0 skipped, 0 failed.
681
681
682 Parallel runs
682 Parallel runs
683 ==============
683 ==============
684
684
685 (duplicate the failing test to get predictable output)
685 (duplicate the failing test to get predictable output)
686 $ cp test-failure.t test-failure-copy.t
686 $ cp test-failure.t test-failure-copy.t
687
687
688 $ rt --jobs 2 test-failure*.t -n
688 $ rt --jobs 2 test-failure*.t -n
689 running 2 tests using 2 parallel processes
689 running 2 tests using 2 parallel processes
690 !!
690 !!
691 Failed test-failure*.t: output changed (glob)
691 Failed test-failure*.t: output changed (glob)
692 Failed test-failure*.t: output changed (glob)
692 Failed test-failure*.t: output changed (glob)
693 # Ran 2 tests, 0 skipped, 2 failed.
693 # Ran 2 tests, 0 skipped, 2 failed.
694 python hash seed: * (glob)
694 python hash seed: * (glob)
695 [1]
695 [1]
696
696
697 failures in parallel with --first should only print one failure
697 failures in parallel with --first should only print one failure
698 $ rt --jobs 2 --first test-failure*.t
698 $ rt --jobs 2 --first test-failure*.t
699 running 2 tests using 2 parallel processes
699 running 2 tests using 2 parallel processes
700
700
701 --- $TESTTMP/test-failure*.t (glob)
701 --- $TESTTMP/test-failure*.t (glob)
702 +++ $TESTTMP/test-failure*.t.err (glob)
702 +++ $TESTTMP/test-failure*.t.err (glob)
703 @@ -1,5 +1,5 @@
703 @@ -1,5 +1,5 @@
704 $ echo babar
704 $ echo babar
705 - rataxes
705 - rataxes
706 + babar
706 + babar
707 This is a noop statement so that
707 This is a noop statement so that
708 this test is still more bytes than success.
708 this test is still more bytes than success.
709 pad pad pad pad............................................................
709 pad pad pad pad............................................................
710
710
711 Failed test-failure*.t: output changed (glob)
711 Failed test-failure*.t: output changed (glob)
712 Failed test-failure*.t: output changed (glob)
712 Failed test-failure*.t: output changed (glob)
713 # Ran 2 tests, 0 skipped, 2 failed.
713 # Ran 2 tests, 0 skipped, 2 failed.
714 python hash seed: * (glob)
714 python hash seed: * (glob)
715 [1]
715 [1]
716
716
717
717
718 (delete the duplicated test file)
718 (delete the duplicated test file)
719 $ rm test-failure-copy.t
719 $ rm test-failure-copy.t
720
720
721 multiple runs per test should be parallelized
721 multiple runs per test should be parallelized
722
722
723 $ rt --jobs 2 --runs-per-test 2 test-success.t
723 $ rt --jobs 2 --runs-per-test 2 test-success.t
724 running 2 tests using 2 parallel processes
724 running 2 tests using 2 parallel processes
725 ..
725 ..
726 # Ran 2 tests, 0 skipped, 0 failed.
726 # Ran 2 tests, 0 skipped, 0 failed.
727
727
728 Interactive run
728 Interactive run
729 ===============
729 ===============
730
730
731 (backup the failing test)
731 (backup the failing test)
732 $ cp test-failure.t backup
732 $ cp test-failure.t backup
733
733
734 Refuse the fix
734 Refuse the fix
735
735
736 $ echo 'n' | rt -i
736 $ echo 'n' | rt -i
737 running 2 tests using 1 parallel processes
737 running 2 tests using 1 parallel processes
738
738
739 --- $TESTTMP/test-failure.t
739 --- $TESTTMP/test-failure.t
740 +++ $TESTTMP/test-failure.t.err
740 +++ $TESTTMP/test-failure.t.err
741 @@ -1,5 +1,5 @@
741 @@ -1,5 +1,5 @@
742 $ echo babar
742 $ echo babar
743 - rataxes
743 - rataxes
744 + babar
744 + babar
745 This is a noop statement so that
745 This is a noop statement so that
746 this test is still more bytes than success.
746 this test is still more bytes than success.
747 pad pad pad pad............................................................
747 pad pad pad pad............................................................
748 Accept this change? [y/N]
748 Accept this change? [y/N]
749 ERROR: test-failure.t output changed
749 ERROR: test-failure.t output changed
750 !.
750 !.
751 Failed test-failure.t: output changed
751 Failed test-failure.t: output changed
752 # Ran 2 tests, 0 skipped, 1 failed.
752 # Ran 2 tests, 0 skipped, 1 failed.
753 python hash seed: * (glob)
753 python hash seed: * (glob)
754 [1]
754 [1]
755
755
756 $ cat test-failure.t
756 $ cat test-failure.t
757 $ echo babar
757 $ echo babar
758 rataxes
758 rataxes
759 This is a noop statement so that
759 This is a noop statement so that
760 this test is still more bytes than success.
760 this test is still more bytes than success.
761 pad pad pad pad............................................................
761 pad pad pad pad............................................................
762 pad pad pad pad............................................................
762 pad pad pad pad............................................................
763 pad pad pad pad............................................................
763 pad pad pad pad............................................................
764 pad pad pad pad............................................................
764 pad pad pad pad............................................................
765 pad pad pad pad............................................................
765 pad pad pad pad............................................................
766 pad pad pad pad............................................................
766 pad pad pad pad............................................................
767
767
768 Interactive with custom view
768 Interactive with custom view
769
769
770 $ echo 'n' | rt -i --view echo
770 $ echo 'n' | rt -i --view echo
771 running 2 tests using 1 parallel processes
771 running 2 tests using 1 parallel processes
772 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
772 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
773 Accept this change? [y/N]* (glob)
773 Accept this change? [y/N]* (glob)
774 ERROR: test-failure.t output changed
774 ERROR: test-failure.t output changed
775 !.
775 !.
776 Failed test-failure.t: output changed
776 Failed test-failure.t: output changed
777 # Ran 2 tests, 0 skipped, 1 failed.
777 # Ran 2 tests, 0 skipped, 1 failed.
778 python hash seed: * (glob)
778 python hash seed: * (glob)
779 [1]
779 [1]
780
780
781 View the fix
781 View the fix
782
782
783 $ echo 'y' | rt --view echo
783 $ echo 'y' | rt --view echo
784 running 2 tests using 1 parallel processes
784 running 2 tests using 1 parallel processes
785 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
785 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
786
786
787 ERROR: test-failure.t output changed
787 ERROR: test-failure.t output changed
788 !.
788 !.
789 Failed test-failure.t: output changed
789 Failed test-failure.t: output changed
790 # Ran 2 tests, 0 skipped, 1 failed.
790 # Ran 2 tests, 0 skipped, 1 failed.
791 python hash seed: * (glob)
791 python hash seed: * (glob)
792 [1]
792 [1]
793
793
794 Accept the fix
794 Accept the fix
795
795
796 $ cat >> test-failure.t <<EOF
796 $ cat >> test-failure.t <<EOF
797 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
797 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
798 > saved backup bundle to \$TESTTMP/foo.hg
798 > saved backup bundle to \$TESTTMP/foo.hg
799 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
799 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
800 > saved backup bundle to $TESTTMP\\foo.hg
800 > saved backup bundle to $TESTTMP\\foo.hg
801 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
801 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
802 > saved backup bundle to \$TESTTMP/*.hg (glob)
802 > saved backup bundle to \$TESTTMP/*.hg (glob)
803 > EOF
803 > EOF
804 $ echo 'y' | rt -i 2>&1
804 $ echo 'y' | rt -i 2>&1
805 running 2 tests using 1 parallel processes
805 running 2 tests using 1 parallel processes
806
806
807 --- $TESTTMP/test-failure.t
807 --- $TESTTMP/test-failure.t
808 +++ $TESTTMP/test-failure.t.err
808 +++ $TESTTMP/test-failure.t.err
809 @@ -1,5 +1,5 @@
809 @@ -1,5 +1,5 @@
810 $ echo babar
810 $ echo babar
811 - rataxes
811 - rataxes
812 + babar
812 + babar
813 This is a noop statement so that
813 This is a noop statement so that
814 this test is still more bytes than success.
814 this test is still more bytes than success.
815 pad pad pad pad............................................................
815 pad pad pad pad............................................................
816 @@ -11,6 +11,6 @@
816 @@ -11,6 +11,6 @@
817 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
817 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
818 saved backup bundle to $TESTTMP/foo.hg
818 saved backup bundle to $TESTTMP/foo.hg
819 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
819 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
820 - saved backup bundle to $TESTTMP\foo.hg
820 - saved backup bundle to $TESTTMP\foo.hg
821 + saved backup bundle to $TESTTMP/foo.hg
821 + saved backup bundle to $TESTTMP/foo.hg
822 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
822 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
823 saved backup bundle to $TESTTMP/*.hg (glob)
823 saved backup bundle to $TESTTMP/*.hg (glob)
824 Accept this change? [y/N] ..
824 Accept this change? [y/N] ..
825 # Ran 2 tests, 0 skipped, 0 failed.
825 # Ran 2 tests, 0 skipped, 0 failed.
826
826
827 $ sed -e 's,(glob)$,&<,g' test-failure.t
827 $ sed -e 's,(glob)$,&<,g' test-failure.t
828 $ echo babar
828 $ echo babar
829 babar
829 babar
830 This is a noop statement so that
830 This is a noop statement so that
831 this test is still more bytes than success.
831 this test is still more bytes than success.
832 pad pad pad pad............................................................
832 pad pad pad pad............................................................
833 pad pad pad pad............................................................
833 pad pad pad pad............................................................
834 pad pad pad pad............................................................
834 pad pad pad pad............................................................
835 pad pad pad pad............................................................
835 pad pad pad pad............................................................
836 pad pad pad pad............................................................
836 pad pad pad pad............................................................
837 pad pad pad pad............................................................
837 pad pad pad pad............................................................
838 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
838 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
839 saved backup bundle to $TESTTMP/foo.hg
839 saved backup bundle to $TESTTMP/foo.hg
840 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
840 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
841 saved backup bundle to $TESTTMP/foo.hg
841 saved backup bundle to $TESTTMP/foo.hg
842 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
842 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
843 saved backup bundle to $TESTTMP/*.hg (glob)<
843 saved backup bundle to $TESTTMP/*.hg (glob)<
844
844
845 $ rm test-failure.t
845 $ rm test-failure.t
846
846
847 Race condition - test file was modified when test is running
847 Race condition - test file was modified when test is running
848
848
849 $ TESTRACEDIR=`pwd`
849 $ TESTRACEDIR=`pwd`
850 $ export TESTRACEDIR
850 $ export TESTRACEDIR
851 $ cat > test-race.t <<EOF
851 $ cat > test-race.t <<EOF
852 > $ echo 1
852 > $ echo 1
853 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
853 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
854 > EOF
854 > EOF
855
855
856 $ rt -i test-race.t
856 $ rt -i test-race.t
857 running 1 tests using 1 parallel processes
857 running 1 tests using 1 parallel processes
858
858
859 --- $TESTTMP/test-race.t
859 --- $TESTTMP/test-race.t
860 +++ $TESTTMP/test-race.t.err
860 +++ $TESTTMP/test-race.t.err
861 @@ -1,2 +1,3 @@
861 @@ -1,2 +1,3 @@
862 $ echo 1
862 $ echo 1
863 + 1
863 + 1
864 $ echo "# a new line" >> $TESTTMP/test-race.t
864 $ echo "# a new line" >> $TESTTMP/test-race.t
865 Reference output has changed (run again to prompt changes)
865 Reference output has changed (run again to prompt changes)
866 ERROR: test-race.t output changed
866 ERROR: test-race.t output changed
867 !
867 !
868 Failed test-race.t: output changed
868 Failed test-race.t: output changed
869 # Ran 1 tests, 0 skipped, 1 failed.
869 # Ran 1 tests, 0 skipped, 1 failed.
870 python hash seed: * (glob)
870 python hash seed: * (glob)
871 [1]
871 [1]
872
872
873 $ rm test-race.t
873 $ rm test-race.t
874
874
875 When "#testcases" is used in .t files
875 When "#testcases" is used in .t files
876
876
877 $ cat >> test-cases.t <<EOF
877 $ cat >> test-cases.t <<EOF
878 > #testcases a b
878 > #testcases a b
879 > #if a
879 > #if a
880 > $ echo 1
880 > $ echo 1
881 > #endif
881 > #endif
882 > #if b
882 > #if b
883 > $ echo 2
883 > $ echo 2
884 > #endif
884 > #endif
885 > EOF
885 > EOF
886
886
887 $ cat <<EOF | rt -i test-cases.t 2>&1
887 $ cat <<EOF | rt -i test-cases.t 2>&1
888 > y
888 > y
889 > y
889 > y
890 > EOF
890 > EOF
891 running 2 tests using 1 parallel processes
891 running 2 tests using 1 parallel processes
892
892
893 --- $TESTTMP/test-cases.t
893 --- $TESTTMP/test-cases.t
894 +++ $TESTTMP/test-cases.t#a.err
894 +++ $TESTTMP/test-cases.t#a.err
895 @@ -1,6 +1,7 @@
895 @@ -1,6 +1,7 @@
896 #testcases a b
896 #testcases a b
897 #if a
897 #if a
898 $ echo 1
898 $ echo 1
899 + 1
899 + 1
900 #endif
900 #endif
901 #if b
901 #if b
902 $ echo 2
902 $ echo 2
903 Accept this change? [y/N] .
903 Accept this change? [y/N] .
904 --- $TESTTMP/test-cases.t
904 --- $TESTTMP/test-cases.t
905 +++ $TESTTMP/test-cases.t#b.err
905 +++ $TESTTMP/test-cases.t#b.err
906 @@ -5,4 +5,5 @@
906 @@ -5,4 +5,5 @@
907 #endif
907 #endif
908 #if b
908 #if b
909 $ echo 2
909 $ echo 2
910 + 2
910 + 2
911 #endif
911 #endif
912 Accept this change? [y/N] .
912 Accept this change? [y/N] .
913 # Ran 2 tests, 0 skipped, 0 failed.
913 # Ran 2 tests, 0 skipped, 0 failed.
914
914
915 $ cat test-cases.t
915 $ cat test-cases.t
916 #testcases a b
916 #testcases a b
917 #if a
917 #if a
918 $ echo 1
918 $ echo 1
919 1
919 1
920 #endif
920 #endif
921 #if b
921 #if b
922 $ echo 2
922 $ echo 2
923 2
923 2
924 #endif
924 #endif
925
925
926 $ cat >> test-cases.t <<'EOF'
926 $ cat >> test-cases.t <<'EOF'
927 > #if a
927 > #if a
928 > $ NAME=A
928 > $ NAME=A
929 > #else
929 > #else
930 > $ NAME=B
930 > $ NAME=B
931 > #endif
931 > #endif
932 > $ echo $NAME
932 > $ echo $NAME
933 > A (a !)
933 > A (a !)
934 > B (b !)
934 > B (b !)
935 > EOF
935 > EOF
936 $ rt test-cases.t
936 $ rt test-cases.t
937 running 2 tests using 1 parallel processes
937 running 2 tests using 1 parallel processes
938 ..
938 ..
939 # Ran 2 tests, 0 skipped, 0 failed.
939 # Ran 2 tests, 0 skipped, 0 failed.
940
940
941 When using multiple dimensions of "#testcases" in .t files
941 When using multiple dimensions of "#testcases" in .t files
942
942
943 $ cat > test-cases.t <<'EOF'
943 $ cat > test-cases.t <<'EOF'
944 > #testcases a b
944 > #testcases a b
945 > #testcases c d
945 > #testcases c d
946 > #if a d
946 > #if a d
947 > $ echo $TESTCASE
947 > $ echo $TESTCASE
948 > a#d
948 > a#d
949 > #endif
949 > #endif
950 > #if b c
950 > #if b c
951 > $ echo yes
951 > $ echo yes
952 > no
952 > no
953 > #endif
953 > #endif
954 > EOF
954 > EOF
955 $ rt test-cases.t
955 $ rt test-cases.t
956 running 4 tests using 1 parallel processes
956 running 4 tests using 1 parallel processes
957 ..
957 ..
958 --- $TESTTMP/test-cases.t
958 --- $TESTTMP/test-cases.t
959 +++ $TESTTMP/test-cases.t#b#c.err
959 +++ $TESTTMP/test-cases.t#b#c.err
960 @@ -6,5 +6,5 @@
960 @@ -6,5 +6,5 @@
961 #endif
961 #endif
962 #if b c
962 #if b c
963 $ echo yes
963 $ echo yes
964 - no
964 - no
965 + yes
965 + yes
966 #endif
966 #endif
967
967
968 ERROR: test-cases.t#b#c output changed
968 ERROR: test-cases.t#b#c output changed
969 !.
969 !.
970 Failed test-cases.t#b#c: output changed
970 Failed test-cases.t#b#c: output changed
971 # Ran 4 tests, 0 skipped, 1 failed.
971 # Ran 4 tests, 0 skipped, 1 failed.
972 python hash seed: * (glob)
972 python hash seed: * (glob)
973 [1]
973 [1]
974
974
975 $ rt --retest
975 $ rt --retest
976 running 1 tests using 1 parallel processes
976 running 1 tests using 1 parallel processes
977
977
978 --- $TESTTMP/test-cases.t
978 --- $TESTTMP/test-cases.t
979 +++ $TESTTMP/test-cases.t#b#c.err
979 +++ $TESTTMP/test-cases.t#b#c.err
980 @@ -6,5 +6,5 @@
980 @@ -6,5 +6,5 @@
981 #endif
981 #endif
982 #if b c
982 #if b c
983 $ echo yes
983 $ echo yes
984 - no
984 - no
985 + yes
985 + yes
986 #endif
986 #endif
987
987
988 ERROR: test-cases.t#b#c output changed
988 ERROR: test-cases.t#b#c output changed
989 !
989 !
990 Failed test-cases.t#b#c: output changed
990 Failed test-cases.t#b#c: output changed
991 # Ran 1 tests, 0 skipped, 1 failed.
991 # Ran 1 tests, 0 skipped, 1 failed.
992 python hash seed: * (glob)
992 python hash seed: * (glob)
993 [1]
993 [1]
994 $ rm test-cases.t#b#c.err
994 $ rm test-cases.t#b#c.err
995 $ rm test-cases.t
995 $ rm test-cases.t
996
996
997 (reinstall)
997 (reinstall)
998 $ mv backup test-failure.t
998 $ mv backup test-failure.t
999
999
1000 No Diff
1000 No Diff
1001 ===============
1001 ===============
1002
1002
1003 $ rt --nodiff
1003 $ rt --nodiff
1004 running 2 tests using 1 parallel processes
1004 running 2 tests using 1 parallel processes
1005 !.
1005 !.
1006 Failed test-failure.t: output changed
1006 Failed test-failure.t: output changed
1007 # Ran 2 tests, 0 skipped, 1 failed.
1007 # Ran 2 tests, 0 skipped, 1 failed.
1008 python hash seed: * (glob)
1008 python hash seed: * (glob)
1009 [1]
1009 [1]
1010
1010
1011 test --tmpdir support
1011 test --tmpdir support
1012 $ rt --tmpdir=$TESTTMP/keep test-success.t
1012 $ rt --tmpdir=$TESTTMP/keep test-success.t
1013 running 1 tests using 1 parallel processes
1013 running 1 tests using 1 parallel processes
1014
1014
1015 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
1015 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
1016 Keeping threadtmp dir: $TESTTMP/keep/child1
1016 Keeping threadtmp dir: $TESTTMP/keep/child1
1017 .
1017 .
1018 # Ran 1 tests, 0 skipped, 0 failed.
1018 # Ran 1 tests, 0 skipped, 0 failed.
1019
1019
1020 timeouts
1020 timeouts
1021 ========
1021 ========
1022 $ cat > test-timeout.t <<EOF
1022 $ cat > test-timeout.t <<EOF
1023 > $ sleep 2
1023 > $ sleep 2
1024 > $ echo pass
1024 > $ echo pass
1025 > pass
1025 > pass
1026 > EOF
1026 > EOF
1027 > echo '#require slow' > test-slow-timeout.t
1027 > echo '#require slow' > test-slow-timeout.t
1028 > cat test-timeout.t >> test-slow-timeout.t
1028 > cat test-timeout.t >> test-slow-timeout.t
1029 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
1029 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
1030 running 2 tests using 1 parallel processes
1030 running 2 tests using 1 parallel processes
1031 st
1031 st
1032 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
1032 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
1033 Failed test-timeout.t: timed out
1033 Failed test-timeout.t: timed out
1034 # Ran 1 tests, 1 skipped, 1 failed.
1034 # Ran 1 tests, 1 skipped, 1 failed.
1035 python hash seed: * (glob)
1035 python hash seed: * (glob)
1036 [1]
1036 [1]
1037 $ rt --timeout=1 --slowtimeout=3 \
1037 $ rt --timeout=1 --slowtimeout=3 \
1038 > test-timeout.t test-slow-timeout.t --allow-slow-tests
1038 > test-timeout.t test-slow-timeout.t --allow-slow-tests
1039 running 2 tests using 1 parallel processes
1039 running 2 tests using 1 parallel processes
1040 .t
1040 .t
1041 Failed test-timeout.t: timed out
1041 Failed test-timeout.t: timed out
1042 # Ran 2 tests, 0 skipped, 1 failed.
1042 # Ran 2 tests, 0 skipped, 1 failed.
1043 python hash seed: * (glob)
1043 python hash seed: * (glob)
1044 [1]
1044 [1]
1045 $ rm test-timeout.t test-slow-timeout.t
1045 $ rm test-timeout.t test-slow-timeout.t
1046
1046
1047 test for --time
1047 test for --time
1048 ==================
1048 ==================
1049
1049
1050 $ rt test-success.t --time
1050 $ rt test-success.t --time
1051 running 1 tests using 1 parallel processes
1051 running 1 tests using 1 parallel processes
1052 .
1052 .
1053 # Ran 1 tests, 0 skipped, 0 failed.
1053 # Ran 1 tests, 0 skipped, 0 failed.
1054 # Producing time report
1054 # Producing time report
1055 start end cuser csys real Test
1055 start end cuser csys real Test
1056 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1056 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1057
1057
1058 test for --time with --job enabled
1058 test for --time with --job enabled
1059 ====================================
1059 ====================================
1060
1060
1061 $ rt test-success.t --time --jobs 2
1061 $ rt test-success.t --time --jobs 2
1062 running 1 tests using 1 parallel processes
1062 running 1 tests using 1 parallel processes
1063 .
1063 .
1064 # Ran 1 tests, 0 skipped, 0 failed.
1064 # Ran 1 tests, 0 skipped, 0 failed.
1065 # Producing time report
1065 # Producing time report
1066 start end cuser csys real Test
1066 start end cuser csys real Test
1067 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1067 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1068
1068
1069 Skips
1069 Skips
1070 ================
1070 ================
1071 $ cat > test-skip.t <<EOF
1071 $ cat > test-skip.t <<EOF
1072 > $ echo xyzzy
1072 > $ echo xyzzy
1073 > #if true
1073 > #if true
1074 > #require false
1074 > #require false
1075 > #end
1075 > #end
1076 > EOF
1076 > EOF
1077 $ cat > test-noskip.t <<EOF
1077 $ cat > test-noskip.t <<EOF
1078 > #if false
1078 > #if false
1079 > #require false
1079 > #require false
1080 > #endif
1080 > #endif
1081 > EOF
1081 > EOF
1082 $ rt --nodiff
1082 $ rt --nodiff
1083 running 4 tests using 1 parallel processes
1083 running 4 tests using 1 parallel processes
1084 !.s.
1084 !.s.
1085 Skipped test-skip.t: missing feature: nail clipper
1085 Skipped test-skip.t: missing feature: nail clipper
1086 Failed test-failure.t: output changed
1086 Failed test-failure.t: output changed
1087 # Ran 3 tests, 1 skipped, 1 failed.
1087 # Ran 3 tests, 1 skipped, 1 failed.
1088 python hash seed: * (glob)
1088 python hash seed: * (glob)
1089 [1]
1089 [1]
1090
1090
1091 $ rm test-noskip.t
1091 $ rm test-noskip.t
1092 $ rt --keyword xyzzy
1092 $ rt --keyword xyzzy
1093 running 3 tests using 1 parallel processes
1093 running 3 tests using 1 parallel processes
1094 .s
1094 .s
1095 Skipped test-skip.t: missing feature: nail clipper
1095 Skipped test-skip.t: missing feature: nail clipper
1096 # Ran 2 tests, 2 skipped, 0 failed.
1096 # Ran 2 tests, 2 skipped, 0 failed.
1097
1097
1098 Skips with xml
1098 Skips with xml
1099 $ rt --keyword xyzzy \
1099 $ rt --keyword xyzzy \
1100 > --xunit=xunit.xml
1100 > --xunit=xunit.xml
1101 running 3 tests using 1 parallel processes
1101 running 3 tests using 1 parallel processes
1102 .s
1102 .s
1103 Skipped test-skip.t: missing feature: nail clipper
1103 Skipped test-skip.t: missing feature: nail clipper
1104 # Ran 2 tests, 2 skipped, 0 failed.
1104 # Ran 2 tests, 2 skipped, 0 failed.
1105 $ cat xunit.xml
1105 $ cat xunit.xml
1106 <?xml version="1.0" encoding="utf-8"?>
1106 <?xml version="1.0" encoding="utf-8"?>
1107 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
1107 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
1108 <testcase name="test-success.t" time="*"/> (glob)
1108 <testcase name="test-success.t" time="*"/> (glob)
1109 <testcase name="test-skip.t">
1109 <testcase name="test-skip.t">
1110 <skipped><![CDATA[missing feature: nail clipper]]></skipped> (py38 !)
1110 <skipped><![CDATA[missing feature: nail clipper]]></skipped> (py38 !)
1111 <skipped> (no-py38 !)
1111 <skipped> (no-py38 !)
1112 <![CDATA[missing feature: nail clipper]]> </skipped> (no-py38 !)
1112 <![CDATA[missing feature: nail clipper]]> </skipped> (no-py38 !)
1113 </testcase>
1113 </testcase>
1114 </testsuite>
1114 </testsuite>
1115
1115
1116 Missing skips or blacklisted skips don't count as executed:
1116 Missing skips or blacklisted skips don't count as executed:
1117 $ mkdir tests
1117 $ mkdir tests
1118 $ echo tests/test-failure.t > blacklist
1118 $ echo tests/test-failure.t > blacklist
1119 $ cp test-failure.t tests
1119 $ cp test-failure.t tests
1120 $ rt --blacklist=blacklist --json\
1120 $ rt --blacklist=blacklist --json\
1121 > tests/test-failure.t tests/test-bogus.t
1121 > tests/test-failure.t tests/test-bogus.t
1122 running 2 tests using 1 parallel processes
1122 running 2 tests using 1 parallel processes
1123 ss
1123 ss
1124 Skipped test-bogus.t: Doesn't exist
1124 Skipped test-bogus.t: Doesn't exist
1125 Skipped test-failure.t: blacklisted
1125 Skipped test-failure.t: blacklisted
1126 # Ran 0 tests, 2 skipped, 0 failed.
1126 # Ran 0 tests, 2 skipped, 0 failed.
1127 $ cat tests/report.json
1127 $ cat tests/report.json
1128 testreport ={
1128 testreport ={
1129 "test-bogus.t": {
1129 "test-bogus.t": {
1130 "result": "skip"
1130 "result": "skip"
1131 },
1131 },
1132 "test-failure.t": {
1132 "test-failure.t": {
1133 "result": "skip"
1133 "result": "skip"
1134 }
1134 }
1135 } (no-eol)
1135 } (no-eol)
1136 $ rm -r tests
1136 $ rm -r tests
1137 $ echo test-failure.t > blacklist
1137 $ echo test-failure.t > blacklist
1138
1138
1139 Whitelist trumps blacklist
1139 Whitelist trumps blacklist
1140 $ echo test-failure.t > whitelist
1140 $ echo test-failure.t > whitelist
1141 $ rt --blacklist=blacklist --whitelist=whitelist --json\
1141 $ rt --blacklist=blacklist --whitelist=whitelist --json\
1142 > test-failure.t test-bogus.t
1142 > test-failure.t test-bogus.t
1143 running 2 tests using 1 parallel processes
1143 running 2 tests using 1 parallel processes
1144 s
1144 s
1145 --- $TESTTMP/test-failure.t
1145 --- $TESTTMP/test-failure.t
1146 +++ $TESTTMP/test-failure.t.err
1146 +++ $TESTTMP/test-failure.t.err
1147 @@ -1,5 +1,5 @@
1147 @@ -1,5 +1,5 @@
1148 $ echo babar
1148 $ echo babar
1149 - rataxes
1149 - rataxes
1150 + babar
1150 + babar
1151 This is a noop statement so that
1151 This is a noop statement so that
1152 this test is still more bytes than success.
1152 this test is still more bytes than success.
1153 pad pad pad pad............................................................
1153 pad pad pad pad............................................................
1154
1154
1155 ERROR: test-failure.t output changed
1155 ERROR: test-failure.t output changed
1156 !
1156 !
1157 Skipped test-bogus.t: Doesn't exist
1157 Skipped test-bogus.t: Doesn't exist
1158 Failed test-failure.t: output changed
1158 Failed test-failure.t: output changed
1159 # Ran 1 tests, 1 skipped, 1 failed.
1159 # Ran 1 tests, 1 skipped, 1 failed.
1160 python hash seed: * (glob)
1160 python hash seed: * (glob)
1161 [1]
1161 [1]
1162
1162
1163 Ensure that --test-list causes only the tests listed in that file to
1163 Ensure that --test-list causes only the tests listed in that file to
1164 be executed.
1164 be executed.
1165 $ echo test-success.t >> onlytest
1165 $ echo test-success.t >> onlytest
1166 $ rt --test-list=onlytest
1166 $ rt --test-list=onlytest
1167 running 1 tests using 1 parallel processes
1167 running 1 tests using 1 parallel processes
1168 .
1168 .
1169 # Ran 1 tests, 0 skipped, 0 failed.
1169 # Ran 1 tests, 0 skipped, 0 failed.
1170 $ echo test-bogus.t >> anothertest
1170 $ echo test-bogus.t >> anothertest
1171 $ rt --test-list=onlytest --test-list=anothertest
1171 $ rt --test-list=onlytest --test-list=anothertest
1172 running 2 tests using 1 parallel processes
1172 running 2 tests using 1 parallel processes
1173 s.
1173 s.
1174 Skipped test-bogus.t: Doesn't exist
1174 Skipped test-bogus.t: Doesn't exist
1175 # Ran 1 tests, 1 skipped, 0 failed.
1175 # Ran 1 tests, 1 skipped, 0 failed.
1176 $ rm onlytest anothertest
1176 $ rm onlytest anothertest
1177
1177
1178 test for --json
1178 test for --json
1179 ==================
1179 ==================
1180
1180
1181 $ rt --json
1181 $ rt --json
1182 running 3 tests using 1 parallel processes
1182 running 3 tests using 1 parallel processes
1183
1183
1184 --- $TESTTMP/test-failure.t
1184 --- $TESTTMP/test-failure.t
1185 +++ $TESTTMP/test-failure.t.err
1185 +++ $TESTTMP/test-failure.t.err
1186 @@ -1,5 +1,5 @@
1186 @@ -1,5 +1,5 @@
1187 $ echo babar
1187 $ echo babar
1188 - rataxes
1188 - rataxes
1189 + babar
1189 + babar
1190 This is a noop statement so that
1190 This is a noop statement so that
1191 this test is still more bytes than success.
1191 this test is still more bytes than success.
1192 pad pad pad pad............................................................
1192 pad pad pad pad............................................................
1193
1193
1194 ERROR: test-failure.t output changed
1194 ERROR: test-failure.t output changed
1195 !.s
1195 !.s
1196 Skipped test-skip.t: missing feature: nail clipper
1196 Skipped test-skip.t: missing feature: nail clipper
1197 Failed test-failure.t: output changed
1197 Failed test-failure.t: output changed
1198 # Ran 2 tests, 1 skipped, 1 failed.
1198 # Ran 2 tests, 1 skipped, 1 failed.
1199 python hash seed: * (glob)
1199 python hash seed: * (glob)
1200 [1]
1200 [1]
1201
1201
1202 $ cat report.json
1202 $ cat report.json
1203 testreport ={
1203 testreport ={
1204 "test-failure.t": [\{] (re)
1204 "test-failure.t": [\{] (re)
1205 "csys": "\s*\d+\.\d{3,4}", ? (re)
1205 "csys": "\s*\d+\.\d{3,4}", ? (re)
1206 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1206 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1207 "diff": "---.+\+\+\+.+", ? (re)
1207 "diff": "---.+\+\+\+.+", ? (re)
1208 "end": "\s*\d+\.\d{3,4}", ? (re)
1208 "end": "\s*\d+\.\d{3,4}", ? (re)
1209 "result": "failure", ? (re)
1209 "result": "failure", ? (re)
1210 "start": "\s*\d+\.\d{3,4}", ? (re)
1210 "start": "\s*\d+\.\d{3,4}", ? (re)
1211 "time": "\s*\d+\.\d{3,4}" (re)
1211 "time": "\s*\d+\.\d{3,4}" (re)
1212 }, ? (re)
1212 }, ? (re)
1213 "test-skip.t": {
1213 "test-skip.t": {
1214 "csys": "\s*\d+\.\d{3,4}", ? (re)
1214 "csys": "\s*\d+\.\d{3,4}", ? (re)
1215 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1215 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1216 "diff": "", ? (re)
1216 "diff": "", ? (re)
1217 "end": "\s*\d+\.\d{3,4}", ? (re)
1217 "end": "\s*\d+\.\d{3,4}", ? (re)
1218 "result": "skip", ? (re)
1218 "result": "skip", ? (re)
1219 "start": "\s*\d+\.\d{3,4}", ? (re)
1219 "start": "\s*\d+\.\d{3,4}", ? (re)
1220 "time": "\s*\d+\.\d{3,4}" (re)
1220 "time": "\s*\d+\.\d{3,4}" (re)
1221 }, ? (re)
1221 }, ? (re)
1222 "test-success.t": [\{] (re)
1222 "test-success.t": [\{] (re)
1223 "csys": "\s*\d+\.\d{3,4}", ? (re)
1223 "csys": "\s*\d+\.\d{3,4}", ? (re)
1224 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1224 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1225 "diff": "", ? (re)
1225 "diff": "", ? (re)
1226 "end": "\s*\d+\.\d{3,4}", ? (re)
1226 "end": "\s*\d+\.\d{3,4}", ? (re)
1227 "result": "success", ? (re)
1227 "result": "success", ? (re)
1228 "start": "\s*\d+\.\d{3,4}", ? (re)
1228 "start": "\s*\d+\.\d{3,4}", ? (re)
1229 "time": "\s*\d+\.\d{3,4}" (re)
1229 "time": "\s*\d+\.\d{3,4}" (re)
1230 }
1230 }
1231 } (no-eol)
1231 } (no-eol)
1232 --json with --outputdir
1232 --json with --outputdir
1233
1233
1234 $ rm report.json
1234 $ rm report.json
1235 $ rm -r output
1235 $ rm -r output
1236 $ mkdir output
1236 $ mkdir output
1237 $ rt --json --outputdir output
1237 $ rt --json --outputdir output
1238 running 3 tests using 1 parallel processes
1238 running 3 tests using 1 parallel processes
1239
1239
1240 --- $TESTTMP/test-failure.t
1240 --- $TESTTMP/test-failure.t
1241 +++ $TESTTMP/output/test-failure.t.err
1241 +++ $TESTTMP/output/test-failure.t.err
1242 @@ -1,5 +1,5 @@
1242 @@ -1,5 +1,5 @@
1243 $ echo babar
1243 $ echo babar
1244 - rataxes
1244 - rataxes
1245 + babar
1245 + babar
1246 This is a noop statement so that
1246 This is a noop statement so that
1247 this test is still more bytes than success.
1247 this test is still more bytes than success.
1248 pad pad pad pad............................................................
1248 pad pad pad pad............................................................
1249
1249
1250 ERROR: test-failure.t output changed
1250 ERROR: test-failure.t output changed
1251 !.s
1251 !.s
1252 Skipped test-skip.t: missing feature: nail clipper
1252 Skipped test-skip.t: missing feature: nail clipper
1253 Failed test-failure.t: output changed
1253 Failed test-failure.t: output changed
1254 # Ran 2 tests, 1 skipped, 1 failed.
1254 # Ran 2 tests, 1 skipped, 1 failed.
1255 python hash seed: * (glob)
1255 python hash seed: * (glob)
1256 [1]
1256 [1]
1257 $ f report.json
1257 $ f report.json
1258 report.json: file not found
1258 report.json: file not found
1259 $ cat output/report.json
1259 $ cat output/report.json
1260 testreport ={
1260 testreport ={
1261 "test-failure.t": [\{] (re)
1261 "test-failure.t": [\{] (re)
1262 "csys": "\s*\d+\.\d{3,4}", ? (re)
1262 "csys": "\s*\d+\.\d{3,4}", ? (re)
1263 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1263 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1264 "diff": "---.+\+\+\+.+", ? (re)
1264 "diff": "---.+\+\+\+.+", ? (re)
1265 "end": "\s*\d+\.\d{3,4}", ? (re)
1265 "end": "\s*\d+\.\d{3,4}", ? (re)
1266 "result": "failure", ? (re)
1266 "result": "failure", ? (re)
1267 "start": "\s*\d+\.\d{3,4}", ? (re)
1267 "start": "\s*\d+\.\d{3,4}", ? (re)
1268 "time": "\s*\d+\.\d{3,4}" (re)
1268 "time": "\s*\d+\.\d{3,4}" (re)
1269 }, ? (re)
1269 }, ? (re)
1270 "test-skip.t": {
1270 "test-skip.t": {
1271 "csys": "\s*\d+\.\d{3,4}", ? (re)
1271 "csys": "\s*\d+\.\d{3,4}", ? (re)
1272 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1272 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1273 "diff": "", ? (re)
1273 "diff": "", ? (re)
1274 "end": "\s*\d+\.\d{3,4}", ? (re)
1274 "end": "\s*\d+\.\d{3,4}", ? (re)
1275 "result": "skip", ? (re)
1275 "result": "skip", ? (re)
1276 "start": "\s*\d+\.\d{3,4}", ? (re)
1276 "start": "\s*\d+\.\d{3,4}", ? (re)
1277 "time": "\s*\d+\.\d{3,4}" (re)
1277 "time": "\s*\d+\.\d{3,4}" (re)
1278 }, ? (re)
1278 }, ? (re)
1279 "test-success.t": [\{] (re)
1279 "test-success.t": [\{] (re)
1280 "csys": "\s*\d+\.\d{3,4}", ? (re)
1280 "csys": "\s*\d+\.\d{3,4}", ? (re)
1281 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1281 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1282 "diff": "", ? (re)
1282 "diff": "", ? (re)
1283 "end": "\s*\d+\.\d{3,4}", ? (re)
1283 "end": "\s*\d+\.\d{3,4}", ? (re)
1284 "result": "success", ? (re)
1284 "result": "success", ? (re)
1285 "start": "\s*\d+\.\d{3,4}", ? (re)
1285 "start": "\s*\d+\.\d{3,4}", ? (re)
1286 "time": "\s*\d+\.\d{3,4}" (re)
1286 "time": "\s*\d+\.\d{3,4}" (re)
1287 }
1287 }
1288 } (no-eol)
1288 } (no-eol)
1289 $ ls -a output
1289 $ ls -a output
1290 .
1290 .
1291 ..
1291 ..
1292 .testtimes
1292 .testtimes
1293 report.json
1293 report.json
1294 test-failure.t.err
1294 test-failure.t.err
1295
1295
1296 Test that failed test accepted through interactive are properly reported:
1296 Test that failed test accepted through interactive are properly reported:
1297
1297
1298 $ cp test-failure.t backup
1298 $ cp test-failure.t backup
1299 $ echo y | rt --json -i
1299 $ echo y | rt --json -i
1300 running 3 tests using 1 parallel processes
1300 running 3 tests using 1 parallel processes
1301
1301
1302 --- $TESTTMP/test-failure.t
1302 --- $TESTTMP/test-failure.t
1303 +++ $TESTTMP/test-failure.t.err
1303 +++ $TESTTMP/test-failure.t.err
1304 @@ -1,5 +1,5 @@
1304 @@ -1,5 +1,5 @@
1305 $ echo babar
1305 $ echo babar
1306 - rataxes
1306 - rataxes
1307 + babar
1307 + babar
1308 This is a noop statement so that
1308 This is a noop statement so that
1309 this test is still more bytes than success.
1309 this test is still more bytes than success.
1310 pad pad pad pad............................................................
1310 pad pad pad pad............................................................
1311 Accept this change? [y/N] ..s
1311 Accept this change? [y/N] ..s
1312 Skipped test-skip.t: missing feature: nail clipper
1312 Skipped test-skip.t: missing feature: nail clipper
1313 # Ran 2 tests, 1 skipped, 0 failed.
1313 # Ran 2 tests, 1 skipped, 0 failed.
1314
1314
1315 $ cat report.json
1315 $ cat report.json
1316 testreport ={
1316 testreport ={
1317 "test-failure.t": [\{] (re)
1317 "test-failure.t": [\{] (re)
1318 "csys": "\s*\d+\.\d{3,4}", ? (re)
1318 "csys": "\s*\d+\.\d{3,4}", ? (re)
1319 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1319 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1320 "diff": "", ? (re)
1320 "diff": "", ? (re)
1321 "end": "\s*\d+\.\d{3,4}", ? (re)
1321 "end": "\s*\d+\.\d{3,4}", ? (re)
1322 "result": "success", ? (re)
1322 "result": "success", ? (re)
1323 "start": "\s*\d+\.\d{3,4}", ? (re)
1323 "start": "\s*\d+\.\d{3,4}", ? (re)
1324 "time": "\s*\d+\.\d{3,4}" (re)
1324 "time": "\s*\d+\.\d{3,4}" (re)
1325 }, ? (re)
1325 }, ? (re)
1326 "test-skip.t": {
1326 "test-skip.t": {
1327 "csys": "\s*\d+\.\d{3,4}", ? (re)
1327 "csys": "\s*\d+\.\d{3,4}", ? (re)
1328 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1328 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1329 "diff": "", ? (re)
1329 "diff": "", ? (re)
1330 "end": "\s*\d+\.\d{3,4}", ? (re)
1330 "end": "\s*\d+\.\d{3,4}", ? (re)
1331 "result": "skip", ? (re)
1331 "result": "skip", ? (re)
1332 "start": "\s*\d+\.\d{3,4}", ? (re)
1332 "start": "\s*\d+\.\d{3,4}", ? (re)
1333 "time": "\s*\d+\.\d{3,4}" (re)
1333 "time": "\s*\d+\.\d{3,4}" (re)
1334 }, ? (re)
1334 }, ? (re)
1335 "test-success.t": [\{] (re)
1335 "test-success.t": [\{] (re)
1336 "csys": "\s*\d+\.\d{3,4}", ? (re)
1336 "csys": "\s*\d+\.\d{3,4}", ? (re)
1337 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1337 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1338 "diff": "", ? (re)
1338 "diff": "", ? (re)
1339 "end": "\s*\d+\.\d{3,4}", ? (re)
1339 "end": "\s*\d+\.\d{3,4}", ? (re)
1340 "result": "success", ? (re)
1340 "result": "success", ? (re)
1341 "start": "\s*\d+\.\d{3,4}", ? (re)
1341 "start": "\s*\d+\.\d{3,4}", ? (re)
1342 "time": "\s*\d+\.\d{3,4}" (re)
1342 "time": "\s*\d+\.\d{3,4}" (re)
1343 }
1343 }
1344 } (no-eol)
1344 } (no-eol)
1345 $ mv backup test-failure.t
1345 $ mv backup test-failure.t
1346
1346
1347 backslash on end of line with glob matching is handled properly
1347 backslash on end of line with glob matching is handled properly
1348
1348
1349 $ cat > test-glob-backslash.t << EOF
1349 $ cat > test-glob-backslash.t << EOF
1350 > $ echo 'foo bar \\'
1350 > $ echo 'foo bar \\'
1351 > foo * \ (glob)
1351 > foo * \ (glob)
1352 > EOF
1352 > EOF
1353
1353
1354 $ rt test-glob-backslash.t
1354 $ rt test-glob-backslash.t
1355 running 1 tests using 1 parallel processes
1355 running 1 tests using 1 parallel processes
1356 .
1356 .
1357 # Ran 1 tests, 0 skipped, 0 failed.
1357 # Ran 1 tests, 0 skipped, 0 failed.
1358
1358
1359 $ rm -f test-glob-backslash.t
1359 $ rm -f test-glob-backslash.t
1360
1360
1361 Test globbing of local IP addresses
1361 Test globbing of local IP addresses
1362 $ echo 172.16.18.1
1362 $ echo 172.16.18.1
1363 $LOCALIP (glob)
1363 $LOCALIP (glob)
1364 $ echo dead:beef::1
1364 $ echo dead:beef::1
1365 $LOCALIP (glob)
1365 $LOCALIP (glob)
1366
1366
1367 Add support for external test formatter
1367 Add support for external test formatter
1368 =======================================
1368 =======================================
1369
1369
1370 $ CUSTOM_TEST_RESULT=basic_test_result "$PYTHON" $TESTDIR/run-tests.py --with-hg=$HGTEST_REAL_HG -j1 "$@" test-success.t test-failure.t
1370 $ CUSTOM_TEST_RESULT=basic_test_result "$PYTHON" $TESTDIR/run-tests.py --with-hg=$HGTEST_REAL_HG -j1 "$@" test-success.t test-failure.t
1371 running 2 tests using 1 parallel processes
1371 running 2 tests using 1 parallel processes
1372
1372
1373 # Ran 2 tests, 0 skipped, 0 failed.
1373 # Ran 2 tests, 0 skipped, 0 failed.
1374 ON_START! <__main__.TestSuite tests=[<__main__.TTest testMethod=test-failure.t>, <__main__.TTest testMethod=test-success.t>]>
1374 ON_START! <__main__.TestSuite tests=[<__main__.TTest testMethod=test-failure.t>, <__main__.TTest testMethod=test-success.t>]>
1375 FAILURE! test-failure.t output changed
1375 FAILURE! test-failure.t output changed
1376 SUCCESS! test-success.t
1376 SUCCESS! test-success.t
1377 ON_END!
1377 ON_END!
1378
1378
1379 Test reusability for third party tools
1379 Test reusability for third party tools
1380 ======================================
1380 ======================================
1381
1381
1382 $ THISTESTDIR="$TESTDIR"
1382 $ THISTESTDIR="$TESTDIR"
1383 $ export THISTESTDIR
1383 $ export THISTESTDIR
1384 $ THISTESTTMP="$TESTTMP"
1384 $ THISTESTTMP="$TESTTMP"
1385 $ export THISTESTTMP
1385 $ export THISTESTTMP
1386
1386
1387 #if windows
1387 #if windows
1388
1388
1389 $ NEWTESTDIR="$THISTESTTMP"\\anothertests
1389 $ NEWTESTDIR="$THISTESTTMP"\\anothertests
1390
1390
1391 #else
1391 #else
1392
1392
1393 $ NEWTESTDIR="$THISTESTTMP"/anothertests
1393 $ NEWTESTDIR="$THISTESTTMP"/anothertests
1394
1394
1395 #endif
1395 #endif
1396
1396
1397 $ export NEWTESTDIR
1397 $ export NEWTESTDIR
1398
1398
1399 $ echo creating some new test in: $NEWTESTDIR
1399 $ echo creating some new test in: $NEWTESTDIR
1400 creating some new test in: $TESTTMP\anothertests (windows !)
1400 creating some new test in: $TESTTMP\anothertests (windows !)
1401 creating some new test in: $TESTTMP/anothertests (no-windows !)
1401 creating some new test in: $TESTTMP/anothertests (no-windows !)
1402 $ mkdir "$NEWTESTDIR"
1402 $ mkdir "$NEWTESTDIR"
1403 $ cd "$NEWTESTDIR"
1403 $ cd "$NEWTESTDIR"
1404
1404
1405 test that `run-tests.py` can execute hghave, even if it runs not in
1405 test that `run-tests.py` can execute hghave, even if it runs not in
1406 Mercurial source tree.
1406 Mercurial source tree.
1407
1407
1408 $ cat > test-hghave.t <<EOF
1408 $ cat > test-hghave.t <<EOF
1409 > #require true
1409 > #require true
1410 > $ echo foo
1410 > $ echo foo
1411 > foo
1411 > foo
1412 > EOF
1412 > EOF
1413 $ rt test-hghave.t
1413 $ rt test-hghave.t
1414 running 1 tests using 1 parallel processes
1414 running 1 tests using 1 parallel processes
1415 .
1415 .
1416 # Ran 1 tests, 0 skipped, 0 failed.
1416 # Ran 1 tests, 0 skipped, 0 failed.
1417
1417
1418 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1418 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1419 running is placed.
1419 running is placed.
1420
1420
1421
1421
1422 $ cat > test-runtestdir.t <<EOF
1422 $ cat > test-runtestdir.t <<EOF
1423 > # \$THISTESTDIR, in which test-run-tests.t (this test file) is placed
1423 > # \$THISTESTDIR, in which test-run-tests.t (this test file) is placed
1424 > # \$THISTESTTMP, in which test-run-tests.t (this test file) is placed
1424 > # \$THISTESTTMP, in which test-run-tests.t (this test file) is placed
1425 > # \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1425 > # \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1426 > # \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1426 > # \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1427 >
1427 >
1428 > $ test "\$TESTDIR" = "\$NEWTESTDIR"
1428 > $ test "\$TESTDIR" = "\$NEWTESTDIR"
1429 > If this prints a path, that means RUNTESTDIR didn't equal
1429 > If this prints a path, that means RUNTESTDIR didn't equal
1430 > THISTESTDIR as it should have.
1430 > THISTESTDIR as it should have.
1431 > $ test "\$RUNTESTDIR" = "\$THISTESTDIR" || echo "\$RUNTESTDIR"
1431 > $ test "\$RUNTESTDIR" = "\$THISTESTDIR" || echo "\$RUNTESTDIR"
1432 > This should print the start of check-code. If this passes but the
1432 > This should print the start of check-code. If this passes but the
1433 > previous check failed, that means we found a copy of check-code at whatever
1433 > previous check failed, that means we found a copy of check-code at whatever
1434 > RUNTESTSDIR ended up containing, even though it doesn't match THISTESTDIR.
1434 > RUNTESTSDIR ended up containing, even though it doesn't match THISTESTDIR.
1435 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python3@#!USRBINENVPY@'
1435 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python3@#!USRBINENVPY@'
1436 > #!USRBINENVPY
1436 > #!USRBINENVPY
1437 > #
1437 > #
1438 > # check-code - a style and portability checker for Mercurial
1438 > # check-code - a style and portability checker for Mercurial
1439 > EOF
1439 > EOF
1440 $ rt test-runtestdir.t
1440 $ rt test-runtestdir.t
1441 running 1 tests using 1 parallel processes
1441 running 1 tests using 1 parallel processes
1442 .
1442 .
1443 # Ran 1 tests, 0 skipped, 0 failed.
1443 # Ran 1 tests, 0 skipped, 0 failed.
1444
1444
1445 #if execbit
1445 #if execbit
1446
1446
1447 test that TESTDIR is referred in PATH
1447 test that TESTDIR is referred in PATH
1448
1448
1449 $ cat > custom-command.sh <<EOF
1449 $ cat > custom-command.sh <<EOF
1450 > #!/bin/sh
1450 > #!/bin/sh
1451 > echo "hello world"
1451 > echo "hello world"
1452 > EOF
1452 > EOF
1453 $ chmod +x custom-command.sh
1453 $ chmod +x custom-command.sh
1454 $ cat > test-testdir-path.t <<EOF
1454 $ cat > test-testdir-path.t <<EOF
1455 > $ custom-command.sh
1455 > $ custom-command.sh
1456 > hello world
1456 > hello world
1457 > EOF
1457 > EOF
1458 $ rt test-testdir-path.t
1458 $ rt test-testdir-path.t
1459 running 1 tests using 1 parallel processes
1459 running 1 tests using 1 parallel processes
1460 .
1460 .
1461 # Ran 1 tests, 0 skipped, 0 failed.
1461 # Ran 1 tests, 0 skipped, 0 failed.
1462
1462
1463 #endif
1463 #endif
1464
1464
1465 test support for --allow-slow-tests
1465 test support for --allow-slow-tests
1466 $ cat > test-very-slow-test.t <<EOF
1466 $ cat > test-very-slow-test.t <<EOF
1467 > #require slow
1467 > #require slow
1468 > $ echo pass
1468 > $ echo pass
1469 > pass
1469 > pass
1470 > EOF
1470 > EOF
1471 $ rt test-very-slow-test.t
1471 $ rt test-very-slow-test.t
1472 running 1 tests using 1 parallel processes
1472 running 1 tests using 1 parallel processes
1473 s
1473 s
1474 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1474 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1475 # Ran 0 tests, 1 skipped, 0 failed.
1475 # Ran 0 tests, 1 skipped, 0 failed.
1476 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1476 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1477 running 1 tests using 1 parallel processes
1477 running 1 tests using 1 parallel processes
1478 .
1478 .
1479 # Ran 1 tests, 0 skipped, 0 failed.
1479 # Ran 1 tests, 0 skipped, 0 failed.
1480
1480
1481 support for running a test outside the current directory
1481 support for running a test outside the current directory
1482 $ mkdir nonlocal
1482 $ mkdir nonlocal
1483 $ cat > nonlocal/test-is-not-here.t << EOF
1483 $ cat > nonlocal/test-is-not-here.t << EOF
1484 > $ echo pass
1484 > $ echo pass
1485 > pass
1485 > pass
1486 > EOF
1486 > EOF
1487 $ rt nonlocal/test-is-not-here.t
1487 $ rt nonlocal/test-is-not-here.t
1488 running 1 tests using 1 parallel processes
1488 running 1 tests using 1 parallel processes
1489 .
1489 .
1490 # Ran 1 tests, 0 skipped, 0 failed.
1490 # Ran 1 tests, 0 skipped, 0 failed.
1491
1491
1492 support for automatically discovering test if arg is a folder
1492 support for automatically discovering test if arg is a folder
1493 $ mkdir tmp && cd tmp
1493 $ mkdir tmp && cd tmp
1494
1494
1495 $ cat > test-uno.t << EOF
1495 $ cat > test-uno.t << EOF
1496 > $ echo line
1496 > $ echo line
1497 > line
1497 > line
1498 > EOF
1498 > EOF
1499
1499
1500 $ cp test-uno.t test-dos.t
1500 $ cp test-uno.t test-dos.t
1501 $ cd ..
1501 $ cd ..
1502 $ cp -R tmp tmpp
1502 $ cp -R tmp tmpp
1503 $ cp tmp/test-uno.t test-solo.t
1503 $ cp tmp/test-uno.t test-solo.t
1504
1504
1505 $ rt tmp/ test-solo.t tmpp
1505 $ rt tmp/ test-solo.t tmpp
1506 running 5 tests using 1 parallel processes
1506 running 5 tests using 1 parallel processes
1507 .....
1507 .....
1508 # Ran 5 tests, 0 skipped, 0 failed.
1508 # Ran 5 tests, 0 skipped, 0 failed.
1509 $ rm -rf tmp tmpp
1509 $ rm -rf tmp tmpp
1510
1510
1511 support for running run-tests.py from another directory
1511 support for running run-tests.py from another directory
1512 $ mkdir tmp && cd tmp
1512 $ mkdir tmp && cd tmp
1513
1513
1514 $ cat > useful-file.sh << EOF
1514 $ cat > useful-file.sh << EOF
1515 > important command
1515 > important command
1516 > EOF
1516 > EOF
1517
1517
1518 $ cat > test-folder.t << EOF
1518 $ cat > test-folder.t << EOF
1519 > $ cat \$TESTDIR/useful-file.sh
1519 > $ cat \$TESTDIR/useful-file.sh
1520 > important command
1520 > important command
1521 > EOF
1521 > EOF
1522
1522
1523 $ cat > test-folder-fail.t << EOF
1523 $ cat > test-folder-fail.t << EOF
1524 > $ cat \$TESTDIR/useful-file.sh
1524 > $ cat \$TESTDIR/useful-file.sh
1525 > important commando
1525 > important commando
1526 > EOF
1526 > EOF
1527
1527
1528 $ cd ..
1528 $ cd ..
1529 $ rt tmp/test-*.t
1529 $ rt tmp/test-*.t
1530 running 2 tests using 1 parallel processes
1530 running 2 tests using 1 parallel processes
1531
1531
1532 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1532 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1533 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1533 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1534 @@ -1,2 +1,2 @@
1534 @@ -1,2 +1,2 @@
1535 $ cat $TESTDIR/useful-file.sh
1535 $ cat $TESTDIR/useful-file.sh
1536 - important commando
1536 - important commando
1537 + important command
1537 + important command
1538
1538
1539 ERROR: test-folder-fail.t output changed
1539 ERROR: test-folder-fail.t output changed
1540 !.
1540 !.
1541 Failed test-folder-fail.t: output changed
1541 Failed test-folder-fail.t: output changed
1542 # Ran 2 tests, 0 skipped, 1 failed.
1542 # Ran 2 tests, 0 skipped, 1 failed.
1543 python hash seed: * (glob)
1543 python hash seed: * (glob)
1544 [1]
1544 [1]
1545
1545
1546 support for bisecting failed tests automatically
1546 support for bisecting failed tests automatically
1547 $ hg init bisect
1547 $ hg init bisect
1548 $ cd bisect
1548 $ cd bisect
1549 $ cat >> test-bisect.t <<EOF
1549 $ cat >> test-bisect.t <<EOF
1550 > $ echo pass
1550 > $ echo pass
1551 > pass
1551 > pass
1552 > EOF
1552 > EOF
1553 $ hg add test-bisect.t
1553 $ hg add test-bisect.t
1554 $ hg ci -m 'good'
1554 $ hg ci -m 'good'
1555 $ cat >> test-bisect.t <<EOF
1555 $ cat >> test-bisect.t <<EOF
1556 > $ echo pass
1556 > $ echo pass
1557 > fail
1557 > fail
1558 > EOF
1558 > EOF
1559 $ hg ci -m 'bad'
1559 $ hg ci -m 'bad'
1560 $ rt --known-good-rev=0 test-bisect.t
1560 $ rt --known-good-rev=0 test-bisect.t
1561 running 1 tests using 1 parallel processes
1561 running 1 tests using 1 parallel processes
1562
1562
1563 --- $TESTTMP/anothertests/bisect/test-bisect.t
1563 --- $TESTTMP/anothertests/bisect/test-bisect.t
1564 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1564 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1565 @@ -1,4 +1,4 @@
1565 @@ -1,4 +1,4 @@
1566 $ echo pass
1566 $ echo pass
1567 pass
1567 pass
1568 $ echo pass
1568 $ echo pass
1569 - fail
1569 - fail
1570 + pass
1570 + pass
1571
1571
1572 ERROR: test-bisect.t output changed
1572 ERROR: test-bisect.t output changed
1573 !
1573 !
1574 Failed test-bisect.t: output changed
1574 Failed test-bisect.t: output changed
1575 test-bisect.t broken by 72cbf122d116 (bad)
1575 test-bisect.t broken by 72cbf122d116 (bad)
1576 # Ran 1 tests, 0 skipped, 1 failed.
1576 # Ran 1 tests, 0 skipped, 1 failed.
1577 python hash seed: * (glob)
1577 python hash seed: * (glob)
1578 [1]
1578 [1]
1579
1579
1580 $ cd ..
1580 $ cd ..
1581
1581
1582 support bisecting a separate repo
1582 support bisecting a separate repo
1583
1583
1584 $ hg init bisect-dependent
1584 $ hg init bisect-dependent
1585 $ cd bisect-dependent
1585 $ cd bisect-dependent
1586 $ cat > test-bisect-dependent.t <<EOF
1586 $ cat > test-bisect-dependent.t <<EOF
1587 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1587 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1588 > pass
1588 > pass
1589 > EOF
1589 > EOF
1590 $ hg commit -Am dependent test-bisect-dependent.t
1590 $ hg commit -Am dependent test-bisect-dependent.t
1591
1591
1592 $ rt --known-good-rev=0 test-bisect-dependent.t
1592 $ rt --known-good-rev=0 test-bisect-dependent.t
1593 running 1 tests using 1 parallel processes
1593 running 1 tests using 1 parallel processes
1594
1594
1595 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1595 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1596 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1596 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1597 @@ -1,2 +1,2 @@
1597 @@ -1,2 +1,2 @@
1598 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1598 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1599 - pass
1599 - pass
1600 + fail
1600 + fail
1601
1601
1602 ERROR: test-bisect-dependent.t output changed
1602 ERROR: test-bisect-dependent.t output changed
1603 !
1603 !
1604 Failed test-bisect-dependent.t: output changed
1604 Failed test-bisect-dependent.t: output changed
1605 Failed to identify failure point for test-bisect-dependent.t
1605 Failed to identify failure point for test-bisect-dependent.t
1606 # Ran 1 tests, 0 skipped, 1 failed.
1606 # Ran 1 tests, 0 skipped, 1 failed.
1607 python hash seed: * (glob)
1607 python hash seed: * (glob)
1608 [1]
1608 [1]
1609
1609
1610 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1610 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1611 usage: run-tests.py [options] [tests]
1611 usage: run-tests.py [options] [tests]
1612 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1612 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1613 [2]
1613 [2]
1614
1614
1615 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1615 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1616 running 1 tests using 1 parallel processes
1616 running 1 tests using 1 parallel processes
1617
1617
1618 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1618 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1619 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1619 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1620 @@ -1,2 +1,2 @@
1620 @@ -1,2 +1,2 @@
1621 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1621 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1622 - pass
1622 - pass
1623 + fail
1623 + fail
1624
1624
1625 ERROR: test-bisect-dependent.t output changed
1625 ERROR: test-bisect-dependent.t output changed
1626 !
1626 !
1627 Failed test-bisect-dependent.t: output changed
1627 Failed test-bisect-dependent.t: output changed
1628 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1628 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1629 # Ran 1 tests, 0 skipped, 1 failed.
1629 # Ran 1 tests, 0 skipped, 1 failed.
1630 python hash seed: * (glob)
1630 python hash seed: * (glob)
1631 [1]
1631 [1]
1632
1632
1633 $ cd ..
1633 $ cd ..
1634
1634
1635 Test a broken #if statement doesn't break run-tests threading.
1635 Test a broken #if statement doesn't break run-tests threading.
1636 ==============================================================
1636 ==============================================================
1637 $ mkdir broken
1637 $ mkdir broken
1638 $ cd broken
1638 $ cd broken
1639 $ cat > test-broken.t <<EOF
1639 $ cat > test-broken.t <<EOF
1640 > true
1640 > true
1641 > #if notarealhghavefeature
1641 > #if notarealhghavefeature
1642 > $ false
1642 > $ false
1643 > #endif
1643 > #endif
1644 > EOF
1644 > EOF
1645 $ for f in 1 2 3 4 ; do
1645 $ for f in 1 2 3 4 ; do
1646 > cat > test-works-$f.t <<EOF
1646 > cat > test-works-$f.t <<EOF
1647 > This is test case $f
1647 > This is test case $f
1648 > $ sleep 1
1648 > $ sleep 1
1649 > EOF
1649 > EOF
1650 > done
1650 > done
1651 $ rt -j 2
1651 $ rt -j 2
1652 running 5 tests using 2 parallel processes
1652 running 5 tests using 2 parallel processes
1653 ....
1653 ....
1654 # Ran 5 tests, 0 skipped, 0 failed.
1654 # Ran 5 tests, 0 skipped, 0 failed.
1655 skipped: unknown feature: notarealhghavefeature
1655 skipped: unknown feature: notarealhghavefeature
1656
1656
1657 $ cd ..
1657 $ cd ..
1658 $ rm -rf broken
1658 $ rm -rf broken
1659
1659
1660 Test cases in .t files
1660 Test cases in .t files
1661 ======================
1661 ======================
1662 $ mkdir cases
1662 $ mkdir cases
1663 $ cd cases
1663 $ cd cases
1664 $ cat > test-cases-abc.t <<'EOF'
1664 $ cat > test-cases-abc.t <<'EOF'
1665 > #testcases A B C
1665 > #testcases A B C
1666 > $ V=B
1666 > $ V=B
1667 > #if A
1667 > #if A
1668 > $ V=A
1668 > $ V=A
1669 > #endif
1669 > #endif
1670 > #if C
1670 > #if C
1671 > $ V=C
1671 > $ V=C
1672 > #endif
1672 > #endif
1673 > $ echo $V | sed 's/A/C/'
1673 > $ echo $V | sed 's/A/C/'
1674 > C
1674 > C
1675 > #if C
1675 > #if C
1676 > $ [ $V = C ]
1676 > $ [ $V = C ]
1677 > #endif
1677 > #endif
1678 > #if A
1678 > #if A
1679 > $ [ $V = C ]
1679 > $ [ $V = C ]
1680 > [1]
1680 > [1]
1681 > #endif
1681 > #endif
1682 > #if no-C
1682 > #if no-C
1683 > $ [ $V = C ]
1683 > $ [ $V = C ]
1684 > [1]
1684 > [1]
1685 > #endif
1685 > #endif
1686 > $ [ $V = D ]
1686 > $ [ $V = D ]
1687 > [1]
1687 > [1]
1688 > EOF
1688 > EOF
1689 $ rt
1689 $ rt
1690 running 3 tests using 1 parallel processes
1690 running 3 tests using 1 parallel processes
1691 .
1691 .
1692 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1692 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1693 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1693 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1694 @@ -7,7 +7,7 @@
1694 @@ -7,7 +7,7 @@
1695 $ V=C
1695 $ V=C
1696 #endif
1696 #endif
1697 $ echo $V | sed 's/A/C/'
1697 $ echo $V | sed 's/A/C/'
1698 - C
1698 - C
1699 + B
1699 + B
1700 #if C
1700 #if C
1701 $ [ $V = C ]
1701 $ [ $V = C ]
1702 #endif
1702 #endif
1703
1703
1704 ERROR: test-cases-abc.t#B output changed
1704 ERROR: test-cases-abc.t#B output changed
1705 !.
1705 !.
1706 Failed test-cases-abc.t#B: output changed
1706 Failed test-cases-abc.t#B: output changed
1707 # Ran 3 tests, 0 skipped, 1 failed.
1707 # Ran 3 tests, 0 skipped, 1 failed.
1708 python hash seed: * (glob)
1708 python hash seed: * (glob)
1709 [1]
1709 [1]
1710
1710
1711 --restart works
1711 --restart works
1712
1712
1713 $ rt --restart
1713 $ rt --restart
1714 running 2 tests using 1 parallel processes
1714 running 2 tests using 1 parallel processes
1715
1715
1716 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1716 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1717 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1717 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1718 @@ -7,7 +7,7 @@
1718 @@ -7,7 +7,7 @@
1719 $ V=C
1719 $ V=C
1720 #endif
1720 #endif
1721 $ echo $V | sed 's/A/C/'
1721 $ echo $V | sed 's/A/C/'
1722 - C
1722 - C
1723 + B
1723 + B
1724 #if C
1724 #if C
1725 $ [ $V = C ]
1725 $ [ $V = C ]
1726 #endif
1726 #endif
1727
1727
1728 ERROR: test-cases-abc.t#B output changed
1728 ERROR: test-cases-abc.t#B output changed
1729 !.
1729 !.
1730 Failed test-cases-abc.t#B: output changed
1730 Failed test-cases-abc.t#B: output changed
1731 # Ran 2 tests, 0 skipped, 1 failed.
1731 # Ran 2 tests, 0 skipped, 1 failed.
1732 python hash seed: * (glob)
1732 python hash seed: * (glob)
1733 [1]
1733 [1]
1734
1734
1735 --restart works with outputdir
1735 --restart works with outputdir
1736
1736
1737 $ mkdir output
1737 $ mkdir output
1738 $ mv test-cases-abc.t#B.err output
1738 $ mv test-cases-abc.t#B.err output
1739 $ rt --restart --outputdir output
1739 $ rt --restart --outputdir output
1740 running 2 tests using 1 parallel processes
1740 running 2 tests using 1 parallel processes
1741
1741
1742 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1742 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1743 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t#B.err
1743 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t#B.err
1744 @@ -7,7 +7,7 @@
1744 @@ -7,7 +7,7 @@
1745 $ V=C
1745 $ V=C
1746 #endif
1746 #endif
1747 $ echo $V | sed 's/A/C/'
1747 $ echo $V | sed 's/A/C/'
1748 - C
1748 - C
1749 + B
1749 + B
1750 #if C
1750 #if C
1751 $ [ $V = C ]
1751 $ [ $V = C ]
1752 #endif
1752 #endif
1753
1753
1754 ERROR: test-cases-abc.t#B output changed
1754 ERROR: test-cases-abc.t#B output changed
1755 !.
1755 !.
1756 Failed test-cases-abc.t#B: output changed
1756 Failed test-cases-abc.t#B: output changed
1757 # Ran 2 tests, 0 skipped, 1 failed.
1757 # Ran 2 tests, 0 skipped, 1 failed.
1758 python hash seed: * (glob)
1758 python hash seed: * (glob)
1759 [1]
1759 [1]
1760
1760
1761 Test TESTCASE variable
1761 Test TESTCASE variable
1762
1762
1763 $ cat > test-cases-ab.t <<'EOF'
1763 $ cat > test-cases-ab.t <<'EOF'
1764 > $ dostuff() {
1764 > $ dostuff() {
1765 > > echo "In case $TESTCASE"
1765 > > echo "In case $TESTCASE"
1766 > > }
1766 > > }
1767 > #testcases A B
1767 > #testcases A B
1768 > #if A
1768 > #if A
1769 > $ dostuff
1769 > $ dostuff
1770 > In case A
1770 > In case A
1771 > #endif
1771 > #endif
1772 > #if B
1772 > #if B
1773 > $ dostuff
1773 > $ dostuff
1774 > In case B
1774 > In case B
1775 > #endif
1775 > #endif
1776 > EOF
1776 > EOF
1777 $ rt test-cases-ab.t
1777 $ rt test-cases-ab.t
1778 running 2 tests using 1 parallel processes
1778 running 2 tests using 1 parallel processes
1779 ..
1779 ..
1780 # Ran 2 tests, 0 skipped, 0 failed.
1780 # Ran 2 tests, 0 skipped, 0 failed.
1781
1781
1782 Support running a specific test case
1782 Support running a specific test case
1783
1783
1784 $ rt "test-cases-abc.t#B"
1784 $ rt "test-cases-abc.t#B"
1785 running 1 tests using 1 parallel processes
1785 running 1 tests using 1 parallel processes
1786
1786
1787 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1787 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1788 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1788 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1789 @@ -7,7 +7,7 @@
1789 @@ -7,7 +7,7 @@
1790 $ V=C
1790 $ V=C
1791 #endif
1791 #endif
1792 $ echo $V | sed 's/A/C/'
1792 $ echo $V | sed 's/A/C/'
1793 - C
1793 - C
1794 + B
1794 + B
1795 #if C
1795 #if C
1796 $ [ $V = C ]
1796 $ [ $V = C ]
1797 #endif
1797 #endif
1798
1798
1799 ERROR: test-cases-abc.t#B output changed
1799 ERROR: test-cases-abc.t#B output changed
1800 !
1800 !
1801 Failed test-cases-abc.t#B: output changed
1801 Failed test-cases-abc.t#B: output changed
1802 # Ran 1 tests, 0 skipped, 1 failed.
1802 # Ran 1 tests, 0 skipped, 1 failed.
1803 python hash seed: * (glob)
1803 python hash seed: * (glob)
1804 [1]
1804 [1]
1805
1805
1806 Support running multiple test cases in the same file
1806 Support running multiple test cases in the same file
1807
1807
1808 $ rt test-cases-abc.t#B test-cases-abc.t#C
1808 $ rt test-cases-abc.t#B test-cases-abc.t#C
1809 running 2 tests using 1 parallel processes
1809 running 2 tests using 1 parallel processes
1810
1810
1811 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1811 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1812 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1812 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1813 @@ -7,7 +7,7 @@
1813 @@ -7,7 +7,7 @@
1814 $ V=C
1814 $ V=C
1815 #endif
1815 #endif
1816 $ echo $V | sed 's/A/C/'
1816 $ echo $V | sed 's/A/C/'
1817 - C
1817 - C
1818 + B
1818 + B
1819 #if C
1819 #if C
1820 $ [ $V = C ]
1820 $ [ $V = C ]
1821 #endif
1821 #endif
1822
1822
1823 ERROR: test-cases-abc.t#B output changed
1823 ERROR: test-cases-abc.t#B output changed
1824 !.
1824 !.
1825 Failed test-cases-abc.t#B: output changed
1825 Failed test-cases-abc.t#B: output changed
1826 # Ran 2 tests, 0 skipped, 1 failed.
1826 # Ran 2 tests, 0 skipped, 1 failed.
1827 python hash seed: * (glob)
1827 python hash seed: * (glob)
1828 [1]
1828 [1]
1829
1829
1830 Support ignoring invalid test cases
1830 Support ignoring invalid test cases
1831
1831
1832 $ rt test-cases-abc.t#B test-cases-abc.t#D
1832 $ rt test-cases-abc.t#B test-cases-abc.t#D
1833 running 1 tests using 1 parallel processes
1833 running 1 tests using 1 parallel processes
1834
1834
1835 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1835 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1836 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1836 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1837 @@ -7,7 +7,7 @@
1837 @@ -7,7 +7,7 @@
1838 $ V=C
1838 $ V=C
1839 #endif
1839 #endif
1840 $ echo $V | sed 's/A/C/'
1840 $ echo $V | sed 's/A/C/'
1841 - C
1841 - C
1842 + B
1842 + B
1843 #if C
1843 #if C
1844 $ [ $V = C ]
1844 $ [ $V = C ]
1845 #endif
1845 #endif
1846
1846
1847 ERROR: test-cases-abc.t#B output changed
1847 ERROR: test-cases-abc.t#B output changed
1848 !
1848 !
1849 Failed test-cases-abc.t#B: output changed
1849 Failed test-cases-abc.t#B: output changed
1850 # Ran 1 tests, 0 skipped, 1 failed.
1850 # Ran 1 tests, 0 skipped, 1 failed.
1851 python hash seed: * (glob)
1851 python hash seed: * (glob)
1852 [1]
1852 [1]
1853
1853
1854 Support running complex test cases names
1854 Support running complex test cases names
1855
1855
1856 $ cat > test-cases-advanced-cases.t <<'EOF'
1856 $ cat > test-cases-advanced-cases.t <<'EOF'
1857 > #testcases simple case-with-dashes casewith_-.chars
1857 > #testcases simple case-with-dashes casewith_-.chars
1858 > $ echo $TESTCASE
1858 > $ echo $TESTCASE
1859 > simple
1859 > simple
1860 > EOF
1860 > EOF
1861
1861
1862 $ cat test-cases-advanced-cases.t
1862 $ cat test-cases-advanced-cases.t
1863 #testcases simple case-with-dashes casewith_-.chars
1863 #testcases simple case-with-dashes casewith_-.chars
1864 $ echo $TESTCASE
1864 $ echo $TESTCASE
1865 simple
1865 simple
1866
1866
1867 $ rt test-cases-advanced-cases.t
1867 $ rt test-cases-advanced-cases.t
1868 running 3 tests using 1 parallel processes
1868 running 3 tests using 1 parallel processes
1869
1869
1870 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1870 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1871 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#case-with-dashes.err
1871 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#case-with-dashes.err
1872 @@ -1,3 +1,3 @@
1872 @@ -1,3 +1,3 @@
1873 #testcases simple case-with-dashes casewith_-.chars
1873 #testcases simple case-with-dashes casewith_-.chars
1874 $ echo $TESTCASE
1874 $ echo $TESTCASE
1875 - simple
1875 - simple
1876 + case-with-dashes
1876 + case-with-dashes
1877
1877
1878 ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
1878 ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
1879 !
1879 !
1880 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1880 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1881 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#casewith_-.chars.err
1881 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#casewith_-.chars.err
1882 @@ -1,3 +1,3 @@
1882 @@ -1,3 +1,3 @@
1883 #testcases simple case-with-dashes casewith_-.chars
1883 #testcases simple case-with-dashes casewith_-.chars
1884 $ echo $TESTCASE
1884 $ echo $TESTCASE
1885 - simple
1885 - simple
1886 + casewith_-.chars
1886 + casewith_-.chars
1887
1887
1888 ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed
1888 ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed
1889 !.
1889 !.
1890 Failed test-cases-advanced-cases.t#case-with-dashes: output changed
1890 Failed test-cases-advanced-cases.t#case-with-dashes: output changed
1891 Failed test-cases-advanced-cases.t#casewith_-.chars: output changed
1891 Failed test-cases-advanced-cases.t#casewith_-.chars: output changed
1892 # Ran 3 tests, 0 skipped, 2 failed.
1892 # Ran 3 tests, 0 skipped, 2 failed.
1893 python hash seed: * (glob)
1893 python hash seed: * (glob)
1894 [1]
1894 [1]
1895
1895
1896 $ rt "test-cases-advanced-cases.t#case-with-dashes"
1896 $ rt "test-cases-advanced-cases.t#case-with-dashes"
1897 running 1 tests using 1 parallel processes
1897 running 1 tests using 1 parallel processes
1898
1898
1899 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1899 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1900 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#case-with-dashes.err
1900 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#case-with-dashes.err
1901 @@ -1,3 +1,3 @@
1901 @@ -1,3 +1,3 @@
1902 #testcases simple case-with-dashes casewith_-.chars
1902 #testcases simple case-with-dashes casewith_-.chars
1903 $ echo $TESTCASE
1903 $ echo $TESTCASE
1904 - simple
1904 - simple
1905 + case-with-dashes
1905 + case-with-dashes
1906
1906
1907 ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
1907 ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
1908 !
1908 !
1909 Failed test-cases-advanced-cases.t#case-with-dashes: output changed
1909 Failed test-cases-advanced-cases.t#case-with-dashes: output changed
1910 # Ran 1 tests, 0 skipped, 1 failed.
1910 # Ran 1 tests, 0 skipped, 1 failed.
1911 python hash seed: * (glob)
1911 python hash seed: * (glob)
1912 [1]
1912 [1]
1913
1913
1914 $ rt "test-cases-advanced-cases.t#casewith_-.chars"
1914 $ rt "test-cases-advanced-cases.t#casewith_-.chars"
1915 running 1 tests using 1 parallel processes
1915 running 1 tests using 1 parallel processes
1916
1916
1917 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1917 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1918 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#casewith_-.chars.err
1918 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#casewith_-.chars.err
1919 @@ -1,3 +1,3 @@
1919 @@ -1,3 +1,3 @@
1920 #testcases simple case-with-dashes casewith_-.chars
1920 #testcases simple case-with-dashes casewith_-.chars
1921 $ echo $TESTCASE
1921 $ echo $TESTCASE
1922 - simple
1922 - simple
1923 + casewith_-.chars
1923 + casewith_-.chars
1924
1924
1925 ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed
1925 ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed
1926 !
1926 !
1927 Failed test-cases-advanced-cases.t#casewith_-.chars: output changed
1927 Failed test-cases-advanced-cases.t#casewith_-.chars: output changed
1928 # Ran 1 tests, 0 skipped, 1 failed.
1928 # Ran 1 tests, 0 skipped, 1 failed.
1929 python hash seed: * (glob)
1929 python hash seed: * (glob)
1930 [1]
1930 [1]
1931
1931
1932 Test automatic pattern replacement
1932 Test automatic pattern replacement
1933 ==================================
1933 ==================================
1934
1934
1935 $ cat << EOF >> common-pattern.py
1935 $ cat << EOF >> common-pattern.py
1936 > substitutions = [
1936 > substitutions = [
1937 > (br'foo-(.*)\\b',
1937 > (br'foo-(.*)\\b',
1938 > br'\$XXX=\\1\$'),
1938 > br'\$XXX=\\1\$'),
1939 > (br'bar\\n',
1939 > (br'bar\\n',
1940 > br'\$YYY$\\n'),
1940 > br'\$YYY$\\n'),
1941 > ]
1941 > ]
1942 > EOF
1942 > EOF
1943
1943
1944 $ cat << EOF >> test-substitution.t
1944 $ cat << EOF >> test-substitution.t
1945 > $ echo foo-12
1945 > $ echo foo-12
1946 > \$XXX=12$
1946 > \$XXX=12$
1947 > $ echo foo-42
1947 > $ echo foo-42
1948 > \$XXX=42$
1948 > \$XXX=42$
1949 > $ echo bar prior
1949 > $ echo bar prior
1950 > bar prior
1950 > bar prior
1951 > $ echo lastbar
1951 > $ echo lastbar
1952 > last\$YYY$
1952 > last\$YYY$
1953 > $ echo foo-bar foo-baz
1953 > $ echo foo-bar foo-baz
1954 > EOF
1954 > EOF
1955
1955
1956 $ rt test-substitution.t
1956 $ rt test-substitution.t
1957 running 1 tests using 1 parallel processes
1957 running 1 tests using 1 parallel processes
1958
1958
1959 --- $TESTTMP/anothertests/cases/test-substitution.t
1959 --- $TESTTMP/anothertests/cases/test-substitution.t
1960 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1960 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1961 @@ -7,3 +7,4 @@
1961 @@ -7,3 +7,4 @@
1962 $ echo lastbar
1962 $ echo lastbar
1963 last$YYY$
1963 last$YYY$
1964 $ echo foo-bar foo-baz
1964 $ echo foo-bar foo-baz
1965 + $XXX=bar foo-baz$
1965 + $XXX=bar foo-baz$
1966
1966
1967 ERROR: test-substitution.t output changed
1967 ERROR: test-substitution.t output changed
1968 !
1968 !
1969 Failed test-substitution.t: output changed
1969 Failed test-substitution.t: output changed
1970 # Ran 1 tests, 0 skipped, 1 failed.
1970 # Ran 1 tests, 0 skipped, 1 failed.
1971 python hash seed: * (glob)
1971 python hash seed: * (glob)
1972 [1]
1972 [1]
1973
1973
1974 --extra-config-opt works
1974 --extra-config-opt works
1975
1975
1976 $ cat << EOF >> test-config-opt.t
1976 $ cat << EOF >> test-config-opt.t
1977 > $ hg init test-config-opt
1977 > $ hg init test-config-opt
1978 > $ hg -R test-config-opt purge
1978 > $ hg -R test-config-opt purge
1979 > $ echo "HGTESTEXTRAEXTENSIONS: \$HGTESTEXTRAEXTENSIONS"
1979 > $ echo "HGTESTEXTRAEXTENSIONS: \$HGTESTEXTRAEXTENSIONS"
1980 > HGTESTEXTRAEXTENSIONS: purge
1980 > HGTESTEXTRAEXTENSIONS: purge
1981 > EOF
1981 > EOF
1982
1982
1983 $ rt --extra-config-opt extensions.purge= \
1983 $ rt --extra-config-opt extensions.purge= \
1984 > --extra-config-opt not.an.extension=True test-config-opt.t
1984 > --extra-config-opt not.an.extension=True test-config-opt.t
1985 running 1 tests using 1 parallel processes
1985 running 1 tests using 1 parallel processes
1986 .
1986 .
1987 # Ran 1 tests, 0 skipped, 0 failed.
1987 # Ran 1 tests, 0 skipped, 0 failed.
1988
1988
1989 Test conditional output matching
1989 Test conditional output matching
1990 ================================
1990 ================================
1991
1991
1992 $ cat << EOF >> test-conditional-matching.t
1992 $ cat << EOF >> test-conditional-matching.t
1993 > #testcases foo bar
1993 > #testcases foo bar
1994 > $ echo richtig
1994 > $ echo richtig
1995 > richtig (true !)
1995 > richtig (true !)
1996 > $ echo falsch
1996 > $ echo falsch
1997 > falsch (false !)
1997 > falsch (false !)
1998 > #if foo
1998 > #if foo
1999 > $ echo arthur
1999 > $ echo arthur
2000 > arthur (bar !)
2000 > arthur (bar !)
2001 > #endif
2001 > #endif
2002 > $ echo celeste
2002 > $ echo celeste
2003 > celeste (foo !)
2003 > celeste (foo !)
2004 > $ echo zephir
2004 > $ echo zephir
2005 > zephir (bar !)
2005 > zephir (bar !)
2006 > EOF
2006 > EOF
2007
2007
2008 $ rt test-conditional-matching.t
2008 $ rt test-conditional-matching.t
2009 running 2 tests using 1 parallel processes
2009 running 2 tests using 1 parallel processes
2010
2010
2011 --- $TESTTMP/anothertests/cases/test-conditional-matching.t
2011 --- $TESTTMP/anothertests/cases/test-conditional-matching.t
2012 +++ $TESTTMP/anothertests/cases/test-conditional-matching.t#bar.err
2012 +++ $TESTTMP/anothertests/cases/test-conditional-matching.t#bar.err
2013 @@ -3,11 +3,13 @@
2013 @@ -3,11 +3,13 @@
2014 richtig (true !)
2014 richtig (true !)
2015 $ echo falsch
2015 $ echo falsch
2016 falsch (false !)
2016 falsch (false !)
2017 + falsch
2017 + falsch
2018 #if foo
2018 #if foo
2019 $ echo arthur
2019 $ echo arthur
2020 arthur \(bar !\) (re)
2020 arthur \(bar !\) (re)
2021 #endif
2021 #endif
2022 $ echo celeste
2022 $ echo celeste
2023 celeste \(foo !\) (re)
2023 celeste \(foo !\) (re)
2024 + celeste
2024 + celeste
2025 $ echo zephir
2025 $ echo zephir
2026 zephir \(bar !\) (re)
2026 zephir \(bar !\) (re)
2027
2027
2028 ERROR: test-conditional-matching.t#bar output changed
2028 ERROR: test-conditional-matching.t#bar output changed
2029 !
2029 !
2030 --- $TESTTMP/anothertests/cases/test-conditional-matching.t
2030 --- $TESTTMP/anothertests/cases/test-conditional-matching.t
2031 +++ $TESTTMP/anothertests/cases/test-conditional-matching.t#foo.err
2031 +++ $TESTTMP/anothertests/cases/test-conditional-matching.t#foo.err
2032 @@ -3,11 +3,14 @@
2032 @@ -3,11 +3,14 @@
2033 richtig (true !)
2033 richtig (true !)
2034 $ echo falsch
2034 $ echo falsch
2035 falsch (false !)
2035 falsch (false !)
2036 + falsch
2036 + falsch
2037 #if foo
2037 #if foo
2038 $ echo arthur
2038 $ echo arthur
2039 arthur \(bar !\) (re)
2039 arthur \(bar !\) (re)
2040 + arthur
2040 + arthur
2041 #endif
2041 #endif
2042 $ echo celeste
2042 $ echo celeste
2043 celeste \(foo !\) (re)
2043 celeste \(foo !\) (re)
2044 $ echo zephir
2044 $ echo zephir
2045 zephir \(bar !\) (re)
2045 zephir \(bar !\) (re)
2046 + zephir
2046 + zephir
2047
2047
2048 ERROR: test-conditional-matching.t#foo output changed
2048 ERROR: test-conditional-matching.t#foo output changed
2049 !
2049 !
2050 Failed test-conditional-matching.t#bar: output changed
2050 Failed test-conditional-matching.t#bar: output changed
2051 Failed test-conditional-matching.t#foo: output changed
2051 Failed test-conditional-matching.t#foo: output changed
2052 # Ran 2 tests, 0 skipped, 2 failed.
2052 # Ran 2 tests, 0 skipped, 2 failed.
2053 python hash seed: * (glob)
2053 python hash seed: * (glob)
2054 [1]
2054 [1]
2055
2055
2056 Test that a proper "python" has been set up
2056 Test that a proper "python" has been set up
2057 ===========================================
2057 ===========================================
2058
2058
2059 (with a small check-code work around)
2059 (with a small check-code work around)
2060 $ printf "#!/usr/bi" > test-py3.tmp
2060 $ printf "#!/usr/bi" > test-py3.tmp
2061 $ printf "n/en" >> test-py3.tmp
2061 $ printf "n/en" >> test-py3.tmp
2062 $ cat << EOF >> test-py3.tmp
2062 $ cat << EOF >> test-py3.tmp
2063 > v python3
2063 > v python3
2064 > import sys
2064 > import sys
2065 > print('.'.join(str(x) for x in sys.version_info))
2065 > print('.'.join(str(x) for x in sys.version_info))
2066 > EOF
2066 > EOF
2067 $ mv test-py3.tmp test-py3.py
2067 $ mv test-py3.tmp test-py3.py
2068 $ chmod +x test-py3.py
2068 $ chmod +x test-py3.py
2069
2069
2070 (with a small check-code work around)
2070 (with a small check-code work around)
2071 $ printf "#!/usr/bi" > test-py.tmp
2071 $ printf "#!/usr/bi" > test-py.tmp
2072 $ printf "n/en" >> test-py.tmp
2072 $ printf "n/en" >> test-py.tmp
2073 $ cat << EOF >> test-py.tmp
2073 $ cat << EOF >> test-py.tmp
2074 > v python
2074 > v python
2075 > import sys
2075 > import sys
2076 > print('.'.join(str(x) for x in sys.version_info))
2076 > print('.'.join(str(x) for x in sys.version_info))
2077 > EOF
2077 > EOF
2078 $ mv test-py.tmp test-py.py
2078 $ mv test-py.tmp test-py.py
2079 $ chmod +x test-py.py
2079 $ chmod +x test-py.py
2080
2080
2081 $ ./test-py3.py
2081 $ ./test-py3.py
2082 3.* (glob)
2082 3.* (glob)
2083 $ ./test-py.py
2083 $ ./test-py.py
2084 2.* (glob) (no-py3 !)
2084 2.* (glob) (no-py3 !)
2085 3.* (glob) (py3 !)
2085 3.* (glob) (py3 !)
General Comments 0
You need to be logged in to leave comments. Login now