##// END OF EJS Templates
tests: make sure test-run-tests.t actually runs run-tests.py under Python 3...
Augie Fackler -
r37758:1b71a397 default
parent child Browse files
Show More
@@ -1,1625 +1,1624 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
9 $ $PYTHON $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE -l
10 $ run-tests.py $HGTEST_RUN_TESTS_PURE -l
11
10
12 # Ran 0 tests, 0 skipped, 0 failed.
11 # Ran 0 tests, 0 skipped, 0 failed.
13
12
14 Define a helper to avoid the install step
13 Define a helper to avoid the install step
15 =============
14 =============
16 $ rt()
15 $ rt()
17 > {
16 > {
18 > run-tests.py --with-hg=`which hg` "$@"
17 > $PYTHON $TESTDIR/run-tests.py --with-hg=`which hg` "$@"
19 > }
18 > }
20
19
21 error paths
20 error paths
22
21
23 #if symlink
22 #if symlink
24 $ ln -s `which true` hg
23 $ ln -s `which true` hg
25 $ run-tests.py --with-hg=./hg
24 $ $PYTHON $TESTDIR/run-tests.py --with-hg=./hg
26 warning: --with-hg should specify an hg script
25 warning: --with-hg should specify an hg script
27
26
28 # Ran 0 tests, 0 skipped, 0 failed.
27 # Ran 0 tests, 0 skipped, 0 failed.
29 $ rm hg
28 $ rm hg
30 #endif
29 #endif
31
30
32 #if execbit
31 #if execbit
33 $ touch hg
32 $ touch hg
34 $ run-tests.py --with-hg=./hg
33 $ $PYTHON $TESTDIR/run-tests.py --with-hg=./hg
35 usage: run-tests.py [options] [tests]
34 usage: run-tests.py [options] [tests]
36 run-tests.py: error: --with-hg must specify an executable hg script
35 run-tests.py: error: --with-hg must specify an executable hg script
37 [2]
36 [2]
38 $ rm hg
37 $ rm hg
39 #endif
38 #endif
40
39
41 Features for testing optional lines
40 Features for testing optional lines
42 ===================================
41 ===================================
43
42
44 $ cat > hghaveaddon.py <<EOF
43 $ cat > hghaveaddon.py <<EOF
45 > import hghave
44 > import hghave
46 > @hghave.check("custom", "custom hghave feature")
45 > @hghave.check("custom", "custom hghave feature")
47 > def has_custom():
46 > def has_custom():
48 > return True
47 > return True
49 > @hghave.check("missing", "missing hghave feature")
48 > @hghave.check("missing", "missing hghave feature")
50 > def has_missing():
49 > def has_missing():
51 > return False
50 > return False
52 > EOF
51 > EOF
53
52
54 an empty test
53 an empty test
55 =======================
54 =======================
56
55
57 $ touch test-empty.t
56 $ touch test-empty.t
58 $ rt
57 $ rt
59 .
58 .
60 # Ran 1 tests, 0 skipped, 0 failed.
59 # Ran 1 tests, 0 skipped, 0 failed.
61 $ rm test-empty.t
60 $ rm test-empty.t
62
61
63 a succesful test
62 a succesful test
64 =======================
63 =======================
65
64
66 $ cat > test-success.t << EOF
65 $ cat > test-success.t << EOF
67 > $ echo babar
66 > $ echo babar
68 > babar
67 > babar
69 > $ echo xyzzy
68 > $ echo xyzzy
70 > dont_print (?)
69 > dont_print (?)
71 > nothing[42]line (re) (?)
70 > nothing[42]line (re) (?)
72 > never*happens (glob) (?)
71 > never*happens (glob) (?)
73 > more_nothing (?)
72 > more_nothing (?)
74 > xyzzy
73 > xyzzy
75 > nor this (?)
74 > nor this (?)
76 > $ printf 'abc\ndef\nxyz\n'
75 > $ printf 'abc\ndef\nxyz\n'
77 > 123 (?)
76 > 123 (?)
78 > abc
77 > abc
79 > def (?)
78 > def (?)
80 > 456 (?)
79 > 456 (?)
81 > xyz
80 > xyz
82 > $ printf 'zyx\nwvu\ntsr\n'
81 > $ printf 'zyx\nwvu\ntsr\n'
83 > abc (?)
82 > abc (?)
84 > zyx (custom !)
83 > zyx (custom !)
85 > wvu
84 > wvu
86 > no_print (no-custom !)
85 > no_print (no-custom !)
87 > tsr (no-missing !)
86 > tsr (no-missing !)
88 > missing (missing !)
87 > missing (missing !)
89 > EOF
88 > EOF
90
89
91 $ rt
90 $ rt
92 .
91 .
93 # Ran 1 tests, 0 skipped, 0 failed.
92 # Ran 1 tests, 0 skipped, 0 failed.
94
93
95 failing test
94 failing test
96 ==================
95 ==================
97
96
98 test churn with globs
97 test churn with globs
99 $ cat > test-failure.t <<EOF
98 $ cat > test-failure.t <<EOF
100 > $ echo "bar-baz"; echo "bar-bad"; echo foo
99 > $ echo "bar-baz"; echo "bar-bad"; echo foo
101 > bar*bad (glob)
100 > bar*bad (glob)
102 > bar*baz (glob)
101 > bar*baz (glob)
103 > | fo (re)
102 > | fo (re)
104 > EOF
103 > EOF
105 $ rt test-failure.t
104 $ rt test-failure.t
106
105
107 --- $TESTTMP/test-failure.t
106 --- $TESTTMP/test-failure.t
108 +++ $TESTTMP/test-failure.t.err
107 +++ $TESTTMP/test-failure.t.err
109 @@ -1,4 +1,4 @@
108 @@ -1,4 +1,4 @@
110 $ echo "bar-baz"; echo "bar-bad"; echo foo
109 $ echo "bar-baz"; echo "bar-bad"; echo foo
111 + bar*baz (glob)
110 + bar*baz (glob)
112 bar*bad (glob)
111 bar*bad (glob)
113 - bar*baz (glob)
112 - bar*baz (glob)
114 - | fo (re)
113 - | fo (re)
115 + foo
114 + foo
116
115
117 ERROR: test-failure.t output changed
116 ERROR: test-failure.t output changed
118 !
117 !
119 Failed test-failure.t: output changed
118 Failed test-failure.t: output changed
120 # Ran 1 tests, 0 skipped, 1 failed.
119 # Ran 1 tests, 0 skipped, 1 failed.
121 python hash seed: * (glob)
120 python hash seed: * (glob)
122 [1]
121 [1]
123
122
124 test diff colorisation
123 test diff colorisation
125
124
126 #if no-windows pygments
125 #if no-windows pygments
127 $ rt test-failure.t --color always
126 $ rt test-failure.t --color always
128
127
129 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
128 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
130 \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
129 \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
131 \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
130 \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
132 $ echo "bar-baz"; echo "bar-bad"; echo foo
131 $ echo "bar-baz"; echo "bar-bad"; echo foo
133 \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc)
132 \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc)
134 bar*bad (glob)
133 bar*bad (glob)
135 \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc)
134 \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc)
136 \x1b[38;5;124m- | fo (re)\x1b[39m (esc)
135 \x1b[38;5;124m- | fo (re)\x1b[39m (esc)
137 \x1b[38;5;34m+ foo\x1b[39m (esc)
136 \x1b[38;5;34m+ foo\x1b[39m (esc)
138
137
139 \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
138 \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
140 !
139 !
141 \x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc)
140 \x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc)
142 # Ran 1 tests, 0 skipped, 1 failed.
141 # Ran 1 tests, 0 skipped, 1 failed.
143 python hash seed: * (glob)
142 python hash seed: * (glob)
144 [1]
143 [1]
145
144
146 $ rt test-failure.t 2> tmp.log
145 $ rt test-failure.t 2> tmp.log
147 [1]
146 [1]
148 $ cat tmp.log
147 $ cat tmp.log
149
148
150 --- $TESTTMP/test-failure.t
149 --- $TESTTMP/test-failure.t
151 +++ $TESTTMP/test-failure.t.err
150 +++ $TESTTMP/test-failure.t.err
152 @@ -1,4 +1,4 @@
151 @@ -1,4 +1,4 @@
153 $ echo "bar-baz"; echo "bar-bad"; echo foo
152 $ echo "bar-baz"; echo "bar-bad"; echo foo
154 + bar*baz (glob)
153 + bar*baz (glob)
155 bar*bad (glob)
154 bar*bad (glob)
156 - bar*baz (glob)
155 - bar*baz (glob)
157 - | fo (re)
156 - | fo (re)
158 + foo
157 + foo
159
158
160 ERROR: test-failure.t output changed
159 ERROR: test-failure.t output changed
161 !
160 !
162 Failed test-failure.t: output changed
161 Failed test-failure.t: output changed
163 # Ran 1 tests, 0 skipped, 1 failed.
162 # Ran 1 tests, 0 skipped, 1 failed.
164 python hash seed: * (glob)
163 python hash seed: * (glob)
165 #endif
164 #endif
166
165
167 $ cat > test-failure.t << EOF
166 $ cat > test-failure.t << EOF
168 > $ true
167 > $ true
169 > should go away (true !)
168 > should go away (true !)
170 > $ true
169 > $ true
171 > should stay (false !)
170 > should stay (false !)
172 >
171 >
173 > Should remove first line, not second or third
172 > Should remove first line, not second or third
174 > $ echo 'testing'
173 > $ echo 'testing'
175 > baz*foo (glob) (true !)
174 > baz*foo (glob) (true !)
176 > foobar*foo (glob) (false !)
175 > foobar*foo (glob) (false !)
177 > te*ting (glob) (true !)
176 > te*ting (glob) (true !)
178 >
177 >
179 > Should keep first two lines, remove third and last
178 > Should keep first two lines, remove third and last
180 > $ echo 'testing'
179 > $ echo 'testing'
181 > test.ng (re) (true !)
180 > test.ng (re) (true !)
182 > foo.ar (re) (false !)
181 > foo.ar (re) (false !)
183 > b.r (re) (true !)
182 > b.r (re) (true !)
184 > missing (?)
183 > missing (?)
185 > awol (true !)
184 > awol (true !)
186 >
185 >
187 > The "missing" line should stay, even though awol is dropped
186 > The "missing" line should stay, even though awol is dropped
188 > $ echo 'testing'
187 > $ echo 'testing'
189 > test.ng (re) (true !)
188 > test.ng (re) (true !)
190 > foo.ar (?)
189 > foo.ar (?)
191 > awol
190 > awol
192 > missing (?)
191 > missing (?)
193 > EOF
192 > EOF
194 $ rt test-failure.t
193 $ rt test-failure.t
195
194
196 --- $TESTTMP/test-failure.t
195 --- $TESTTMP/test-failure.t
197 +++ $TESTTMP/test-failure.t.err
196 +++ $TESTTMP/test-failure.t.err
198 @@ -1,11 +1,9 @@
197 @@ -1,11 +1,9 @@
199 $ true
198 $ true
200 - should go away (true !)
199 - should go away (true !)
201 $ true
200 $ true
202 should stay (false !)
201 should stay (false !)
203
202
204 Should remove first line, not second or third
203 Should remove first line, not second or third
205 $ echo 'testing'
204 $ echo 'testing'
206 - baz*foo (glob) (true !)
205 - baz*foo (glob) (true !)
207 foobar*foo (glob) (false !)
206 foobar*foo (glob) (false !)
208 te*ting (glob) (true !)
207 te*ting (glob) (true !)
209
208
210 foo.ar (re) (false !)
209 foo.ar (re) (false !)
211 missing (?)
210 missing (?)
212 @@ -13,13 +11,10 @@
211 @@ -13,13 +11,10 @@
213 $ echo 'testing'
212 $ echo 'testing'
214 test.ng (re) (true !)
213 test.ng (re) (true !)
215 foo.ar (re) (false !)
214 foo.ar (re) (false !)
216 - b.r (re) (true !)
215 - b.r (re) (true !)
217 missing (?)
216 missing (?)
218 - awol (true !)
217 - awol (true !)
219
218
220 The "missing" line should stay, even though awol is dropped
219 The "missing" line should stay, even though awol is dropped
221 $ echo 'testing'
220 $ echo 'testing'
222 test.ng (re) (true !)
221 test.ng (re) (true !)
223 foo.ar (?)
222 foo.ar (?)
224 - awol
223 - awol
225 missing (?)
224 missing (?)
226
225
227 ERROR: test-failure.t output changed
226 ERROR: test-failure.t output changed
228 !
227 !
229 Failed test-failure.t: output changed
228 Failed test-failure.t: output changed
230 # Ran 1 tests, 0 skipped, 1 failed.
229 # Ran 1 tests, 0 skipped, 1 failed.
231 python hash seed: * (glob)
230 python hash seed: * (glob)
232 [1]
231 [1]
233
232
234 basic failing test
233 basic failing test
235 $ cat > test-failure.t << EOF
234 $ cat > test-failure.t << EOF
236 > $ echo babar
235 > $ echo babar
237 > rataxes
236 > rataxes
238 > This is a noop statement so that
237 > This is a noop statement so that
239 > this test is still more bytes than success.
238 > this test is still more bytes than success.
240 > pad pad pad pad............................................................
239 > pad pad pad pad............................................................
241 > pad pad pad pad............................................................
240 > pad pad pad pad............................................................
242 > pad pad pad pad............................................................
241 > pad pad pad pad............................................................
243 > pad pad pad pad............................................................
242 > pad pad pad pad............................................................
244 > pad pad pad pad............................................................
243 > pad pad pad pad............................................................
245 > pad pad pad pad............................................................
244 > pad pad pad pad............................................................
246 > EOF
245 > EOF
247
246
248 >>> fh = open('test-failure-unicode.t', 'wb')
247 >>> fh = open('test-failure-unicode.t', 'wb')
249 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
248 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
250 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
249 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
251
250
252 $ rt
251 $ rt
253
252
254 --- $TESTTMP/test-failure.t
253 --- $TESTTMP/test-failure.t
255 +++ $TESTTMP/test-failure.t.err
254 +++ $TESTTMP/test-failure.t.err
256 @@ -1,5 +1,5 @@
255 @@ -1,5 +1,5 @@
257 $ echo babar
256 $ echo babar
258 - rataxes
257 - rataxes
259 + babar
258 + babar
260 This is a noop statement so that
259 This is a noop statement so that
261 this test is still more bytes than success.
260 this test is still more bytes than success.
262 pad pad pad pad............................................................
261 pad pad pad pad............................................................
263
262
264 ERROR: test-failure.t output changed
263 ERROR: test-failure.t output changed
265 !.
264 !.
266 --- $TESTTMP/test-failure-unicode.t
265 --- $TESTTMP/test-failure-unicode.t
267 +++ $TESTTMP/test-failure-unicode.t.err
266 +++ $TESTTMP/test-failure-unicode.t.err
268 @@ -1,2 +1,2 @@
267 @@ -1,2 +1,2 @@
269 $ echo babar\xce\xb1 (esc)
268 $ echo babar\xce\xb1 (esc)
270 - l\xce\xb5\xce\xb5t (esc)
269 - l\xce\xb5\xce\xb5t (esc)
271 + babar\xce\xb1 (esc)
270 + babar\xce\xb1 (esc)
272
271
273 ERROR: test-failure-unicode.t output changed
272 ERROR: test-failure-unicode.t output changed
274 !
273 !
275 Failed test-failure.t: output changed
274 Failed test-failure.t: output changed
276 Failed test-failure-unicode.t: output changed
275 Failed test-failure-unicode.t: output changed
277 # Ran 3 tests, 0 skipped, 2 failed.
276 # Ran 3 tests, 0 skipped, 2 failed.
278 python hash seed: * (glob)
277 python hash seed: * (glob)
279 [1]
278 [1]
280
279
281 test --outputdir
280 test --outputdir
282 $ mkdir output
281 $ mkdir output
283 $ rt --outputdir output
282 $ rt --outputdir output
284
283
285 --- $TESTTMP/test-failure.t
284 --- $TESTTMP/test-failure.t
286 +++ $TESTTMP/output/test-failure.t.err
285 +++ $TESTTMP/output/test-failure.t.err
287 @@ -1,5 +1,5 @@
286 @@ -1,5 +1,5 @@
288 $ echo babar
287 $ echo babar
289 - rataxes
288 - rataxes
290 + babar
289 + babar
291 This is a noop statement so that
290 This is a noop statement so that
292 this test is still more bytes than success.
291 this test is still more bytes than success.
293 pad pad pad pad............................................................
292 pad pad pad pad............................................................
294
293
295 ERROR: test-failure.t output changed
294 ERROR: test-failure.t output changed
296 !.
295 !.
297 --- $TESTTMP/test-failure-unicode.t
296 --- $TESTTMP/test-failure-unicode.t
298 +++ $TESTTMP/output/test-failure-unicode.t.err
297 +++ $TESTTMP/output/test-failure-unicode.t.err
299 @@ -1,2 +1,2 @@
298 @@ -1,2 +1,2 @@
300 $ echo babar\xce\xb1 (esc)
299 $ echo babar\xce\xb1 (esc)
301 - l\xce\xb5\xce\xb5t (esc)
300 - l\xce\xb5\xce\xb5t (esc)
302 + babar\xce\xb1 (esc)
301 + babar\xce\xb1 (esc)
303
302
304 ERROR: test-failure-unicode.t output changed
303 ERROR: test-failure-unicode.t output changed
305 !
304 !
306 Failed test-failure.t: output changed
305 Failed test-failure.t: output changed
307 Failed test-failure-unicode.t: output changed
306 Failed test-failure-unicode.t: output changed
308 # Ran 3 tests, 0 skipped, 2 failed.
307 # Ran 3 tests, 0 skipped, 2 failed.
309 python hash seed: * (glob)
308 python hash seed: * (glob)
310 [1]
309 [1]
311 $ ls -a output
310 $ ls -a output
312 .
311 .
313 ..
312 ..
314 .testtimes
313 .testtimes
315 test-failure-unicode.t.err
314 test-failure-unicode.t.err
316 test-failure.t.err
315 test-failure.t.err
317
316
318 test --xunit support
317 test --xunit support
319 $ rt --xunit=xunit.xml
318 $ rt --xunit=xunit.xml
320
319
321 --- $TESTTMP/test-failure.t
320 --- $TESTTMP/test-failure.t
322 +++ $TESTTMP/test-failure.t.err
321 +++ $TESTTMP/test-failure.t.err
323 @@ -1,5 +1,5 @@
322 @@ -1,5 +1,5 @@
324 $ echo babar
323 $ echo babar
325 - rataxes
324 - rataxes
326 + babar
325 + babar
327 This is a noop statement so that
326 This is a noop statement so that
328 this test is still more bytes than success.
327 this test is still more bytes than success.
329 pad pad pad pad............................................................
328 pad pad pad pad............................................................
330
329
331 ERROR: test-failure.t output changed
330 ERROR: test-failure.t output changed
332 !.
331 !.
333 --- $TESTTMP/test-failure-unicode.t
332 --- $TESTTMP/test-failure-unicode.t
334 +++ $TESTTMP/test-failure-unicode.t.err
333 +++ $TESTTMP/test-failure-unicode.t.err
335 @@ -1,2 +1,2 @@
334 @@ -1,2 +1,2 @@
336 $ echo babar\xce\xb1 (esc)
335 $ echo babar\xce\xb1 (esc)
337 - l\xce\xb5\xce\xb5t (esc)
336 - l\xce\xb5\xce\xb5t (esc)
338 + babar\xce\xb1 (esc)
337 + babar\xce\xb1 (esc)
339
338
340 ERROR: test-failure-unicode.t output changed
339 ERROR: test-failure-unicode.t output changed
341 !
340 !
342 Failed test-failure.t: output changed
341 Failed test-failure.t: output changed
343 Failed test-failure-unicode.t: output changed
342 Failed test-failure-unicode.t: output changed
344 # Ran 3 tests, 0 skipped, 2 failed.
343 # Ran 3 tests, 0 skipped, 2 failed.
345 python hash seed: * (glob)
344 python hash seed: * (glob)
346 [1]
345 [1]
347 $ cat xunit.xml
346 $ cat xunit.xml
348 <?xml version="1.0" encoding="utf-8"?>
347 <?xml version="1.0" encoding="utf-8"?>
349 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
348 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
350 <testcase name="test-success.t" time="*"/> (glob)
349 <testcase name="test-success.t" time="*"/> (glob)
351 <testcase name="test-failure-unicode.t" time="*"> (glob)
350 <testcase name="test-failure-unicode.t" time="*"> (glob)
352 <failure message="output changed" type="output-mismatch">
351 <failure message="output changed" type="output-mismatch">
353 <![CDATA[--- $TESTTMP/test-failure-unicode.t
352 <![CDATA[--- $TESTTMP/test-failure-unicode.t
354 +++ $TESTTMP/test-failure-unicode.t.err
353 +++ $TESTTMP/test-failure-unicode.t.err
355 @@ -1,2 +1,2 @@
354 @@ -1,2 +1,2 @@
356 $ echo babar\xce\xb1 (esc)
355 $ echo babar\xce\xb1 (esc)
357 - l\xce\xb5\xce\xb5t (esc)
356 - l\xce\xb5\xce\xb5t (esc)
358 + babar\xce\xb1 (esc)
357 + babar\xce\xb1 (esc)
359 ]]> </failure>
358 ]]> </failure>
360 </testcase>
359 </testcase>
361 <testcase name="test-failure.t" time="*"> (glob)
360 <testcase name="test-failure.t" time="*"> (glob)
362 <failure message="output changed" type="output-mismatch">
361 <failure message="output changed" type="output-mismatch">
363 <![CDATA[--- $TESTTMP/test-failure.t
362 <![CDATA[--- $TESTTMP/test-failure.t
364 +++ $TESTTMP/test-failure.t.err
363 +++ $TESTTMP/test-failure.t.err
365 @@ -1,5 +1,5 @@
364 @@ -1,5 +1,5 @@
366 $ echo babar
365 $ echo babar
367 - rataxes
366 - rataxes
368 + babar
367 + babar
369 This is a noop statement so that
368 This is a noop statement so that
370 this test is still more bytes than success.
369 this test is still more bytes than success.
371 pad pad pad pad............................................................
370 pad pad pad pad............................................................
372 ]]> </failure>
371 ]]> </failure>
373 </testcase>
372 </testcase>
374 </testsuite>
373 </testsuite>
375
374
376 $ cat .testtimes
375 $ cat .testtimes
377 test-empty.t * (glob)
376 test-empty.t * (glob)
378 test-failure-unicode.t * (glob)
377 test-failure-unicode.t * (glob)
379 test-failure.t * (glob)
378 test-failure.t * (glob)
380 test-success.t * (glob)
379 test-success.t * (glob)
381
380
382 $ rt --list-tests
381 $ rt --list-tests
383 test-failure-unicode.t
382 test-failure-unicode.t
384 test-failure.t
383 test-failure.t
385 test-success.t
384 test-success.t
386
385
387 $ rt --list-tests --json
386 $ rt --list-tests --json
388 test-failure-unicode.t
387 test-failure-unicode.t
389 test-failure.t
388 test-failure.t
390 test-success.t
389 test-success.t
391 $ cat report.json
390 $ cat report.json
392 testreport ={
391 testreport ={
393 "test-failure-unicode.t": {
392 "test-failure-unicode.t": {
394 "result": "success"
393 "result": "success"
395 },
394 },
396 "test-failure.t": {
395 "test-failure.t": {
397 "result": "success"
396 "result": "success"
398 },
397 },
399 "test-success.t": {
398 "test-success.t": {
400 "result": "success"
399 "result": "success"
401 }
400 }
402 } (no-eol)
401 } (no-eol)
403
402
404 $ rt --list-tests --xunit=xunit.xml
403 $ rt --list-tests --xunit=xunit.xml
405 test-failure-unicode.t
404 test-failure-unicode.t
406 test-failure.t
405 test-failure.t
407 test-success.t
406 test-success.t
408 $ cat xunit.xml
407 $ cat xunit.xml
409 <?xml version="1.0" encoding="utf-8"?>
408 <?xml version="1.0" encoding="utf-8"?>
410 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
409 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
411 <testcase name="test-failure-unicode.t"/>
410 <testcase name="test-failure-unicode.t"/>
412 <testcase name="test-failure.t"/>
411 <testcase name="test-failure.t"/>
413 <testcase name="test-success.t"/>
412 <testcase name="test-success.t"/>
414 </testsuite>
413 </testsuite>
415
414
416 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
415 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
417 test-failure-unicode.t
416 test-failure-unicode.t
418 test-failure.t
417 test-failure.t
419 $ cat output/report.json
418 $ cat output/report.json
420 testreport ={
419 testreport ={
421 "test-failure-unicode.t": {
420 "test-failure-unicode.t": {
422 "result": "success"
421 "result": "success"
423 },
422 },
424 "test-failure.t": {
423 "test-failure.t": {
425 "result": "success"
424 "result": "success"
426 }
425 }
427 } (no-eol)
426 } (no-eol)
428 $ cat xunit.xml
427 $ cat xunit.xml
429 <?xml version="1.0" encoding="utf-8"?>
428 <?xml version="1.0" encoding="utf-8"?>
430 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
429 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
431 <testcase name="test-failure-unicode.t"/>
430 <testcase name="test-failure-unicode.t"/>
432 <testcase name="test-failure.t"/>
431 <testcase name="test-failure.t"/>
433 </testsuite>
432 </testsuite>
434
433
435 $ rm test-failure-unicode.t
434 $ rm test-failure-unicode.t
436
435
437 test for --retest
436 test for --retest
438 ====================
437 ====================
439
438
440 $ rt --retest
439 $ rt --retest
441
440
442 --- $TESTTMP/test-failure.t
441 --- $TESTTMP/test-failure.t
443 +++ $TESTTMP/test-failure.t.err
442 +++ $TESTTMP/test-failure.t.err
444 @@ -1,5 +1,5 @@
443 @@ -1,5 +1,5 @@
445 $ echo babar
444 $ echo babar
446 - rataxes
445 - rataxes
447 + babar
446 + babar
448 This is a noop statement so that
447 This is a noop statement so that
449 this test is still more bytes than success.
448 this test is still more bytes than success.
450 pad pad pad pad............................................................
449 pad pad pad pad............................................................
451
450
452 ERROR: test-failure.t output changed
451 ERROR: test-failure.t output changed
453 !
452 !
454 Failed test-failure.t: output changed
453 Failed test-failure.t: output changed
455 # Ran 2 tests, 1 skipped, 1 failed.
454 # Ran 2 tests, 1 skipped, 1 failed.
456 python hash seed: * (glob)
455 python hash seed: * (glob)
457 [1]
456 [1]
458
457
459 --retest works with --outputdir
458 --retest works with --outputdir
460 $ rm -r output
459 $ rm -r output
461 $ mkdir output
460 $ mkdir output
462 $ mv test-failure.t.err output
461 $ mv test-failure.t.err output
463 $ rt --retest --outputdir output
462 $ rt --retest --outputdir output
464
463
465 --- $TESTTMP/test-failure.t
464 --- $TESTTMP/test-failure.t
466 +++ $TESTTMP/output/test-failure.t.err
465 +++ $TESTTMP/output/test-failure.t.err
467 @@ -1,5 +1,5 @@
466 @@ -1,5 +1,5 @@
468 $ echo babar
467 $ echo babar
469 - rataxes
468 - rataxes
470 + babar
469 + babar
471 This is a noop statement so that
470 This is a noop statement so that
472 this test is still more bytes than success.
471 this test is still more bytes than success.
473 pad pad pad pad............................................................
472 pad pad pad pad............................................................
474
473
475 ERROR: test-failure.t output changed
474 ERROR: test-failure.t output changed
476 !
475 !
477 Failed test-failure.t: output changed
476 Failed test-failure.t: output changed
478 # Ran 2 tests, 1 skipped, 1 failed.
477 # Ran 2 tests, 1 skipped, 1 failed.
479 python hash seed: * (glob)
478 python hash seed: * (glob)
480 [1]
479 [1]
481
480
482 Selecting Tests To Run
481 Selecting Tests To Run
483 ======================
482 ======================
484
483
485 successful
484 successful
486
485
487 $ rt test-success.t
486 $ rt test-success.t
488 .
487 .
489 # Ran 1 tests, 0 skipped, 0 failed.
488 # Ran 1 tests, 0 skipped, 0 failed.
490
489
491 success w/ keyword
490 success w/ keyword
492 $ rt -k xyzzy
491 $ rt -k xyzzy
493 .
492 .
494 # Ran 2 tests, 1 skipped, 0 failed.
493 # Ran 2 tests, 1 skipped, 0 failed.
495
494
496 failed
495 failed
497
496
498 $ rt test-failure.t
497 $ rt test-failure.t
499
498
500 --- $TESTTMP/test-failure.t
499 --- $TESTTMP/test-failure.t
501 +++ $TESTTMP/test-failure.t.err
500 +++ $TESTTMP/test-failure.t.err
502 @@ -1,5 +1,5 @@
501 @@ -1,5 +1,5 @@
503 $ echo babar
502 $ echo babar
504 - rataxes
503 - rataxes
505 + babar
504 + babar
506 This is a noop statement so that
505 This is a noop statement so that
507 this test is still more bytes than success.
506 this test is still more bytes than success.
508 pad pad pad pad............................................................
507 pad pad pad pad............................................................
509
508
510 ERROR: test-failure.t output changed
509 ERROR: test-failure.t output changed
511 !
510 !
512 Failed test-failure.t: output changed
511 Failed test-failure.t: output changed
513 # Ran 1 tests, 0 skipped, 1 failed.
512 # Ran 1 tests, 0 skipped, 1 failed.
514 python hash seed: * (glob)
513 python hash seed: * (glob)
515 [1]
514 [1]
516
515
517 failure w/ keyword
516 failure w/ keyword
518 $ rt -k rataxes
517 $ rt -k rataxes
519
518
520 --- $TESTTMP/test-failure.t
519 --- $TESTTMP/test-failure.t
521 +++ $TESTTMP/test-failure.t.err
520 +++ $TESTTMP/test-failure.t.err
522 @@ -1,5 +1,5 @@
521 @@ -1,5 +1,5 @@
523 $ echo babar
522 $ echo babar
524 - rataxes
523 - rataxes
525 + babar
524 + babar
526 This is a noop statement so that
525 This is a noop statement so that
527 this test is still more bytes than success.
526 this test is still more bytes than success.
528 pad pad pad pad............................................................
527 pad pad pad pad............................................................
529
528
530 ERROR: test-failure.t output changed
529 ERROR: test-failure.t output changed
531 !
530 !
532 Failed test-failure.t: output changed
531 Failed test-failure.t: output changed
533 # Ran 2 tests, 1 skipped, 1 failed.
532 # Ran 2 tests, 1 skipped, 1 failed.
534 python hash seed: * (glob)
533 python hash seed: * (glob)
535 [1]
534 [1]
536
535
537 Verify that when a process fails to start we show a useful message
536 Verify that when a process fails to start we show a useful message
538 ==================================================================
537 ==================================================================
539
538
540 $ cat > test-serve-fail.t <<EOF
539 $ cat > test-serve-fail.t <<EOF
541 > $ echo 'abort: child process failed to start blah'
540 > $ echo 'abort: child process failed to start blah'
542 > EOF
541 > EOF
543 $ rt test-serve-fail.t
542 $ rt test-serve-fail.t
544
543
545 --- $TESTTMP/test-serve-fail.t
544 --- $TESTTMP/test-serve-fail.t
546 +++ $TESTTMP/test-serve-fail.t.err
545 +++ $TESTTMP/test-serve-fail.t.err
547 @@ -1* +1,2 @@ (glob)
546 @@ -1* +1,2 @@ (glob)
548 $ echo 'abort: child process failed to start blah'
547 $ echo 'abort: child process failed to start blah'
549 + abort: child process failed to start blah
548 + abort: child process failed to start blah
550
549
551 ERROR: test-serve-fail.t output changed
550 ERROR: test-serve-fail.t output changed
552 !
551 !
553 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
552 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
554 # Ran 1 tests, 0 skipped, 1 failed.
553 # Ran 1 tests, 0 skipped, 1 failed.
555 python hash seed: * (glob)
554 python hash seed: * (glob)
556 [1]
555 [1]
557 $ rm test-serve-fail.t
556 $ rm test-serve-fail.t
558
557
559 Verify that we can try other ports
558 Verify that we can try other ports
560 ===================================
559 ===================================
561
560
562 Extensions aren't inherited by the invoked run-tests.py. An extension
561 Extensions aren't inherited by the invoked run-tests.py. An extension
563 introducing a repository requirement could cause this to fail. So we force
562 introducing a repository requirement could cause this to fail. So we force
564 HGRCPATH to get a clean environment.
563 HGRCPATH to get a clean environment.
565
564
566 $ HGRCPATH= hg init inuse
565 $ HGRCPATH= hg init inuse
567 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
566 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
568 $ cat blocks.pid >> $DAEMON_PIDS
567 $ cat blocks.pid >> $DAEMON_PIDS
569 $ cat > test-serve-inuse.t <<EOF
568 $ cat > test-serve-inuse.t <<EOF
570 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
569 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
571 > $ cat hg.pid >> \$DAEMON_PIDS
570 > $ cat hg.pid >> \$DAEMON_PIDS
572 > EOF
571 > EOF
573 $ rt test-serve-inuse.t
572 $ rt test-serve-inuse.t
574 .
573 .
575 # Ran 1 tests, 0 skipped, 0 failed.
574 # Ran 1 tests, 0 skipped, 0 failed.
576 $ rm test-serve-inuse.t
575 $ rm test-serve-inuse.t
577 $ killdaemons.py $DAEMON_PIDS
576 $ killdaemons.py $DAEMON_PIDS
578 $ rm $DAEMON_PIDS
577 $ rm $DAEMON_PIDS
579
578
580 Running In Debug Mode
579 Running In Debug Mode
581 ======================
580 ======================
582
581
583 $ rt --debug 2>&1 | grep -v pwd
582 $ rt --debug 2>&1 | grep -v pwd
584 + echo *SALT* 0 0 (glob)
583 + echo *SALT* 0 0 (glob)
585 *SALT* 0 0 (glob)
584 *SALT* 0 0 (glob)
586 + echo babar
585 + echo babar
587 babar
586 babar
588 + echo *SALT* 10 0 (glob)
587 + echo *SALT* 10 0 (glob)
589 *SALT* 10 0 (glob)
588 *SALT* 10 0 (glob)
590 *+ echo *SALT* 0 0 (glob)
589 *+ echo *SALT* 0 0 (glob)
591 *SALT* 0 0 (glob)
590 *SALT* 0 0 (glob)
592 + echo babar
591 + echo babar
593 babar
592 babar
594 + echo *SALT* 2 0 (glob)
593 + echo *SALT* 2 0 (glob)
595 *SALT* 2 0 (glob)
594 *SALT* 2 0 (glob)
596 + echo xyzzy
595 + echo xyzzy
597 xyzzy
596 xyzzy
598 + echo *SALT* 9 0 (glob)
597 + echo *SALT* 9 0 (glob)
599 *SALT* 9 0 (glob)
598 *SALT* 9 0 (glob)
600 + printf *abc\ndef\nxyz\n* (glob)
599 + printf *abc\ndef\nxyz\n* (glob)
601 abc
600 abc
602 def
601 def
603 xyz
602 xyz
604 + echo *SALT* 15 0 (glob)
603 + echo *SALT* 15 0 (glob)
605 *SALT* 15 0 (glob)
604 *SALT* 15 0 (glob)
606 + printf *zyx\nwvu\ntsr\n* (glob)
605 + printf *zyx\nwvu\ntsr\n* (glob)
607 zyx
606 zyx
608 wvu
607 wvu
609 tsr
608 tsr
610 + echo *SALT* 22 0 (glob)
609 + echo *SALT* 22 0 (glob)
611 *SALT* 22 0 (glob)
610 *SALT* 22 0 (glob)
612 .
611 .
613 # Ran 2 tests, 0 skipped, 0 failed.
612 # Ran 2 tests, 0 skipped, 0 failed.
614
613
615 Parallel runs
614 Parallel runs
616 ==============
615 ==============
617
616
618 (duplicate the failing test to get predictable output)
617 (duplicate the failing test to get predictable output)
619 $ cp test-failure.t test-failure-copy.t
618 $ cp test-failure.t test-failure-copy.t
620
619
621 $ rt --jobs 2 test-failure*.t -n
620 $ rt --jobs 2 test-failure*.t -n
622 !!
621 !!
623 Failed test-failure*.t: output changed (glob)
622 Failed test-failure*.t: output changed (glob)
624 Failed test-failure*.t: output changed (glob)
623 Failed test-failure*.t: output changed (glob)
625 # Ran 2 tests, 0 skipped, 2 failed.
624 # Ran 2 tests, 0 skipped, 2 failed.
626 python hash seed: * (glob)
625 python hash seed: * (glob)
627 [1]
626 [1]
628
627
629 failures in parallel with --first should only print one failure
628 failures in parallel with --first should only print one failure
630 $ rt --jobs 2 --first test-failure*.t
629 $ rt --jobs 2 --first test-failure*.t
631
630
632 --- $TESTTMP/test-failure*.t (glob)
631 --- $TESTTMP/test-failure*.t (glob)
633 +++ $TESTTMP/test-failure*.t.err (glob)
632 +++ $TESTTMP/test-failure*.t.err (glob)
634 @@ -1,5 +1,5 @@
633 @@ -1,5 +1,5 @@
635 $ echo babar
634 $ echo babar
636 - rataxes
635 - rataxes
637 + babar
636 + babar
638 This is a noop statement so that
637 This is a noop statement so that
639 this test is still more bytes than success.
638 this test is still more bytes than success.
640 pad pad pad pad............................................................
639 pad pad pad pad............................................................
641
640
642 Failed test-failure*.t: output changed (glob)
641 Failed test-failure*.t: output changed (glob)
643 Failed test-failure*.t: output changed (glob)
642 Failed test-failure*.t: output changed (glob)
644 # Ran 2 tests, 0 skipped, 2 failed.
643 # Ran 2 tests, 0 skipped, 2 failed.
645 python hash seed: * (glob)
644 python hash seed: * (glob)
646 [1]
645 [1]
647
646
648
647
649 (delete the duplicated test file)
648 (delete the duplicated test file)
650 $ rm test-failure-copy.t
649 $ rm test-failure-copy.t
651
650
652
651
653 Interactive run
652 Interactive run
654 ===============
653 ===============
655
654
656 (backup the failing test)
655 (backup the failing test)
657 $ cp test-failure.t backup
656 $ cp test-failure.t backup
658
657
659 Refuse the fix
658 Refuse the fix
660
659
661 $ echo 'n' | rt -i
660 $ echo 'n' | rt -i
662
661
663 --- $TESTTMP/test-failure.t
662 --- $TESTTMP/test-failure.t
664 +++ $TESTTMP/test-failure.t.err
663 +++ $TESTTMP/test-failure.t.err
665 @@ -1,5 +1,5 @@
664 @@ -1,5 +1,5 @@
666 $ echo babar
665 $ echo babar
667 - rataxes
666 - rataxes
668 + babar
667 + babar
669 This is a noop statement so that
668 This is a noop statement so that
670 this test is still more bytes than success.
669 this test is still more bytes than success.
671 pad pad pad pad............................................................
670 pad pad pad pad............................................................
672 Accept this change? [n]
671 Accept this change? [n]
673 ERROR: test-failure.t output changed
672 ERROR: test-failure.t output changed
674 !.
673 !.
675 Failed test-failure.t: output changed
674 Failed test-failure.t: output changed
676 # Ran 2 tests, 0 skipped, 1 failed.
675 # Ran 2 tests, 0 skipped, 1 failed.
677 python hash seed: * (glob)
676 python hash seed: * (glob)
678 [1]
677 [1]
679
678
680 $ cat test-failure.t
679 $ cat test-failure.t
681 $ echo babar
680 $ echo babar
682 rataxes
681 rataxes
683 This is a noop statement so that
682 This is a noop statement so that
684 this test is still more bytes than success.
683 this test is still more bytes than success.
685 pad pad pad pad............................................................
684 pad pad pad pad............................................................
686 pad pad pad pad............................................................
685 pad pad pad pad............................................................
687 pad pad pad pad............................................................
686 pad pad pad pad............................................................
688 pad pad pad pad............................................................
687 pad pad pad pad............................................................
689 pad pad pad pad............................................................
688 pad pad pad pad............................................................
690 pad pad pad pad............................................................
689 pad pad pad pad............................................................
691
690
692 Interactive with custom view
691 Interactive with custom view
693
692
694 $ echo 'n' | rt -i --view echo
693 $ echo 'n' | rt -i --view echo
695 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
694 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
696 Accept this change? [n]* (glob)
695 Accept this change? [n]* (glob)
697 ERROR: test-failure.t output changed
696 ERROR: test-failure.t output changed
698 !.
697 !.
699 Failed test-failure.t: output changed
698 Failed test-failure.t: output changed
700 # Ran 2 tests, 0 skipped, 1 failed.
699 # Ran 2 tests, 0 skipped, 1 failed.
701 python hash seed: * (glob)
700 python hash seed: * (glob)
702 [1]
701 [1]
703
702
704 View the fix
703 View the fix
705
704
706 $ echo 'y' | rt --view echo
705 $ echo 'y' | rt --view echo
707 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
706 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
708
707
709 ERROR: test-failure.t output changed
708 ERROR: test-failure.t output changed
710 !.
709 !.
711 Failed test-failure.t: output changed
710 Failed test-failure.t: output changed
712 # Ran 2 tests, 0 skipped, 1 failed.
711 # Ran 2 tests, 0 skipped, 1 failed.
713 python hash seed: * (glob)
712 python hash seed: * (glob)
714 [1]
713 [1]
715
714
716 Accept the fix
715 Accept the fix
717
716
718 $ cat >> test-failure.t <<EOF
717 $ cat >> test-failure.t <<EOF
719 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
718 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
720 > saved backup bundle to \$TESTTMP/foo.hg
719 > saved backup bundle to \$TESTTMP/foo.hg
721 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
720 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
722 > saved backup bundle to $TESTTMP\\foo.hg
721 > saved backup bundle to $TESTTMP\\foo.hg
723 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
722 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
724 > saved backup bundle to \$TESTTMP/*.hg (glob)
723 > saved backup bundle to \$TESTTMP/*.hg (glob)
725 > EOF
724 > EOF
726 $ echo 'y' | rt -i 2>&1
725 $ echo 'y' | rt -i 2>&1
727
726
728 --- $TESTTMP/test-failure.t
727 --- $TESTTMP/test-failure.t
729 +++ $TESTTMP/test-failure.t.err
728 +++ $TESTTMP/test-failure.t.err
730 @@ -1,5 +1,5 @@
729 @@ -1,5 +1,5 @@
731 $ echo babar
730 $ echo babar
732 - rataxes
731 - rataxes
733 + babar
732 + babar
734 This is a noop statement so that
733 This is a noop statement so that
735 this test is still more bytes than success.
734 this test is still more bytes than success.
736 pad pad pad pad............................................................
735 pad pad pad pad............................................................
737 @@ -11,6 +11,6 @@
736 @@ -11,6 +11,6 @@
738 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
737 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
739 saved backup bundle to $TESTTMP/foo.hg
738 saved backup bundle to $TESTTMP/foo.hg
740 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
739 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
741 - saved backup bundle to $TESTTMP\foo.hg
740 - saved backup bundle to $TESTTMP\foo.hg
742 + saved backup bundle to $TESTTMP/foo.hg
741 + saved backup bundle to $TESTTMP/foo.hg
743 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
742 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
744 saved backup bundle to $TESTTMP/*.hg (glob)
743 saved backup bundle to $TESTTMP/*.hg (glob)
745 Accept this change? [n] ..
744 Accept this change? [n] ..
746 # Ran 2 tests, 0 skipped, 0 failed.
745 # Ran 2 tests, 0 skipped, 0 failed.
747
746
748 $ sed -e 's,(glob)$,&<,g' test-failure.t
747 $ sed -e 's,(glob)$,&<,g' test-failure.t
749 $ echo babar
748 $ echo babar
750 babar
749 babar
751 This is a noop statement so that
750 This is a noop statement so that
752 this test is still more bytes than success.
751 this test is still more bytes than success.
753 pad pad pad pad............................................................
752 pad pad pad pad............................................................
754 pad pad pad pad............................................................
753 pad pad pad pad............................................................
755 pad pad pad pad............................................................
754 pad pad pad pad............................................................
756 pad pad pad pad............................................................
755 pad pad pad pad............................................................
757 pad pad pad pad............................................................
756 pad pad pad pad............................................................
758 pad pad pad pad............................................................
757 pad pad pad pad............................................................
759 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
758 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
760 saved backup bundle to $TESTTMP/foo.hg
759 saved backup bundle to $TESTTMP/foo.hg
761 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
760 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
762 saved backup bundle to $TESTTMP/foo.hg
761 saved backup bundle to $TESTTMP/foo.hg
763 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
762 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
764 saved backup bundle to $TESTTMP/*.hg (glob)<
763 saved backup bundle to $TESTTMP/*.hg (glob)<
765
764
766 Race condition - test file was modified when test is running
765 Race condition - test file was modified when test is running
767
766
768 $ TESTRACEDIR=`pwd`
767 $ TESTRACEDIR=`pwd`
769 $ export TESTRACEDIR
768 $ export TESTRACEDIR
770 $ cat > test-race.t <<EOF
769 $ cat > test-race.t <<EOF
771 > $ echo 1
770 > $ echo 1
772 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
771 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
773 > EOF
772 > EOF
774
773
775 $ rt -i test-race.t
774 $ rt -i test-race.t
776
775
777 --- $TESTTMP/test-race.t
776 --- $TESTTMP/test-race.t
778 +++ $TESTTMP/test-race.t.err
777 +++ $TESTTMP/test-race.t.err
779 @@ -1,2 +1,3 @@
778 @@ -1,2 +1,3 @@
780 $ echo 1
779 $ echo 1
781 + 1
780 + 1
782 $ echo "# a new line" >> $TESTTMP/test-race.t
781 $ echo "# a new line" >> $TESTTMP/test-race.t
783 Reference output has changed (run again to prompt changes)
782 Reference output has changed (run again to prompt changes)
784 ERROR: test-race.t output changed
783 ERROR: test-race.t output changed
785 !
784 !
786 Failed test-race.t: output changed
785 Failed test-race.t: output changed
787 # Ran 1 tests, 0 skipped, 1 failed.
786 # Ran 1 tests, 0 skipped, 1 failed.
788 python hash seed: * (glob)
787 python hash seed: * (glob)
789 [1]
788 [1]
790
789
791 $ rm test-race.t
790 $ rm test-race.t
792
791
793 When "#testcases" is used in .t files
792 When "#testcases" is used in .t files
794
793
795 $ cat >> test-cases.t <<EOF
794 $ cat >> test-cases.t <<EOF
796 > #testcases a b
795 > #testcases a b
797 > #if a
796 > #if a
798 > $ echo 1
797 > $ echo 1
799 > #endif
798 > #endif
800 > #if b
799 > #if b
801 > $ echo 2
800 > $ echo 2
802 > #endif
801 > #endif
803 > EOF
802 > EOF
804
803
805 $ cat <<EOF | rt -i test-cases.t 2>&1
804 $ cat <<EOF | rt -i test-cases.t 2>&1
806 > y
805 > y
807 > y
806 > y
808 > EOF
807 > EOF
809
808
810 --- $TESTTMP/test-cases.t
809 --- $TESTTMP/test-cases.t
811 +++ $TESTTMP/test-cases.t.a.err
810 +++ $TESTTMP/test-cases.t.a.err
812 @@ -1,6 +1,7 @@
811 @@ -1,6 +1,7 @@
813 #testcases a b
812 #testcases a b
814 #if a
813 #if a
815 $ echo 1
814 $ echo 1
816 + 1
815 + 1
817 #endif
816 #endif
818 #if b
817 #if b
819 $ echo 2
818 $ echo 2
820 Accept this change? [n] .
819 Accept this change? [n] .
821 --- $TESTTMP/test-cases.t
820 --- $TESTTMP/test-cases.t
822 +++ $TESTTMP/test-cases.t.b.err
821 +++ $TESTTMP/test-cases.t.b.err
823 @@ -5,4 +5,5 @@
822 @@ -5,4 +5,5 @@
824 #endif
823 #endif
825 #if b
824 #if b
826 $ echo 2
825 $ echo 2
827 + 2
826 + 2
828 #endif
827 #endif
829 Accept this change? [n] .
828 Accept this change? [n] .
830 # Ran 2 tests, 0 skipped, 0 failed.
829 # Ran 2 tests, 0 skipped, 0 failed.
831
830
832 $ cat test-cases.t
831 $ cat test-cases.t
833 #testcases a b
832 #testcases a b
834 #if a
833 #if a
835 $ echo 1
834 $ echo 1
836 1
835 1
837 #endif
836 #endif
838 #if b
837 #if b
839 $ echo 2
838 $ echo 2
840 2
839 2
841 #endif
840 #endif
842
841
843 $ cat >> test-cases.t <<'EOF'
842 $ cat >> test-cases.t <<'EOF'
844 > #if a
843 > #if a
845 > $ NAME=A
844 > $ NAME=A
846 > #else
845 > #else
847 > $ NAME=B
846 > $ NAME=B
848 > #endif
847 > #endif
849 > $ echo $NAME
848 > $ echo $NAME
850 > A (a !)
849 > A (a !)
851 > B (b !)
850 > B (b !)
852 > EOF
851 > EOF
853 $ rt test-cases.t
852 $ rt test-cases.t
854 ..
853 ..
855 # Ran 2 tests, 0 skipped, 0 failed.
854 # Ran 2 tests, 0 skipped, 0 failed.
856
855
857 $ rm test-cases.t
856 $ rm test-cases.t
858
857
859 (reinstall)
858 (reinstall)
860 $ mv backup test-failure.t
859 $ mv backup test-failure.t
861
860
862 No Diff
861 No Diff
863 ===============
862 ===============
864
863
865 $ rt --nodiff
864 $ rt --nodiff
866 !.
865 !.
867 Failed test-failure.t: output changed
866 Failed test-failure.t: output changed
868 # Ran 2 tests, 0 skipped, 1 failed.
867 # Ran 2 tests, 0 skipped, 1 failed.
869 python hash seed: * (glob)
868 python hash seed: * (glob)
870 [1]
869 [1]
871
870
872 test --tmpdir support
871 test --tmpdir support
873 $ rt --tmpdir=$TESTTMP/keep test-success.t
872 $ rt --tmpdir=$TESTTMP/keep test-success.t
874
873
875 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
874 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
876 Keeping threadtmp dir: $TESTTMP/keep/child1
875 Keeping threadtmp dir: $TESTTMP/keep/child1
877 .
876 .
878 # Ran 1 tests, 0 skipped, 0 failed.
877 # Ran 1 tests, 0 skipped, 0 failed.
879
878
880 timeouts
879 timeouts
881 ========
880 ========
882 $ cat > test-timeout.t <<EOF
881 $ cat > test-timeout.t <<EOF
883 > $ sleep 2
882 > $ sleep 2
884 > $ echo pass
883 > $ echo pass
885 > pass
884 > pass
886 > EOF
885 > EOF
887 > echo '#require slow' > test-slow-timeout.t
886 > echo '#require slow' > test-slow-timeout.t
888 > cat test-timeout.t >> test-slow-timeout.t
887 > cat test-timeout.t >> test-slow-timeout.t
889 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
888 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
890 st
889 st
891 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
890 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
892 Failed test-timeout.t: timed out
891 Failed test-timeout.t: timed out
893 # Ran 1 tests, 1 skipped, 1 failed.
892 # Ran 1 tests, 1 skipped, 1 failed.
894 python hash seed: * (glob)
893 python hash seed: * (glob)
895 [1]
894 [1]
896 $ rt --timeout=1 --slowtimeout=3 \
895 $ rt --timeout=1 --slowtimeout=3 \
897 > test-timeout.t test-slow-timeout.t --allow-slow-tests
896 > test-timeout.t test-slow-timeout.t --allow-slow-tests
898 .t
897 .t
899 Failed test-timeout.t: timed out
898 Failed test-timeout.t: timed out
900 # Ran 2 tests, 0 skipped, 1 failed.
899 # Ran 2 tests, 0 skipped, 1 failed.
901 python hash seed: * (glob)
900 python hash seed: * (glob)
902 [1]
901 [1]
903 $ rm test-timeout.t test-slow-timeout.t
902 $ rm test-timeout.t test-slow-timeout.t
904
903
905 test for --time
904 test for --time
906 ==================
905 ==================
907
906
908 $ rt test-success.t --time
907 $ rt test-success.t --time
909 .
908 .
910 # Ran 1 tests, 0 skipped, 0 failed.
909 # Ran 1 tests, 0 skipped, 0 failed.
911 # Producing time report
910 # Producing time report
912 start end cuser csys real Test
911 start end cuser csys real Test
913 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
912 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
914
913
915 test for --time with --job enabled
914 test for --time with --job enabled
916 ====================================
915 ====================================
917
916
918 $ rt test-success.t --time --jobs 2
917 $ rt test-success.t --time --jobs 2
919 .
918 .
920 # Ran 1 tests, 0 skipped, 0 failed.
919 # Ran 1 tests, 0 skipped, 0 failed.
921 # Producing time report
920 # Producing time report
922 start end cuser csys real Test
921 start end cuser csys real Test
923 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
922 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
924
923
925 Skips
924 Skips
926 ================
925 ================
927 $ cat > test-skip.t <<EOF
926 $ cat > test-skip.t <<EOF
928 > $ echo xyzzy
927 > $ echo xyzzy
929 > #if true
928 > #if true
930 > #require false
929 > #require false
931 > #end
930 > #end
932 > EOF
931 > EOF
933 $ cat > test-noskip.t <<EOF
932 $ cat > test-noskip.t <<EOF
934 > #if false
933 > #if false
935 > #require false
934 > #require false
936 > #endif
935 > #endif
937 > EOF
936 > EOF
938 $ rt --nodiff
937 $ rt --nodiff
939 !.s.
938 !.s.
940 Skipped test-skip.t: missing feature: nail clipper
939 Skipped test-skip.t: missing feature: nail clipper
941 Failed test-failure.t: output changed
940 Failed test-failure.t: output changed
942 # Ran 3 tests, 1 skipped, 1 failed.
941 # Ran 3 tests, 1 skipped, 1 failed.
943 python hash seed: * (glob)
942 python hash seed: * (glob)
944 [1]
943 [1]
945
944
946 $ rm test-noskip.t
945 $ rm test-noskip.t
947 $ rt --keyword xyzzy
946 $ rt --keyword xyzzy
948 .s
947 .s
949 Skipped test-skip.t: missing feature: nail clipper
948 Skipped test-skip.t: missing feature: nail clipper
950 # Ran 2 tests, 2 skipped, 0 failed.
949 # Ran 2 tests, 2 skipped, 0 failed.
951
950
952 Skips with xml
951 Skips with xml
953 $ rt --keyword xyzzy \
952 $ rt --keyword xyzzy \
954 > --xunit=xunit.xml
953 > --xunit=xunit.xml
955 .s
954 .s
956 Skipped test-skip.t: missing feature: nail clipper
955 Skipped test-skip.t: missing feature: nail clipper
957 # Ran 2 tests, 2 skipped, 0 failed.
956 # Ran 2 tests, 2 skipped, 0 failed.
958 $ cat xunit.xml
957 $ cat xunit.xml
959 <?xml version="1.0" encoding="utf-8"?>
958 <?xml version="1.0" encoding="utf-8"?>
960 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
959 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
961 <testcase name="test-success.t" time="*"/> (glob)
960 <testcase name="test-success.t" time="*"/> (glob)
962 <testcase name="test-skip.t">
961 <testcase name="test-skip.t">
963 <skipped>
962 <skipped>
964 <![CDATA[missing feature: nail clipper]]> </skipped>
963 <![CDATA[missing feature: nail clipper]]> </skipped>
965 </testcase>
964 </testcase>
966 </testsuite>
965 </testsuite>
967
966
968 Missing skips or blacklisted skips don't count as executed:
967 Missing skips or blacklisted skips don't count as executed:
969 $ echo test-failure.t > blacklist
968 $ echo test-failure.t > blacklist
970 $ rt --blacklist=blacklist --json\
969 $ rt --blacklist=blacklist --json\
971 > test-failure.t test-bogus.t
970 > test-failure.t test-bogus.t
972 ss
971 ss
973 Skipped test-bogus.t: Doesn't exist
972 Skipped test-bogus.t: Doesn't exist
974 Skipped test-failure.t: blacklisted
973 Skipped test-failure.t: blacklisted
975 # Ran 0 tests, 2 skipped, 0 failed.
974 # Ran 0 tests, 2 skipped, 0 failed.
976 $ cat report.json
975 $ cat report.json
977 testreport ={
976 testreport ={
978 "test-bogus.t": {
977 "test-bogus.t": {
979 "result": "skip"
978 "result": "skip"
980 },
979 },
981 "test-failure.t": {
980 "test-failure.t": {
982 "result": "skip"
981 "result": "skip"
983 }
982 }
984 } (no-eol)
983 } (no-eol)
985
984
986 Whitelist trumps blacklist
985 Whitelist trumps blacklist
987 $ echo test-failure.t > whitelist
986 $ echo test-failure.t > whitelist
988 $ rt --blacklist=blacklist --whitelist=whitelist --json\
987 $ rt --blacklist=blacklist --whitelist=whitelist --json\
989 > test-failure.t test-bogus.t
988 > test-failure.t test-bogus.t
990 s
989 s
991 --- $TESTTMP/test-failure.t
990 --- $TESTTMP/test-failure.t
992 +++ $TESTTMP/test-failure.t.err
991 +++ $TESTTMP/test-failure.t.err
993 @@ -1,5 +1,5 @@
992 @@ -1,5 +1,5 @@
994 $ echo babar
993 $ echo babar
995 - rataxes
994 - rataxes
996 + babar
995 + babar
997 This is a noop statement so that
996 This is a noop statement so that
998 this test is still more bytes than success.
997 this test is still more bytes than success.
999 pad pad pad pad............................................................
998 pad pad pad pad............................................................
1000
999
1001 ERROR: test-failure.t output changed
1000 ERROR: test-failure.t output changed
1002 !
1001 !
1003 Skipped test-bogus.t: Doesn't exist
1002 Skipped test-bogus.t: Doesn't exist
1004 Failed test-failure.t: output changed
1003 Failed test-failure.t: output changed
1005 # Ran 1 tests, 1 skipped, 1 failed.
1004 # Ran 1 tests, 1 skipped, 1 failed.
1006 python hash seed: * (glob)
1005 python hash seed: * (glob)
1007 [1]
1006 [1]
1008
1007
1009 Ensure that --test-list causes only the tests listed in that file to
1008 Ensure that --test-list causes only the tests listed in that file to
1010 be executed.
1009 be executed.
1011 $ echo test-success.t >> onlytest
1010 $ echo test-success.t >> onlytest
1012 $ rt --test-list=onlytest
1011 $ rt --test-list=onlytest
1013 .
1012 .
1014 # Ran 1 tests, 0 skipped, 0 failed.
1013 # Ran 1 tests, 0 skipped, 0 failed.
1015 $ echo test-bogus.t >> anothertest
1014 $ echo test-bogus.t >> anothertest
1016 $ rt --test-list=onlytest --test-list=anothertest
1015 $ rt --test-list=onlytest --test-list=anothertest
1017 s.
1016 s.
1018 Skipped test-bogus.t: Doesn't exist
1017 Skipped test-bogus.t: Doesn't exist
1019 # Ran 1 tests, 1 skipped, 0 failed.
1018 # Ran 1 tests, 1 skipped, 0 failed.
1020 $ rm onlytest anothertest
1019 $ rm onlytest anothertest
1021
1020
1022 test for --json
1021 test for --json
1023 ==================
1022 ==================
1024
1023
1025 $ rt --json
1024 $ rt --json
1026
1025
1027 --- $TESTTMP/test-failure.t
1026 --- $TESTTMP/test-failure.t
1028 +++ $TESTTMP/test-failure.t.err
1027 +++ $TESTTMP/test-failure.t.err
1029 @@ -1,5 +1,5 @@
1028 @@ -1,5 +1,5 @@
1030 $ echo babar
1029 $ echo babar
1031 - rataxes
1030 - rataxes
1032 + babar
1031 + babar
1033 This is a noop statement so that
1032 This is a noop statement so that
1034 this test is still more bytes than success.
1033 this test is still more bytes than success.
1035 pad pad pad pad............................................................
1034 pad pad pad pad............................................................
1036
1035
1037 ERROR: test-failure.t output changed
1036 ERROR: test-failure.t output changed
1038 !.s
1037 !.s
1039 Skipped test-skip.t: missing feature: nail clipper
1038 Skipped test-skip.t: missing feature: nail clipper
1040 Failed test-failure.t: output changed
1039 Failed test-failure.t: output changed
1041 # Ran 2 tests, 1 skipped, 1 failed.
1040 # Ran 2 tests, 1 skipped, 1 failed.
1042 python hash seed: * (glob)
1041 python hash seed: * (glob)
1043 [1]
1042 [1]
1044
1043
1045 $ cat report.json
1044 $ cat report.json
1046 testreport ={
1045 testreport ={
1047 "test-failure.t": [\{] (re)
1046 "test-failure.t": [\{] (re)
1048 "csys": "\s*[\d\.]{4,5}", ? (re)
1047 "csys": "\s*[\d\.]{4,5}", ? (re)
1049 "cuser": "\s*[\d\.]{4,5}", ? (re)
1048 "cuser": "\s*[\d\.]{4,5}", ? (re)
1050 "diff": "---.+\+\+\+.+", ? (re)
1049 "diff": "---.+\+\+\+.+", ? (re)
1051 "end": "\s*[\d\.]{4,5}", ? (re)
1050 "end": "\s*[\d\.]{4,5}", ? (re)
1052 "result": "failure", ? (re)
1051 "result": "failure", ? (re)
1053 "start": "\s*[\d\.]{4,5}", ? (re)
1052 "start": "\s*[\d\.]{4,5}", ? (re)
1054 "time": "\s*[\d\.]{4,5}" (re)
1053 "time": "\s*[\d\.]{4,5}" (re)
1055 }, ? (re)
1054 }, ? (re)
1056 "test-skip.t": {
1055 "test-skip.t": {
1057 "csys": "\s*[\d\.]{4,5}", ? (re)
1056 "csys": "\s*[\d\.]{4,5}", ? (re)
1058 "cuser": "\s*[\d\.]{4,5}", ? (re)
1057 "cuser": "\s*[\d\.]{4,5}", ? (re)
1059 "diff": "", ? (re)
1058 "diff": "", ? (re)
1060 "end": "\s*[\d\.]{4,5}", ? (re)
1059 "end": "\s*[\d\.]{4,5}", ? (re)
1061 "result": "skip", ? (re)
1060 "result": "skip", ? (re)
1062 "start": "\s*[\d\.]{4,5}", ? (re)
1061 "start": "\s*[\d\.]{4,5}", ? (re)
1063 "time": "\s*[\d\.]{4,5}" (re)
1062 "time": "\s*[\d\.]{4,5}" (re)
1064 }, ? (re)
1063 }, ? (re)
1065 "test-success.t": [\{] (re)
1064 "test-success.t": [\{] (re)
1066 "csys": "\s*[\d\.]{4,5}", ? (re)
1065 "csys": "\s*[\d\.]{4,5}", ? (re)
1067 "cuser": "\s*[\d\.]{4,5}", ? (re)
1066 "cuser": "\s*[\d\.]{4,5}", ? (re)
1068 "diff": "", ? (re)
1067 "diff": "", ? (re)
1069 "end": "\s*[\d\.]{4,5}", ? (re)
1068 "end": "\s*[\d\.]{4,5}", ? (re)
1070 "result": "success", ? (re)
1069 "result": "success", ? (re)
1071 "start": "\s*[\d\.]{4,5}", ? (re)
1070 "start": "\s*[\d\.]{4,5}", ? (re)
1072 "time": "\s*[\d\.]{4,5}" (re)
1071 "time": "\s*[\d\.]{4,5}" (re)
1073 }
1072 }
1074 } (no-eol)
1073 } (no-eol)
1075 --json with --outputdir
1074 --json with --outputdir
1076
1075
1077 $ rm report.json
1076 $ rm report.json
1078 $ rm -r output
1077 $ rm -r output
1079 $ mkdir output
1078 $ mkdir output
1080 $ rt --json --outputdir output
1079 $ rt --json --outputdir output
1081
1080
1082 --- $TESTTMP/test-failure.t
1081 --- $TESTTMP/test-failure.t
1083 +++ $TESTTMP/output/test-failure.t.err
1082 +++ $TESTTMP/output/test-failure.t.err
1084 @@ -1,5 +1,5 @@
1083 @@ -1,5 +1,5 @@
1085 $ echo babar
1084 $ echo babar
1086 - rataxes
1085 - rataxes
1087 + babar
1086 + babar
1088 This is a noop statement so that
1087 This is a noop statement so that
1089 this test is still more bytes than success.
1088 this test is still more bytes than success.
1090 pad pad pad pad............................................................
1089 pad pad pad pad............................................................
1091
1090
1092 ERROR: test-failure.t output changed
1091 ERROR: test-failure.t output changed
1093 !.s
1092 !.s
1094 Skipped test-skip.t: missing feature: nail clipper
1093 Skipped test-skip.t: missing feature: nail clipper
1095 Failed test-failure.t: output changed
1094 Failed test-failure.t: output changed
1096 # Ran 2 tests, 1 skipped, 1 failed.
1095 # Ran 2 tests, 1 skipped, 1 failed.
1097 python hash seed: * (glob)
1096 python hash seed: * (glob)
1098 [1]
1097 [1]
1099 $ f report.json
1098 $ f report.json
1100 report.json: file not found
1099 report.json: file not found
1101 $ cat output/report.json
1100 $ cat output/report.json
1102 testreport ={
1101 testreport ={
1103 "test-failure.t": [\{] (re)
1102 "test-failure.t": [\{] (re)
1104 "csys": "\s*[\d\.]{4,5}", ? (re)
1103 "csys": "\s*[\d\.]{4,5}", ? (re)
1105 "cuser": "\s*[\d\.]{4,5}", ? (re)
1104 "cuser": "\s*[\d\.]{4,5}", ? (re)
1106 "diff": "---.+\+\+\+.+", ? (re)
1105 "diff": "---.+\+\+\+.+", ? (re)
1107 "end": "\s*[\d\.]{4,5}", ? (re)
1106 "end": "\s*[\d\.]{4,5}", ? (re)
1108 "result": "failure", ? (re)
1107 "result": "failure", ? (re)
1109 "start": "\s*[\d\.]{4,5}", ? (re)
1108 "start": "\s*[\d\.]{4,5}", ? (re)
1110 "time": "\s*[\d\.]{4,5}" (re)
1109 "time": "\s*[\d\.]{4,5}" (re)
1111 }, ? (re)
1110 }, ? (re)
1112 "test-skip.t": {
1111 "test-skip.t": {
1113 "csys": "\s*[\d\.]{4,5}", ? (re)
1112 "csys": "\s*[\d\.]{4,5}", ? (re)
1114 "cuser": "\s*[\d\.]{4,5}", ? (re)
1113 "cuser": "\s*[\d\.]{4,5}", ? (re)
1115 "diff": "", ? (re)
1114 "diff": "", ? (re)
1116 "end": "\s*[\d\.]{4,5}", ? (re)
1115 "end": "\s*[\d\.]{4,5}", ? (re)
1117 "result": "skip", ? (re)
1116 "result": "skip", ? (re)
1118 "start": "\s*[\d\.]{4,5}", ? (re)
1117 "start": "\s*[\d\.]{4,5}", ? (re)
1119 "time": "\s*[\d\.]{4,5}" (re)
1118 "time": "\s*[\d\.]{4,5}" (re)
1120 }, ? (re)
1119 }, ? (re)
1121 "test-success.t": [\{] (re)
1120 "test-success.t": [\{] (re)
1122 "csys": "\s*[\d\.]{4,5}", ? (re)
1121 "csys": "\s*[\d\.]{4,5}", ? (re)
1123 "cuser": "\s*[\d\.]{4,5}", ? (re)
1122 "cuser": "\s*[\d\.]{4,5}", ? (re)
1124 "diff": "", ? (re)
1123 "diff": "", ? (re)
1125 "end": "\s*[\d\.]{4,5}", ? (re)
1124 "end": "\s*[\d\.]{4,5}", ? (re)
1126 "result": "success", ? (re)
1125 "result": "success", ? (re)
1127 "start": "\s*[\d\.]{4,5}", ? (re)
1126 "start": "\s*[\d\.]{4,5}", ? (re)
1128 "time": "\s*[\d\.]{4,5}" (re)
1127 "time": "\s*[\d\.]{4,5}" (re)
1129 }
1128 }
1130 } (no-eol)
1129 } (no-eol)
1131 $ ls -a output
1130 $ ls -a output
1132 .
1131 .
1133 ..
1132 ..
1134 .testtimes
1133 .testtimes
1135 report.json
1134 report.json
1136 test-failure.t.err
1135 test-failure.t.err
1137
1136
1138 Test that failed test accepted through interactive are properly reported:
1137 Test that failed test accepted through interactive are properly reported:
1139
1138
1140 $ cp test-failure.t backup
1139 $ cp test-failure.t backup
1141 $ echo y | rt --json -i
1140 $ echo y | rt --json -i
1142
1141
1143 --- $TESTTMP/test-failure.t
1142 --- $TESTTMP/test-failure.t
1144 +++ $TESTTMP/test-failure.t.err
1143 +++ $TESTTMP/test-failure.t.err
1145 @@ -1,5 +1,5 @@
1144 @@ -1,5 +1,5 @@
1146 $ echo babar
1145 $ echo babar
1147 - rataxes
1146 - rataxes
1148 + babar
1147 + babar
1149 This is a noop statement so that
1148 This is a noop statement so that
1150 this test is still more bytes than success.
1149 this test is still more bytes than success.
1151 pad pad pad pad............................................................
1150 pad pad pad pad............................................................
1152 Accept this change? [n] ..s
1151 Accept this change? [n] ..s
1153 Skipped test-skip.t: missing feature: nail clipper
1152 Skipped test-skip.t: missing feature: nail clipper
1154 # Ran 2 tests, 1 skipped, 0 failed.
1153 # Ran 2 tests, 1 skipped, 0 failed.
1155
1154
1156 $ cat report.json
1155 $ cat report.json
1157 testreport ={
1156 testreport ={
1158 "test-failure.t": [\{] (re)
1157 "test-failure.t": [\{] (re)
1159 "csys": "\s*[\d\.]{4,5}", ? (re)
1158 "csys": "\s*[\d\.]{4,5}", ? (re)
1160 "cuser": "\s*[\d\.]{4,5}", ? (re)
1159 "cuser": "\s*[\d\.]{4,5}", ? (re)
1161 "diff": "", ? (re)
1160 "diff": "", ? (re)
1162 "end": "\s*[\d\.]{4,5}", ? (re)
1161 "end": "\s*[\d\.]{4,5}", ? (re)
1163 "result": "success", ? (re)
1162 "result": "success", ? (re)
1164 "start": "\s*[\d\.]{4,5}", ? (re)
1163 "start": "\s*[\d\.]{4,5}", ? (re)
1165 "time": "\s*[\d\.]{4,5}" (re)
1164 "time": "\s*[\d\.]{4,5}" (re)
1166 }, ? (re)
1165 }, ? (re)
1167 "test-skip.t": {
1166 "test-skip.t": {
1168 "csys": "\s*[\d\.]{4,5}", ? (re)
1167 "csys": "\s*[\d\.]{4,5}", ? (re)
1169 "cuser": "\s*[\d\.]{4,5}", ? (re)
1168 "cuser": "\s*[\d\.]{4,5}", ? (re)
1170 "diff": "", ? (re)
1169 "diff": "", ? (re)
1171 "end": "\s*[\d\.]{4,5}", ? (re)
1170 "end": "\s*[\d\.]{4,5}", ? (re)
1172 "result": "skip", ? (re)
1171 "result": "skip", ? (re)
1173 "start": "\s*[\d\.]{4,5}", ? (re)
1172 "start": "\s*[\d\.]{4,5}", ? (re)
1174 "time": "\s*[\d\.]{4,5}" (re)
1173 "time": "\s*[\d\.]{4,5}" (re)
1175 }, ? (re)
1174 }, ? (re)
1176 "test-success.t": [\{] (re)
1175 "test-success.t": [\{] (re)
1177 "csys": "\s*[\d\.]{4,5}", ? (re)
1176 "csys": "\s*[\d\.]{4,5}", ? (re)
1178 "cuser": "\s*[\d\.]{4,5}", ? (re)
1177 "cuser": "\s*[\d\.]{4,5}", ? (re)
1179 "diff": "", ? (re)
1178 "diff": "", ? (re)
1180 "end": "\s*[\d\.]{4,5}", ? (re)
1179 "end": "\s*[\d\.]{4,5}", ? (re)
1181 "result": "success", ? (re)
1180 "result": "success", ? (re)
1182 "start": "\s*[\d\.]{4,5}", ? (re)
1181 "start": "\s*[\d\.]{4,5}", ? (re)
1183 "time": "\s*[\d\.]{4,5}" (re)
1182 "time": "\s*[\d\.]{4,5}" (re)
1184 }
1183 }
1185 } (no-eol)
1184 } (no-eol)
1186 $ mv backup test-failure.t
1185 $ mv backup test-failure.t
1187
1186
1188 backslash on end of line with glob matching is handled properly
1187 backslash on end of line with glob matching is handled properly
1189
1188
1190 $ cat > test-glob-backslash.t << EOF
1189 $ cat > test-glob-backslash.t << EOF
1191 > $ echo 'foo bar \\'
1190 > $ echo 'foo bar \\'
1192 > foo * \ (glob)
1191 > foo * \ (glob)
1193 > EOF
1192 > EOF
1194
1193
1195 $ rt test-glob-backslash.t
1194 $ rt test-glob-backslash.t
1196 .
1195 .
1197 # Ran 1 tests, 0 skipped, 0 failed.
1196 # Ran 1 tests, 0 skipped, 0 failed.
1198
1197
1199 $ rm -f test-glob-backslash.t
1198 $ rm -f test-glob-backslash.t
1200
1199
1201 Test globbing of local IP addresses
1200 Test globbing of local IP addresses
1202 $ echo 172.16.18.1
1201 $ echo 172.16.18.1
1203 $LOCALIP (glob)
1202 $LOCALIP (glob)
1204 $ echo dead:beef::1
1203 $ echo dead:beef::1
1205 $LOCALIP (glob)
1204 $LOCALIP (glob)
1206
1205
1207 Test reusability for third party tools
1206 Test reusability for third party tools
1208 ======================================
1207 ======================================
1209
1208
1210 $ mkdir "$TESTTMP"/anothertests
1209 $ mkdir "$TESTTMP"/anothertests
1211 $ cd "$TESTTMP"/anothertests
1210 $ cd "$TESTTMP"/anothertests
1212
1211
1213 test that `run-tests.py` can execute hghave, even if it runs not in
1212 test that `run-tests.py` can execute hghave, even if it runs not in
1214 Mercurial source tree.
1213 Mercurial source tree.
1215
1214
1216 $ cat > test-hghave.t <<EOF
1215 $ cat > test-hghave.t <<EOF
1217 > #require true
1216 > #require true
1218 > $ echo foo
1217 > $ echo foo
1219 > foo
1218 > foo
1220 > EOF
1219 > EOF
1221 $ rt test-hghave.t
1220 $ rt test-hghave.t
1222 .
1221 .
1223 # Ran 1 tests, 0 skipped, 0 failed.
1222 # Ran 1 tests, 0 skipped, 0 failed.
1224
1223
1225 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1224 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1226 running is placed.
1225 running is placed.
1227
1226
1228 $ cat > test-runtestdir.t <<EOF
1227 $ cat > test-runtestdir.t <<EOF
1229 > - $TESTDIR, in which test-run-tests.t is placed
1228 > - $TESTDIR, in which test-run-tests.t is placed
1230 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1229 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1231 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1230 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1232 >
1231 >
1233 > #if windows
1232 > #if windows
1234 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
1233 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
1235 > #else
1234 > #else
1236 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
1235 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
1237 > #endif
1236 > #endif
1238 > If this prints a path, that means RUNTESTDIR didn't equal
1237 > If this prints a path, that means RUNTESTDIR didn't equal
1239 > TESTDIR as it should have.
1238 > TESTDIR as it should have.
1240 > $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR"
1239 > $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR"
1241 > This should print the start of check-code. If this passes but the
1240 > This should print the start of check-code. If this passes but the
1242 > previous check failed, that means we found a copy of check-code at whatever
1241 > previous check failed, that means we found a copy of check-code at whatever
1243 > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR.
1242 > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR.
1244 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
1243 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
1245 > #!USRBINENVPY
1244 > #!USRBINENVPY
1246 > #
1245 > #
1247 > # check-code - a style and portability checker for Mercurial
1246 > # check-code - a style and portability checker for Mercurial
1248 > EOF
1247 > EOF
1249 $ rt test-runtestdir.t
1248 $ rt test-runtestdir.t
1250 .
1249 .
1251 # Ran 1 tests, 0 skipped, 0 failed.
1250 # Ran 1 tests, 0 skipped, 0 failed.
1252
1251
1253 #if execbit
1252 #if execbit
1254
1253
1255 test that TESTDIR is referred in PATH
1254 test that TESTDIR is referred in PATH
1256
1255
1257 $ cat > custom-command.sh <<EOF
1256 $ cat > custom-command.sh <<EOF
1258 > #!/bin/sh
1257 > #!/bin/sh
1259 > echo "hello world"
1258 > echo "hello world"
1260 > EOF
1259 > EOF
1261 $ chmod +x custom-command.sh
1260 $ chmod +x custom-command.sh
1262 $ cat > test-testdir-path.t <<EOF
1261 $ cat > test-testdir-path.t <<EOF
1263 > $ custom-command.sh
1262 > $ custom-command.sh
1264 > hello world
1263 > hello world
1265 > EOF
1264 > EOF
1266 $ rt test-testdir-path.t
1265 $ rt test-testdir-path.t
1267 .
1266 .
1268 # Ran 1 tests, 0 skipped, 0 failed.
1267 # Ran 1 tests, 0 skipped, 0 failed.
1269
1268
1270 #endif
1269 #endif
1271
1270
1272 test support for --allow-slow-tests
1271 test support for --allow-slow-tests
1273 $ cat > test-very-slow-test.t <<EOF
1272 $ cat > test-very-slow-test.t <<EOF
1274 > #require slow
1273 > #require slow
1275 > $ echo pass
1274 > $ echo pass
1276 > pass
1275 > pass
1277 > EOF
1276 > EOF
1278 $ rt test-very-slow-test.t
1277 $ rt test-very-slow-test.t
1279 s
1278 s
1280 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1279 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1281 # Ran 0 tests, 1 skipped, 0 failed.
1280 # Ran 0 tests, 1 skipped, 0 failed.
1282 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1281 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1283 .
1282 .
1284 # Ran 1 tests, 0 skipped, 0 failed.
1283 # Ran 1 tests, 0 skipped, 0 failed.
1285
1284
1286 support for running a test outside the current directory
1285 support for running a test outside the current directory
1287 $ mkdir nonlocal
1286 $ mkdir nonlocal
1288 $ cat > nonlocal/test-is-not-here.t << EOF
1287 $ cat > nonlocal/test-is-not-here.t << EOF
1289 > $ echo pass
1288 > $ echo pass
1290 > pass
1289 > pass
1291 > EOF
1290 > EOF
1292 $ rt nonlocal/test-is-not-here.t
1291 $ rt nonlocal/test-is-not-here.t
1293 .
1292 .
1294 # Ran 1 tests, 0 skipped, 0 failed.
1293 # Ran 1 tests, 0 skipped, 0 failed.
1295
1294
1296 support for automatically discovering test if arg is a folder
1295 support for automatically discovering test if arg is a folder
1297 $ mkdir tmp && cd tmp
1296 $ mkdir tmp && cd tmp
1298
1297
1299 $ cat > test-uno.t << EOF
1298 $ cat > test-uno.t << EOF
1300 > $ echo line
1299 > $ echo line
1301 > line
1300 > line
1302 > EOF
1301 > EOF
1303
1302
1304 $ cp test-uno.t test-dos.t
1303 $ cp test-uno.t test-dos.t
1305 $ cd ..
1304 $ cd ..
1306 $ cp -R tmp tmpp
1305 $ cp -R tmp tmpp
1307 $ cp tmp/test-uno.t test-solo.t
1306 $ cp tmp/test-uno.t test-solo.t
1308
1307
1309 $ rt tmp/ test-solo.t tmpp
1308 $ rt tmp/ test-solo.t tmpp
1310 .....
1309 .....
1311 # Ran 5 tests, 0 skipped, 0 failed.
1310 # Ran 5 tests, 0 skipped, 0 failed.
1312 $ rm -rf tmp tmpp
1311 $ rm -rf tmp tmpp
1313
1312
1314 support for running run-tests.py from another directory
1313 support for running run-tests.py from another directory
1315 $ mkdir tmp && cd tmp
1314 $ mkdir tmp && cd tmp
1316
1315
1317 $ cat > useful-file.sh << EOF
1316 $ cat > useful-file.sh << EOF
1318 > important command
1317 > important command
1319 > EOF
1318 > EOF
1320
1319
1321 $ cat > test-folder.t << EOF
1320 $ cat > test-folder.t << EOF
1322 > $ cat \$TESTDIR/useful-file.sh
1321 > $ cat \$TESTDIR/useful-file.sh
1323 > important command
1322 > important command
1324 > EOF
1323 > EOF
1325
1324
1326 $ cat > test-folder-fail.t << EOF
1325 $ cat > test-folder-fail.t << EOF
1327 > $ cat \$TESTDIR/useful-file.sh
1326 > $ cat \$TESTDIR/useful-file.sh
1328 > important commando
1327 > important commando
1329 > EOF
1328 > EOF
1330
1329
1331 $ cd ..
1330 $ cd ..
1332 $ rt tmp/test-*.t
1331 $ rt tmp/test-*.t
1333
1332
1334 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1333 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1335 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1334 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1336 @@ -1,2 +1,2 @@
1335 @@ -1,2 +1,2 @@
1337 $ cat $TESTDIR/useful-file.sh
1336 $ cat $TESTDIR/useful-file.sh
1338 - important commando
1337 - important commando
1339 + important command
1338 + important command
1340
1339
1341 ERROR: test-folder-fail.t output changed
1340 ERROR: test-folder-fail.t output changed
1342 !.
1341 !.
1343 Failed test-folder-fail.t: output changed
1342 Failed test-folder-fail.t: output changed
1344 # Ran 2 tests, 0 skipped, 1 failed.
1343 # Ran 2 tests, 0 skipped, 1 failed.
1345 python hash seed: * (glob)
1344 python hash seed: * (glob)
1346 [1]
1345 [1]
1347
1346
1348 support for bisecting failed tests automatically
1347 support for bisecting failed tests automatically
1349 $ hg init bisect
1348 $ hg init bisect
1350 $ cd bisect
1349 $ cd bisect
1351 $ cat >> test-bisect.t <<EOF
1350 $ cat >> test-bisect.t <<EOF
1352 > $ echo pass
1351 > $ echo pass
1353 > pass
1352 > pass
1354 > EOF
1353 > EOF
1355 $ hg add test-bisect.t
1354 $ hg add test-bisect.t
1356 $ hg ci -m 'good'
1355 $ hg ci -m 'good'
1357 $ cat >> test-bisect.t <<EOF
1356 $ cat >> test-bisect.t <<EOF
1358 > $ echo pass
1357 > $ echo pass
1359 > fail
1358 > fail
1360 > EOF
1359 > EOF
1361 $ hg ci -m 'bad'
1360 $ hg ci -m 'bad'
1362 $ rt --known-good-rev=0 test-bisect.t
1361 $ rt --known-good-rev=0 test-bisect.t
1363
1362
1364 --- $TESTTMP/anothertests/bisect/test-bisect.t
1363 --- $TESTTMP/anothertests/bisect/test-bisect.t
1365 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1364 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1366 @@ -1,4 +1,4 @@
1365 @@ -1,4 +1,4 @@
1367 $ echo pass
1366 $ echo pass
1368 pass
1367 pass
1369 $ echo pass
1368 $ echo pass
1370 - fail
1369 - fail
1371 + pass
1370 + pass
1372
1371
1373 ERROR: test-bisect.t output changed
1372 ERROR: test-bisect.t output changed
1374 !
1373 !
1375 Failed test-bisect.t: output changed
1374 Failed test-bisect.t: output changed
1376 test-bisect.t broken by 72cbf122d116 (bad)
1375 test-bisect.t broken by 72cbf122d116 (bad)
1377 # Ran 1 tests, 0 skipped, 1 failed.
1376 # Ran 1 tests, 0 skipped, 1 failed.
1378 python hash seed: * (glob)
1377 python hash seed: * (glob)
1379 [1]
1378 [1]
1380
1379
1381 $ cd ..
1380 $ cd ..
1382
1381
1383 support bisecting a separate repo
1382 support bisecting a separate repo
1384
1383
1385 $ hg init bisect-dependent
1384 $ hg init bisect-dependent
1386 $ cd bisect-dependent
1385 $ cd bisect-dependent
1387 $ cat > test-bisect-dependent.t <<EOF
1386 $ cat > test-bisect-dependent.t <<EOF
1388 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1387 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1389 > pass
1388 > pass
1390 > EOF
1389 > EOF
1391 $ hg commit -Am dependent test-bisect-dependent.t
1390 $ hg commit -Am dependent test-bisect-dependent.t
1392
1391
1393 $ rt --known-good-rev=0 test-bisect-dependent.t
1392 $ rt --known-good-rev=0 test-bisect-dependent.t
1394
1393
1395 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1394 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1396 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1395 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1397 @@ -1,2 +1,2 @@
1396 @@ -1,2 +1,2 @@
1398 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1397 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1399 - pass
1398 - pass
1400 + fail
1399 + fail
1401
1400
1402 ERROR: test-bisect-dependent.t output changed
1401 ERROR: test-bisect-dependent.t output changed
1403 !
1402 !
1404 Failed test-bisect-dependent.t: output changed
1403 Failed test-bisect-dependent.t: output changed
1405 Failed to identify failure point for test-bisect-dependent.t
1404 Failed to identify failure point for test-bisect-dependent.t
1406 # Ran 1 tests, 0 skipped, 1 failed.
1405 # Ran 1 tests, 0 skipped, 1 failed.
1407 python hash seed: * (glob)
1406 python hash seed: * (glob)
1408 [1]
1407 [1]
1409
1408
1410 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1409 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1411 usage: run-tests.py [options] [tests]
1410 usage: run-tests.py [options] [tests]
1412 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1411 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1413 [2]
1412 [2]
1414
1413
1415 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1414 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1416
1415
1417 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1416 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1418 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1417 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1419 @@ -1,2 +1,2 @@
1418 @@ -1,2 +1,2 @@
1420 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1419 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1421 - pass
1420 - pass
1422 + fail
1421 + fail
1423
1422
1424 ERROR: test-bisect-dependent.t output changed
1423 ERROR: test-bisect-dependent.t output changed
1425 !
1424 !
1426 Failed test-bisect-dependent.t: output changed
1425 Failed test-bisect-dependent.t: output changed
1427 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1426 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1428 # Ran 1 tests, 0 skipped, 1 failed.
1427 # Ran 1 tests, 0 skipped, 1 failed.
1429 python hash seed: * (glob)
1428 python hash seed: * (glob)
1430 [1]
1429 [1]
1431
1430
1432 $ cd ..
1431 $ cd ..
1433
1432
1434 Test a broken #if statement doesn't break run-tests threading.
1433 Test a broken #if statement doesn't break run-tests threading.
1435 ==============================================================
1434 ==============================================================
1436 $ mkdir broken
1435 $ mkdir broken
1437 $ cd broken
1436 $ cd broken
1438 $ cat > test-broken.t <<EOF
1437 $ cat > test-broken.t <<EOF
1439 > true
1438 > true
1440 > #if notarealhghavefeature
1439 > #if notarealhghavefeature
1441 > $ false
1440 > $ false
1442 > #endif
1441 > #endif
1443 > EOF
1442 > EOF
1444 $ for f in 1 2 3 4 ; do
1443 $ for f in 1 2 3 4 ; do
1445 > cat > test-works-$f.t <<EOF
1444 > cat > test-works-$f.t <<EOF
1446 > This is test case $f
1445 > This is test case $f
1447 > $ sleep 1
1446 > $ sleep 1
1448 > EOF
1447 > EOF
1449 > done
1448 > done
1450 $ rt -j 2
1449 $ rt -j 2
1451 ....
1450 ....
1452 # Ran 5 tests, 0 skipped, 0 failed.
1451 # Ran 5 tests, 0 skipped, 0 failed.
1453 skipped: unknown feature: notarealhghavefeature
1452 skipped: unknown feature: notarealhghavefeature
1454
1453
1455 $ cd ..
1454 $ cd ..
1456 $ rm -rf broken
1455 $ rm -rf broken
1457
1456
1458 Test cases in .t files
1457 Test cases in .t files
1459 ======================
1458 ======================
1460 $ mkdir cases
1459 $ mkdir cases
1461 $ cd cases
1460 $ cd cases
1462 $ cat > test-cases-abc.t <<'EOF'
1461 $ cat > test-cases-abc.t <<'EOF'
1463 > #testcases A B C
1462 > #testcases A B C
1464 > $ V=B
1463 > $ V=B
1465 > #if A
1464 > #if A
1466 > $ V=A
1465 > $ V=A
1467 > #endif
1466 > #endif
1468 > #if C
1467 > #if C
1469 > $ V=C
1468 > $ V=C
1470 > #endif
1469 > #endif
1471 > $ echo $V | sed 's/A/C/'
1470 > $ echo $V | sed 's/A/C/'
1472 > C
1471 > C
1473 > #if C
1472 > #if C
1474 > $ [ $V = C ]
1473 > $ [ $V = C ]
1475 > #endif
1474 > #endif
1476 > #if A
1475 > #if A
1477 > $ [ $V = C ]
1476 > $ [ $V = C ]
1478 > [1]
1477 > [1]
1479 > #endif
1478 > #endif
1480 > #if no-C
1479 > #if no-C
1481 > $ [ $V = C ]
1480 > $ [ $V = C ]
1482 > [1]
1481 > [1]
1483 > #endif
1482 > #endif
1484 > $ [ $V = D ]
1483 > $ [ $V = D ]
1485 > [1]
1484 > [1]
1486 > EOF
1485 > EOF
1487 $ rt
1486 $ rt
1488 .
1487 .
1489 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1488 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1490 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1489 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1491 @@ -7,7 +7,7 @@
1490 @@ -7,7 +7,7 @@
1492 $ V=C
1491 $ V=C
1493 #endif
1492 #endif
1494 $ echo $V | sed 's/A/C/'
1493 $ echo $V | sed 's/A/C/'
1495 - C
1494 - C
1496 + B
1495 + B
1497 #if C
1496 #if C
1498 $ [ $V = C ]
1497 $ [ $V = C ]
1499 #endif
1498 #endif
1500
1499
1501 ERROR: test-cases-abc.t (case B) output changed
1500 ERROR: test-cases-abc.t (case B) output changed
1502 !.
1501 !.
1503 Failed test-cases-abc.t (case B): output changed
1502 Failed test-cases-abc.t (case B): output changed
1504 # Ran 3 tests, 0 skipped, 1 failed.
1503 # Ran 3 tests, 0 skipped, 1 failed.
1505 python hash seed: * (glob)
1504 python hash seed: * (glob)
1506 [1]
1505 [1]
1507
1506
1508 --restart works
1507 --restart works
1509
1508
1510 $ rt --restart
1509 $ rt --restart
1511
1510
1512 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1511 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1513 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1512 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1514 @@ -7,7 +7,7 @@
1513 @@ -7,7 +7,7 @@
1515 $ V=C
1514 $ V=C
1516 #endif
1515 #endif
1517 $ echo $V | sed 's/A/C/'
1516 $ echo $V | sed 's/A/C/'
1518 - C
1517 - C
1519 + B
1518 + B
1520 #if C
1519 #if C
1521 $ [ $V = C ]
1520 $ [ $V = C ]
1522 #endif
1521 #endif
1523
1522
1524 ERROR: test-cases-abc.t (case B) output changed
1523 ERROR: test-cases-abc.t (case B) output changed
1525 !.
1524 !.
1526 Failed test-cases-abc.t (case B): output changed
1525 Failed test-cases-abc.t (case B): output changed
1527 # Ran 2 tests, 0 skipped, 1 failed.
1526 # Ran 2 tests, 0 skipped, 1 failed.
1528 python hash seed: * (glob)
1527 python hash seed: * (glob)
1529 [1]
1528 [1]
1530
1529
1531 --restart works with outputdir
1530 --restart works with outputdir
1532
1531
1533 $ mkdir output
1532 $ mkdir output
1534 $ mv test-cases-abc.t.B.err output
1533 $ mv test-cases-abc.t.B.err output
1535 $ rt --restart --outputdir output
1534 $ rt --restart --outputdir output
1536
1535
1537 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1536 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1538 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
1537 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
1539 @@ -7,7 +7,7 @@
1538 @@ -7,7 +7,7 @@
1540 $ V=C
1539 $ V=C
1541 #endif
1540 #endif
1542 $ echo $V | sed 's/A/C/'
1541 $ echo $V | sed 's/A/C/'
1543 - C
1542 - C
1544 + B
1543 + B
1545 #if C
1544 #if C
1546 $ [ $V = C ]
1545 $ [ $V = C ]
1547 #endif
1546 #endif
1548
1547
1549 ERROR: test-cases-abc.t (case B) output changed
1548 ERROR: test-cases-abc.t (case B) output changed
1550 !.
1549 !.
1551 Failed test-cases-abc.t (case B): output changed
1550 Failed test-cases-abc.t (case B): output changed
1552 # Ran 2 tests, 0 skipped, 1 failed.
1551 # Ran 2 tests, 0 skipped, 1 failed.
1553 python hash seed: * (glob)
1552 python hash seed: * (glob)
1554 [1]
1553 [1]
1555
1554
1556 Test TESTCASE variable
1555 Test TESTCASE variable
1557
1556
1558 $ cat > test-cases-ab.t <<'EOF'
1557 $ cat > test-cases-ab.t <<'EOF'
1559 > $ dostuff() {
1558 > $ dostuff() {
1560 > > echo "In case $TESTCASE"
1559 > > echo "In case $TESTCASE"
1561 > > }
1560 > > }
1562 > #testcases A B
1561 > #testcases A B
1563 > #if A
1562 > #if A
1564 > $ dostuff
1563 > $ dostuff
1565 > In case A
1564 > In case A
1566 > #endif
1565 > #endif
1567 > #if B
1566 > #if B
1568 > $ dostuff
1567 > $ dostuff
1569 > In case B
1568 > In case B
1570 > #endif
1569 > #endif
1571 > EOF
1570 > EOF
1572 $ rt test-cases-ab.t
1571 $ rt test-cases-ab.t
1573 ..
1572 ..
1574 # Ran 2 tests, 0 skipped, 0 failed.
1573 # Ran 2 tests, 0 skipped, 0 failed.
1575
1574
1576 Test automatic pattern replacement
1575 Test automatic pattern replacement
1577
1576
1578 $ cat << EOF >> common-pattern.py
1577 $ cat << EOF >> common-pattern.py
1579 > substitutions = [
1578 > substitutions = [
1580 > (br'foo-(.*)\\b',
1579 > (br'foo-(.*)\\b',
1581 > br'\$XXX=\\1\$'),
1580 > br'\$XXX=\\1\$'),
1582 > (br'bar\\n',
1581 > (br'bar\\n',
1583 > br'\$YYY$\\n'),
1582 > br'\$YYY$\\n'),
1584 > ]
1583 > ]
1585 > EOF
1584 > EOF
1586
1585
1587 $ cat << EOF >> test-substitution.t
1586 $ cat << EOF >> test-substitution.t
1588 > $ echo foo-12
1587 > $ echo foo-12
1589 > \$XXX=12$
1588 > \$XXX=12$
1590 > $ echo foo-42
1589 > $ echo foo-42
1591 > \$XXX=42$
1590 > \$XXX=42$
1592 > $ echo bar prior
1591 > $ echo bar prior
1593 > bar prior
1592 > bar prior
1594 > $ echo lastbar
1593 > $ echo lastbar
1595 > last\$YYY$
1594 > last\$YYY$
1596 > $ echo foo-bar foo-baz
1595 > $ echo foo-bar foo-baz
1597 > EOF
1596 > EOF
1598
1597
1599 $ rt test-substitution.t
1598 $ rt test-substitution.t
1600
1599
1601 --- $TESTTMP/anothertests/cases/test-substitution.t
1600 --- $TESTTMP/anothertests/cases/test-substitution.t
1602 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1601 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1603 @@ -7,3 +7,4 @@
1602 @@ -7,3 +7,4 @@
1604 $ echo lastbar
1603 $ echo lastbar
1605 last$YYY$
1604 last$YYY$
1606 $ echo foo-bar foo-baz
1605 $ echo foo-bar foo-baz
1607 + $XXX=bar foo-baz$
1606 + $XXX=bar foo-baz$
1608
1607
1609 ERROR: test-substitution.t output changed
1608 ERROR: test-substitution.t output changed
1610 !
1609 !
1611 Failed test-substitution.t: output changed
1610 Failed test-substitution.t: output changed
1612 # Ran 1 tests, 0 skipped, 1 failed.
1611 # Ran 1 tests, 0 skipped, 1 failed.
1613 python hash seed: * (glob)
1612 python hash seed: * (glob)
1614 [1]
1613 [1]
1615
1614
1616 --extra-config-opt works
1615 --extra-config-opt works
1617
1616
1618 $ cat << EOF >> test-config-opt.t
1617 $ cat << EOF >> test-config-opt.t
1619 > $ hg init test-config-opt
1618 > $ hg init test-config-opt
1620 > $ hg -R test-config-opt purge
1619 > $ hg -R test-config-opt purge
1621 > EOF
1620 > EOF
1622
1621
1623 $ rt --extra-config-opt extensions.purge= test-config-opt.t
1622 $ rt --extra-config-opt extensions.purge= test-config-opt.t
1624 .
1623 .
1625 # Ran 1 tests, 0 skipped, 0 failed.
1624 # Ran 1 tests, 0 skipped, 0 failed.
General Comments 0
You need to be logged in to leave comments. Login now