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