##// END OF EJS Templates
tests: add some commentary and diagnostics to test-run-tests.t...
Augie Fackler -
r35388:c0c6df81 default
parent child Browse files
Show More
@@ -1,1579 +1,1584
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-failure-unicode.t * (glob)
377 test-failure-unicode.t * (glob)
378 test-failure.t * (glob)
378 test-failure.t * (glob)
379 test-success.t * (glob)
379 test-success.t * (glob)
380
380
381 $ rt --list-tests
381 $ rt --list-tests
382 test-failure-unicode.t
382 test-failure-unicode.t
383 test-failure.t
383 test-failure.t
384 test-success.t
384 test-success.t
385
385
386 $ rt --list-tests --json
386 $ rt --list-tests --json
387 test-failure-unicode.t
387 test-failure-unicode.t
388 test-failure.t
388 test-failure.t
389 test-success.t
389 test-success.t
390 $ cat report.json
390 $ cat report.json
391 testreport ={
391 testreport ={
392 "test-failure-unicode.t": {
392 "test-failure-unicode.t": {
393 "result": "success"
393 "result": "success"
394 },
394 },
395 "test-failure.t": {
395 "test-failure.t": {
396 "result": "success"
396 "result": "success"
397 },
397 },
398 "test-success.t": {
398 "test-success.t": {
399 "result": "success"
399 "result": "success"
400 }
400 }
401 } (no-eol)
401 } (no-eol)
402
402
403 $ rt --list-tests --xunit=xunit.xml
403 $ rt --list-tests --xunit=xunit.xml
404 test-failure-unicode.t
404 test-failure-unicode.t
405 test-failure.t
405 test-failure.t
406 test-success.t
406 test-success.t
407 $ cat xunit.xml
407 $ cat xunit.xml
408 <?xml version="1.0" encoding="utf-8"?>
408 <?xml version="1.0" encoding="utf-8"?>
409 <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">
410 <testcase name="test-failure-unicode.t"/>
410 <testcase name="test-failure-unicode.t"/>
411 <testcase name="test-failure.t"/>
411 <testcase name="test-failure.t"/>
412 <testcase name="test-success.t"/>
412 <testcase name="test-success.t"/>
413 </testsuite>
413 </testsuite>
414
414
415 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
415 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
416 test-failure-unicode.t
416 test-failure-unicode.t
417 test-failure.t
417 test-failure.t
418 $ cat output/report.json
418 $ cat output/report.json
419 testreport ={
419 testreport ={
420 "test-failure-unicode.t": {
420 "test-failure-unicode.t": {
421 "result": "success"
421 "result": "success"
422 },
422 },
423 "test-failure.t": {
423 "test-failure.t": {
424 "result": "success"
424 "result": "success"
425 }
425 }
426 } (no-eol)
426 } (no-eol)
427 $ cat xunit.xml
427 $ cat xunit.xml
428 <?xml version="1.0" encoding="utf-8"?>
428 <?xml version="1.0" encoding="utf-8"?>
429 <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">
430 <testcase name="test-failure-unicode.t"/>
430 <testcase name="test-failure-unicode.t"/>
431 <testcase name="test-failure.t"/>
431 <testcase name="test-failure.t"/>
432 </testsuite>
432 </testsuite>
433
433
434 $ rm test-failure-unicode.t
434 $ rm test-failure-unicode.t
435
435
436 test for --retest
436 test for --retest
437 ====================
437 ====================
438
438
439 $ rt --retest
439 $ rt --retest
440
440
441 --- $TESTTMP/test-failure.t
441 --- $TESTTMP/test-failure.t
442 +++ $TESTTMP/test-failure.t.err
442 +++ $TESTTMP/test-failure.t.err
443 @@ -1,5 +1,5 @@
443 @@ -1,5 +1,5 @@
444 $ echo babar
444 $ echo babar
445 - rataxes
445 - rataxes
446 + babar
446 + babar
447 This is a noop statement so that
447 This is a noop statement so that
448 this test is still more bytes than success.
448 this test is still more bytes than success.
449 pad pad pad pad............................................................
449 pad pad pad pad............................................................
450
450
451 ERROR: test-failure.t output changed
451 ERROR: test-failure.t output changed
452 !
452 !
453 Failed test-failure.t: output changed
453 Failed test-failure.t: output changed
454 # Ran 2 tests, 1 skipped, 1 failed.
454 # Ran 2 tests, 1 skipped, 1 failed.
455 python hash seed: * (glob)
455 python hash seed: * (glob)
456 [1]
456 [1]
457
457
458 --retest works with --outputdir
458 --retest works with --outputdir
459 $ rm -r output
459 $ rm -r output
460 $ mkdir output
460 $ mkdir output
461 $ mv test-failure.t.err output
461 $ mv test-failure.t.err output
462 $ rt --retest --outputdir output
462 $ rt --retest --outputdir output
463
463
464 --- $TESTTMP/test-failure.t
464 --- $TESTTMP/test-failure.t
465 +++ $TESTTMP/output/test-failure.t.err
465 +++ $TESTTMP/output/test-failure.t.err
466 @@ -1,5 +1,5 @@
466 @@ -1,5 +1,5 @@
467 $ echo babar
467 $ echo babar
468 - rataxes
468 - rataxes
469 + babar
469 + babar
470 This is a noop statement so that
470 This is a noop statement so that
471 this test is still more bytes than success.
471 this test is still more bytes than success.
472 pad pad pad pad............................................................
472 pad pad pad pad............................................................
473
473
474 ERROR: test-failure.t output changed
474 ERROR: test-failure.t output changed
475 !
475 !
476 Failed test-failure.t: output changed
476 Failed test-failure.t: output changed
477 # Ran 2 tests, 1 skipped, 1 failed.
477 # Ran 2 tests, 1 skipped, 1 failed.
478 python hash seed: * (glob)
478 python hash seed: * (glob)
479 [1]
479 [1]
480
480
481 Selecting Tests To Run
481 Selecting Tests To Run
482 ======================
482 ======================
483
483
484 successful
484 successful
485
485
486 $ rt test-success.t
486 $ rt test-success.t
487 .
487 .
488 # Ran 1 tests, 0 skipped, 0 failed.
488 # Ran 1 tests, 0 skipped, 0 failed.
489
489
490 success w/ keyword
490 success w/ keyword
491 $ rt -k xyzzy
491 $ rt -k xyzzy
492 .
492 .
493 # Ran 2 tests, 1 skipped, 0 failed.
493 # Ran 2 tests, 1 skipped, 0 failed.
494
494
495 failed
495 failed
496
496
497 $ rt test-failure.t
497 $ rt test-failure.t
498
498
499 --- $TESTTMP/test-failure.t
499 --- $TESTTMP/test-failure.t
500 +++ $TESTTMP/test-failure.t.err
500 +++ $TESTTMP/test-failure.t.err
501 @@ -1,5 +1,5 @@
501 @@ -1,5 +1,5 @@
502 $ echo babar
502 $ echo babar
503 - rataxes
503 - rataxes
504 + babar
504 + babar
505 This is a noop statement so that
505 This is a noop statement so that
506 this test is still more bytes than success.
506 this test is still more bytes than success.
507 pad pad pad pad............................................................
507 pad pad pad pad............................................................
508
508
509 ERROR: test-failure.t output changed
509 ERROR: test-failure.t output changed
510 !
510 !
511 Failed test-failure.t: output changed
511 Failed test-failure.t: output changed
512 # Ran 1 tests, 0 skipped, 1 failed.
512 # Ran 1 tests, 0 skipped, 1 failed.
513 python hash seed: * (glob)
513 python hash seed: * (glob)
514 [1]
514 [1]
515
515
516 failure w/ keyword
516 failure w/ keyword
517 $ rt -k rataxes
517 $ rt -k rataxes
518
518
519 --- $TESTTMP/test-failure.t
519 --- $TESTTMP/test-failure.t
520 +++ $TESTTMP/test-failure.t.err
520 +++ $TESTTMP/test-failure.t.err
521 @@ -1,5 +1,5 @@
521 @@ -1,5 +1,5 @@
522 $ echo babar
522 $ echo babar
523 - rataxes
523 - rataxes
524 + babar
524 + babar
525 This is a noop statement so that
525 This is a noop statement so that
526 this test is still more bytes than success.
526 this test is still more bytes than success.
527 pad pad pad pad............................................................
527 pad pad pad pad............................................................
528
528
529 ERROR: test-failure.t output changed
529 ERROR: test-failure.t output changed
530 !
530 !
531 Failed test-failure.t: output changed
531 Failed test-failure.t: output changed
532 # Ran 2 tests, 1 skipped, 1 failed.
532 # Ran 2 tests, 1 skipped, 1 failed.
533 python hash seed: * (glob)
533 python hash seed: * (glob)
534 [1]
534 [1]
535
535
536 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
537 ==================================================================
537 ==================================================================
538
538
539 $ cat > test-serve-fail.t <<EOF
539 $ cat > test-serve-fail.t <<EOF
540 > $ echo 'abort: child process failed to start blah'
540 > $ echo 'abort: child process failed to start blah'
541 > EOF
541 > EOF
542 $ rt test-serve-fail.t
542 $ rt test-serve-fail.t
543
543
544 ERROR: test-serve-fail.t output changed
544 ERROR: test-serve-fail.t output changed
545 !
545 !
546 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
546 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
547 # Ran 1 tests, 0 skipped, 1 failed.
547 # Ran 1 tests, 0 skipped, 1 failed.
548 python hash seed: * (glob)
548 python hash seed: * (glob)
549 [1]
549 [1]
550 $ rm test-serve-fail.t
550 $ rm test-serve-fail.t
551
551
552 Verify that we can try other ports
552 Verify that we can try other ports
553 ===================================
553 ===================================
554 $ hg init inuse
554 $ hg init inuse
555 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
555 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
556 $ cat blocks.pid >> $DAEMON_PIDS
556 $ cat blocks.pid >> $DAEMON_PIDS
557 $ cat > test-serve-inuse.t <<EOF
557 $ cat > test-serve-inuse.t <<EOF
558 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
558 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
559 > $ cat hg.pid >> \$DAEMON_PIDS
559 > $ cat hg.pid >> \$DAEMON_PIDS
560 > EOF
560 > EOF
561 $ rt test-serve-inuse.t
561 $ rt test-serve-inuse.t
562 .
562 .
563 # Ran 1 tests, 0 skipped, 0 failed.
563 # Ran 1 tests, 0 skipped, 0 failed.
564 $ rm test-serve-inuse.t
564 $ rm test-serve-inuse.t
565 $ killdaemons.py $DAEMON_PIDS
565 $ killdaemons.py $DAEMON_PIDS
566 $ rm $DAEMON_PIDS
566 $ rm $DAEMON_PIDS
567
567
568 Running In Debug Mode
568 Running In Debug Mode
569 ======================
569 ======================
570
570
571 $ rt --debug 2>&1 | grep -v pwd
571 $ rt --debug 2>&1 | grep -v pwd
572 + echo *SALT* 0 0 (glob)
572 + echo *SALT* 0 0 (glob)
573 *SALT* 0 0 (glob)
573 *SALT* 0 0 (glob)
574 + echo babar
574 + echo babar
575 babar
575 babar
576 + echo *SALT* 10 0 (glob)
576 + echo *SALT* 10 0 (glob)
577 *SALT* 10 0 (glob)
577 *SALT* 10 0 (glob)
578 *+ echo *SALT* 0 0 (glob)
578 *+ echo *SALT* 0 0 (glob)
579 *SALT* 0 0 (glob)
579 *SALT* 0 0 (glob)
580 + echo babar
580 + echo babar
581 babar
581 babar
582 + echo *SALT* 2 0 (glob)
582 + echo *SALT* 2 0 (glob)
583 *SALT* 2 0 (glob)
583 *SALT* 2 0 (glob)
584 + echo xyzzy
584 + echo xyzzy
585 xyzzy
585 xyzzy
586 + echo *SALT* 9 0 (glob)
586 + echo *SALT* 9 0 (glob)
587 *SALT* 9 0 (glob)
587 *SALT* 9 0 (glob)
588 + printf *abc\ndef\nxyz\n* (glob)
588 + printf *abc\ndef\nxyz\n* (glob)
589 abc
589 abc
590 def
590 def
591 xyz
591 xyz
592 + echo *SALT* 15 0 (glob)
592 + echo *SALT* 15 0 (glob)
593 *SALT* 15 0 (glob)
593 *SALT* 15 0 (glob)
594 + printf *zyx\nwvu\ntsr\n* (glob)
594 + printf *zyx\nwvu\ntsr\n* (glob)
595 zyx
595 zyx
596 wvu
596 wvu
597 tsr
597 tsr
598 + echo *SALT* 22 0 (glob)
598 + echo *SALT* 22 0 (glob)
599 *SALT* 22 0 (glob)
599 *SALT* 22 0 (glob)
600 .
600 .
601 # Ran 2 tests, 0 skipped, 0 failed.
601 # Ran 2 tests, 0 skipped, 0 failed.
602
602
603 Parallel runs
603 Parallel runs
604 ==============
604 ==============
605
605
606 (duplicate the failing test to get predictable output)
606 (duplicate the failing test to get predictable output)
607 $ cp test-failure.t test-failure-copy.t
607 $ cp test-failure.t test-failure-copy.t
608
608
609 $ rt --jobs 2 test-failure*.t -n
609 $ rt --jobs 2 test-failure*.t -n
610 !!
610 !!
611 Failed test-failure*.t: output changed (glob)
611 Failed test-failure*.t: output changed (glob)
612 Failed test-failure*.t: output changed (glob)
612 Failed test-failure*.t: output changed (glob)
613 # Ran 2 tests, 0 skipped, 2 failed.
613 # Ran 2 tests, 0 skipped, 2 failed.
614 python hash seed: * (glob)
614 python hash seed: * (glob)
615 [1]
615 [1]
616
616
617 failures in parallel with --first should only print one failure
617 failures in parallel with --first should only print one failure
618 $ rt --jobs 2 --first test-failure*.t
618 $ rt --jobs 2 --first test-failure*.t
619
619
620 --- $TESTTMP/test-failure*.t (glob)
620 --- $TESTTMP/test-failure*.t (glob)
621 +++ $TESTTMP/test-failure*.t.err (glob)
621 +++ $TESTTMP/test-failure*.t.err (glob)
622 @@ -1,5 +1,5 @@
622 @@ -1,5 +1,5 @@
623 $ echo babar
623 $ echo babar
624 - rataxes
624 - rataxes
625 + babar
625 + babar
626 This is a noop statement so that
626 This is a noop statement so that
627 this test is still more bytes than success.
627 this test is still more bytes than success.
628 pad pad pad pad............................................................
628 pad pad pad pad............................................................
629
629
630 Failed test-failure*.t: output changed (glob)
630 Failed test-failure*.t: output changed (glob)
631 Failed test-failure*.t: output changed (glob)
631 Failed test-failure*.t: output changed (glob)
632 # Ran 2 tests, 0 skipped, 2 failed.
632 # Ran 2 tests, 0 skipped, 2 failed.
633 python hash seed: * (glob)
633 python hash seed: * (glob)
634 [1]
634 [1]
635
635
636
636
637 (delete the duplicated test file)
637 (delete the duplicated test file)
638 $ rm test-failure-copy.t
638 $ rm test-failure-copy.t
639
639
640
640
641 Interactive run
641 Interactive run
642 ===============
642 ===============
643
643
644 (backup the failing test)
644 (backup the failing test)
645 $ cp test-failure.t backup
645 $ cp test-failure.t backup
646
646
647 Refuse the fix
647 Refuse the fix
648
648
649 $ echo 'n' | rt -i
649 $ echo 'n' | rt -i
650
650
651 --- $TESTTMP/test-failure.t
651 --- $TESTTMP/test-failure.t
652 +++ $TESTTMP/test-failure.t.err
652 +++ $TESTTMP/test-failure.t.err
653 @@ -1,5 +1,5 @@
653 @@ -1,5 +1,5 @@
654 $ echo babar
654 $ echo babar
655 - rataxes
655 - rataxes
656 + babar
656 + babar
657 This is a noop statement so that
657 This is a noop statement so that
658 this test is still more bytes than success.
658 this test is still more bytes than success.
659 pad pad pad pad............................................................
659 pad pad pad pad............................................................
660 Accept this change? [n]
660 Accept this change? [n]
661 ERROR: test-failure.t output changed
661 ERROR: test-failure.t output changed
662 !.
662 !.
663 Failed test-failure.t: output changed
663 Failed test-failure.t: output changed
664 # Ran 2 tests, 0 skipped, 1 failed.
664 # Ran 2 tests, 0 skipped, 1 failed.
665 python hash seed: * (glob)
665 python hash seed: * (glob)
666 [1]
666 [1]
667
667
668 $ cat test-failure.t
668 $ cat test-failure.t
669 $ echo babar
669 $ echo babar
670 rataxes
670 rataxes
671 This is a noop statement so that
671 This is a noop statement so that
672 this test is still more bytes than success.
672 this test is still more bytes than success.
673 pad pad pad pad............................................................
673 pad pad pad pad............................................................
674 pad pad pad pad............................................................
674 pad pad pad pad............................................................
675 pad pad pad pad............................................................
675 pad pad pad pad............................................................
676 pad pad pad pad............................................................
676 pad pad pad pad............................................................
677 pad pad pad pad............................................................
677 pad pad pad pad............................................................
678 pad pad pad pad............................................................
678 pad pad pad pad............................................................
679
679
680 Interactive with custom view
680 Interactive with custom view
681
681
682 $ echo 'n' | rt -i --view echo
682 $ echo 'n' | rt -i --view echo
683 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
683 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
684 Accept this change? [n]* (glob)
684 Accept this change? [n]* (glob)
685 ERROR: test-failure.t output changed
685 ERROR: test-failure.t output changed
686 !.
686 !.
687 Failed test-failure.t: output changed
687 Failed test-failure.t: output changed
688 # Ran 2 tests, 0 skipped, 1 failed.
688 # Ran 2 tests, 0 skipped, 1 failed.
689 python hash seed: * (glob)
689 python hash seed: * (glob)
690 [1]
690 [1]
691
691
692 View the fix
692 View the fix
693
693
694 $ echo 'y' | rt --view echo
694 $ echo 'y' | rt --view echo
695 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
695 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
696
696
697 ERROR: test-failure.t output changed
697 ERROR: test-failure.t output changed
698 !.
698 !.
699 Failed test-failure.t: output changed
699 Failed test-failure.t: output changed
700 # Ran 2 tests, 0 skipped, 1 failed.
700 # Ran 2 tests, 0 skipped, 1 failed.
701 python hash seed: * (glob)
701 python hash seed: * (glob)
702 [1]
702 [1]
703
703
704 Accept the fix
704 Accept the fix
705
705
706 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
706 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
707 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
707 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
708 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
708 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
709 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
709 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
710 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
710 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
711 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
711 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
712 $ echo 'y' | rt -i 2>&1
712 $ echo 'y' | rt -i 2>&1
713
713
714 --- $TESTTMP/test-failure.t
714 --- $TESTTMP/test-failure.t
715 +++ $TESTTMP/test-failure.t.err
715 +++ $TESTTMP/test-failure.t.err
716 @@ -1,5 +1,5 @@
716 @@ -1,5 +1,5 @@
717 $ echo babar
717 $ echo babar
718 - rataxes
718 - rataxes
719 + babar
719 + babar
720 This is a noop statement so that
720 This is a noop statement so that
721 this test is still more bytes than success.
721 this test is still more bytes than success.
722 pad pad pad pad............................................................
722 pad pad pad pad............................................................
723 @@ -9,7 +9,7 @@
723 @@ -9,7 +9,7 @@
724 pad pad pad pad............................................................
724 pad pad pad pad............................................................
725 pad pad pad pad............................................................
725 pad pad pad pad............................................................
726 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
726 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
727 - saved backup bundle to $TESTTMP/foo.hg
727 - saved backup bundle to $TESTTMP/foo.hg
728 + saved backup bundle to $TESTTMP/foo.hg* (glob)
728 + saved backup bundle to $TESTTMP/foo.hg* (glob)
729 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
729 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
730 saved backup bundle to $TESTTMP/foo.hg* (glob)
730 saved backup bundle to $TESTTMP/foo.hg* (glob)
731 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
731 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
732 Accept this change? [n] ..
732 Accept this change? [n] ..
733 # Ran 2 tests, 0 skipped, 0 failed.
733 # Ran 2 tests, 0 skipped, 0 failed.
734
734
735 $ sed -e 's,(glob)$,&<,g' test-failure.t
735 $ sed -e 's,(glob)$,&<,g' test-failure.t
736 $ echo babar
736 $ echo babar
737 babar
737 babar
738 This is a noop statement so that
738 This is a noop statement so that
739 this test is still more bytes than success.
739 this test is still more bytes than success.
740 pad pad pad pad............................................................
740 pad pad pad pad............................................................
741 pad pad pad pad............................................................
741 pad pad pad pad............................................................
742 pad pad pad pad............................................................
742 pad pad pad pad............................................................
743 pad pad pad pad............................................................
743 pad pad pad pad............................................................
744 pad pad pad pad............................................................
744 pad pad pad pad............................................................
745 pad pad pad pad............................................................
745 pad pad pad pad............................................................
746 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
746 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
747 saved backup bundle to $TESTTMP/foo.hg (glob)<
747 saved backup bundle to $TESTTMP/foo.hg (glob)<
748 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
748 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
749 saved backup bundle to $TESTTMP/foo.hg (glob)<
749 saved backup bundle to $TESTTMP/foo.hg (glob)<
750 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
750 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
751 saved backup bundle to $TESTTMP/*.hg (glob)<
751 saved backup bundle to $TESTTMP/*.hg (glob)<
752
752
753 Race condition - test file was modified when test is running
753 Race condition - test file was modified when test is running
754
754
755 $ TESTRACEDIR=`pwd`
755 $ TESTRACEDIR=`pwd`
756 $ export TESTRACEDIR
756 $ export TESTRACEDIR
757 $ cat > test-race.t <<EOF
757 $ cat > test-race.t <<EOF
758 > $ echo 1
758 > $ echo 1
759 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
759 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
760 > EOF
760 > EOF
761
761
762 $ rt -i test-race.t
762 $ rt -i test-race.t
763
763
764 --- $TESTTMP/test-race.t
764 --- $TESTTMP/test-race.t
765 +++ $TESTTMP/test-race.t.err
765 +++ $TESTTMP/test-race.t.err
766 @@ -1,2 +1,3 @@
766 @@ -1,2 +1,3 @@
767 $ echo 1
767 $ echo 1
768 + 1
768 + 1
769 $ echo "# a new line" >> $TESTTMP/test-race.t
769 $ echo "# a new line" >> $TESTTMP/test-race.t
770 Reference output has changed (run again to prompt changes)
770 Reference output has changed (run again to prompt changes)
771 ERROR: test-race.t output changed
771 ERROR: test-race.t output changed
772 !
772 !
773 Failed test-race.t: output changed
773 Failed test-race.t: output changed
774 # Ran 1 tests, 0 skipped, 1 failed.
774 # Ran 1 tests, 0 skipped, 1 failed.
775 python hash seed: * (glob)
775 python hash seed: * (glob)
776 [1]
776 [1]
777
777
778 $ rm test-race.t
778 $ rm test-race.t
779
779
780 When "#testcases" is used in .t files
780 When "#testcases" is used in .t files
781
781
782 $ cat >> test-cases.t <<EOF
782 $ cat >> test-cases.t <<EOF
783 > #testcases a b
783 > #testcases a b
784 > #if a
784 > #if a
785 > $ echo 1
785 > $ echo 1
786 > #endif
786 > #endif
787 > #if b
787 > #if b
788 > $ echo 2
788 > $ echo 2
789 > #endif
789 > #endif
790 > EOF
790 > EOF
791
791
792 $ cat <<EOF | rt -i test-cases.t 2>&1
792 $ cat <<EOF | rt -i test-cases.t 2>&1
793 > y
793 > y
794 > y
794 > y
795 > EOF
795 > EOF
796
796
797 --- $TESTTMP/test-cases.t
797 --- $TESTTMP/test-cases.t
798 +++ $TESTTMP/test-cases.t.a.err
798 +++ $TESTTMP/test-cases.t.a.err
799 @@ -1,6 +1,7 @@
799 @@ -1,6 +1,7 @@
800 #testcases a b
800 #testcases a b
801 #if a
801 #if a
802 $ echo 1
802 $ echo 1
803 + 1
803 + 1
804 #endif
804 #endif
805 #if b
805 #if b
806 $ echo 2
806 $ echo 2
807 Accept this change? [n] .
807 Accept this change? [n] .
808 --- $TESTTMP/test-cases.t
808 --- $TESTTMP/test-cases.t
809 +++ $TESTTMP/test-cases.t.b.err
809 +++ $TESTTMP/test-cases.t.b.err
810 @@ -5,4 +5,5 @@
810 @@ -5,4 +5,5 @@
811 #endif
811 #endif
812 #if b
812 #if b
813 $ echo 2
813 $ echo 2
814 + 2
814 + 2
815 #endif
815 #endif
816 Accept this change? [n] .
816 Accept this change? [n] .
817 # Ran 2 tests, 0 skipped, 0 failed.
817 # Ran 2 tests, 0 skipped, 0 failed.
818
818
819 $ cat test-cases.t
819 $ cat test-cases.t
820 #testcases a b
820 #testcases a b
821 #if a
821 #if a
822 $ echo 1
822 $ echo 1
823 1
823 1
824 #endif
824 #endif
825 #if b
825 #if b
826 $ echo 2
826 $ echo 2
827 2
827 2
828 #endif
828 #endif
829
829
830 $ cat >> test-cases.t <<'EOF'
830 $ cat >> test-cases.t <<'EOF'
831 > #if a
831 > #if a
832 > $ NAME=A
832 > $ NAME=A
833 > #else
833 > #else
834 > $ NAME=B
834 > $ NAME=B
835 > #endif
835 > #endif
836 > $ echo $NAME
836 > $ echo $NAME
837 > A (a !)
837 > A (a !)
838 > B (b !)
838 > B (b !)
839 > EOF
839 > EOF
840 $ rt test-cases.t
840 $ rt test-cases.t
841 ..
841 ..
842 # Ran 2 tests, 0 skipped, 0 failed.
842 # Ran 2 tests, 0 skipped, 0 failed.
843
843
844 $ rm test-cases.t
844 $ rm test-cases.t
845
845
846 (reinstall)
846 (reinstall)
847 $ mv backup test-failure.t
847 $ mv backup test-failure.t
848
848
849 No Diff
849 No Diff
850 ===============
850 ===============
851
851
852 $ rt --nodiff
852 $ rt --nodiff
853 !.
853 !.
854 Failed test-failure.t: output changed
854 Failed test-failure.t: output changed
855 # Ran 2 tests, 0 skipped, 1 failed.
855 # Ran 2 tests, 0 skipped, 1 failed.
856 python hash seed: * (glob)
856 python hash seed: * (glob)
857 [1]
857 [1]
858
858
859 test --tmpdir support
859 test --tmpdir support
860 $ rt --tmpdir=$TESTTMP/keep test-success.t
860 $ rt --tmpdir=$TESTTMP/keep test-success.t
861
861
862 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
862 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
863 Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
863 Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
864 .
864 .
865 # Ran 1 tests, 0 skipped, 0 failed.
865 # Ran 1 tests, 0 skipped, 0 failed.
866
866
867 timeouts
867 timeouts
868 ========
868 ========
869 $ cat > test-timeout.t <<EOF
869 $ cat > test-timeout.t <<EOF
870 > $ sleep 2
870 > $ sleep 2
871 > $ echo pass
871 > $ echo pass
872 > pass
872 > pass
873 > EOF
873 > EOF
874 > echo '#require slow' > test-slow-timeout.t
874 > echo '#require slow' > test-slow-timeout.t
875 > cat test-timeout.t >> test-slow-timeout.t
875 > cat test-timeout.t >> test-slow-timeout.t
876 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
876 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
877 st
877 st
878 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
878 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
879 Failed test-timeout.t: timed out
879 Failed test-timeout.t: timed out
880 # Ran 1 tests, 1 skipped, 1 failed.
880 # Ran 1 tests, 1 skipped, 1 failed.
881 python hash seed: * (glob)
881 python hash seed: * (glob)
882 [1]
882 [1]
883 $ rt --timeout=1 --slowtimeout=3 \
883 $ rt --timeout=1 --slowtimeout=3 \
884 > test-timeout.t test-slow-timeout.t --allow-slow-tests
884 > test-timeout.t test-slow-timeout.t --allow-slow-tests
885 .t
885 .t
886 Failed test-timeout.t: timed out
886 Failed test-timeout.t: timed out
887 # Ran 2 tests, 0 skipped, 1 failed.
887 # Ran 2 tests, 0 skipped, 1 failed.
888 python hash seed: * (glob)
888 python hash seed: * (glob)
889 [1]
889 [1]
890 $ rm test-timeout.t test-slow-timeout.t
890 $ rm test-timeout.t test-slow-timeout.t
891
891
892 test for --time
892 test for --time
893 ==================
893 ==================
894
894
895 $ rt test-success.t --time
895 $ rt test-success.t --time
896 .
896 .
897 # Ran 1 tests, 0 skipped, 0 failed.
897 # Ran 1 tests, 0 skipped, 0 failed.
898 # Producing time report
898 # Producing time report
899 start end cuser csys real Test
899 start end cuser csys real Test
900 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
900 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
901
901
902 test for --time with --job enabled
902 test for --time with --job enabled
903 ====================================
903 ====================================
904
904
905 $ rt test-success.t --time --jobs 2
905 $ rt test-success.t --time --jobs 2
906 .
906 .
907 # Ran 1 tests, 0 skipped, 0 failed.
907 # Ran 1 tests, 0 skipped, 0 failed.
908 # Producing time report
908 # Producing time report
909 start end cuser csys real Test
909 start end cuser csys real Test
910 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
910 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
911
911
912 Skips
912 Skips
913 ================
913 ================
914 $ cat > test-skip.t <<EOF
914 $ cat > test-skip.t <<EOF
915 > $ echo xyzzy
915 > $ echo xyzzy
916 > #require false
916 > #require false
917 > EOF
917 > EOF
918 $ rt --nodiff
918 $ rt --nodiff
919 !.s
919 !.s
920 Skipped test-skip.t: missing feature: nail clipper
920 Skipped test-skip.t: missing feature: nail clipper
921 Failed test-failure.t: output changed
921 Failed test-failure.t: output changed
922 # Ran 2 tests, 1 skipped, 1 failed.
922 # Ran 2 tests, 1 skipped, 1 failed.
923 python hash seed: * (glob)
923 python hash seed: * (glob)
924 [1]
924 [1]
925
925
926 $ rt --keyword xyzzy
926 $ rt --keyword xyzzy
927 .s
927 .s
928 Skipped test-skip.t: missing feature: nail clipper
928 Skipped test-skip.t: missing feature: nail clipper
929 # Ran 2 tests, 2 skipped, 0 failed.
929 # Ran 2 tests, 2 skipped, 0 failed.
930
930
931 Skips with xml
931 Skips with xml
932 $ rt --keyword xyzzy \
932 $ rt --keyword xyzzy \
933 > --xunit=xunit.xml
933 > --xunit=xunit.xml
934 .s
934 .s
935 Skipped test-skip.t: missing feature: nail clipper
935 Skipped test-skip.t: missing feature: nail clipper
936 # Ran 2 tests, 2 skipped, 0 failed.
936 # Ran 2 tests, 2 skipped, 0 failed.
937 $ cat xunit.xml
937 $ cat xunit.xml
938 <?xml version="1.0" encoding="utf-8"?>
938 <?xml version="1.0" encoding="utf-8"?>
939 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
939 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
940 <testcase name="test-success.t" time="*"/> (glob)
940 <testcase name="test-success.t" time="*"/> (glob)
941 <testcase name="test-skip.t">
941 <testcase name="test-skip.t">
942 <skipped>
942 <skipped>
943 <![CDATA[missing feature: nail clipper]]> </skipped>
943 <![CDATA[missing feature: nail clipper]]> </skipped>
944 </testcase>
944 </testcase>
945 </testsuite>
945 </testsuite>
946
946
947 Missing skips or blacklisted skips don't count as executed:
947 Missing skips or blacklisted skips don't count as executed:
948 $ echo test-failure.t > blacklist
948 $ echo test-failure.t > blacklist
949 $ rt --blacklist=blacklist --json\
949 $ rt --blacklist=blacklist --json\
950 > test-failure.t test-bogus.t
950 > test-failure.t test-bogus.t
951 ss
951 ss
952 Skipped test-bogus.t: Doesn't exist
952 Skipped test-bogus.t: Doesn't exist
953 Skipped test-failure.t: blacklisted
953 Skipped test-failure.t: blacklisted
954 # Ran 0 tests, 2 skipped, 0 failed.
954 # Ran 0 tests, 2 skipped, 0 failed.
955 $ cat report.json
955 $ cat report.json
956 testreport ={
956 testreport ={
957 "test-bogus.t": {
957 "test-bogus.t": {
958 "result": "skip"
958 "result": "skip"
959 },
959 },
960 "test-failure.t": {
960 "test-failure.t": {
961 "result": "skip"
961 "result": "skip"
962 }
962 }
963 } (no-eol)
963 } (no-eol)
964
964
965 Whitelist trumps blacklist
965 Whitelist trumps blacklist
966 $ echo test-failure.t > whitelist
966 $ echo test-failure.t > whitelist
967 $ rt --blacklist=blacklist --whitelist=whitelist --json\
967 $ rt --blacklist=blacklist --whitelist=whitelist --json\
968 > test-failure.t test-bogus.t
968 > test-failure.t test-bogus.t
969 s
969 s
970 --- $TESTTMP/test-failure.t
970 --- $TESTTMP/test-failure.t
971 +++ $TESTTMP/test-failure.t.err
971 +++ $TESTTMP/test-failure.t.err
972 @@ -1,5 +1,5 @@
972 @@ -1,5 +1,5 @@
973 $ echo babar
973 $ echo babar
974 - rataxes
974 - rataxes
975 + babar
975 + babar
976 This is a noop statement so that
976 This is a noop statement so that
977 this test is still more bytes than success.
977 this test is still more bytes than success.
978 pad pad pad pad............................................................
978 pad pad pad pad............................................................
979
979
980 ERROR: test-failure.t output changed
980 ERROR: test-failure.t output changed
981 !
981 !
982 Skipped test-bogus.t: Doesn't exist
982 Skipped test-bogus.t: Doesn't exist
983 Failed test-failure.t: output changed
983 Failed test-failure.t: output changed
984 # Ran 1 tests, 1 skipped, 1 failed.
984 # Ran 1 tests, 1 skipped, 1 failed.
985 python hash seed: * (glob)
985 python hash seed: * (glob)
986 [1]
986 [1]
987
987
988 Ensure that --test-list causes only the tests listed in that file to
988 Ensure that --test-list causes only the tests listed in that file to
989 be executed.
989 be executed.
990 $ echo test-success.t >> onlytest
990 $ echo test-success.t >> onlytest
991 $ rt --test-list=onlytest
991 $ rt --test-list=onlytest
992 .
992 .
993 # Ran 1 tests, 0 skipped, 0 failed.
993 # Ran 1 tests, 0 skipped, 0 failed.
994 $ echo test-bogus.t >> anothertest
994 $ echo test-bogus.t >> anothertest
995 $ rt --test-list=onlytest --test-list=anothertest
995 $ rt --test-list=onlytest --test-list=anothertest
996 s.
996 s.
997 Skipped test-bogus.t: Doesn't exist
997 Skipped test-bogus.t: Doesn't exist
998 # Ran 1 tests, 1 skipped, 0 failed.
998 # Ran 1 tests, 1 skipped, 0 failed.
999 $ rm onlytest anothertest
999 $ rm onlytest anothertest
1000
1000
1001 test for --json
1001 test for --json
1002 ==================
1002 ==================
1003
1003
1004 $ rt --json
1004 $ rt --json
1005
1005
1006 --- $TESTTMP/test-failure.t
1006 --- $TESTTMP/test-failure.t
1007 +++ $TESTTMP/test-failure.t.err
1007 +++ $TESTTMP/test-failure.t.err
1008 @@ -1,5 +1,5 @@
1008 @@ -1,5 +1,5 @@
1009 $ echo babar
1009 $ echo babar
1010 - rataxes
1010 - rataxes
1011 + babar
1011 + babar
1012 This is a noop statement so that
1012 This is a noop statement so that
1013 this test is still more bytes than success.
1013 this test is still more bytes than success.
1014 pad pad pad pad............................................................
1014 pad pad pad pad............................................................
1015
1015
1016 ERROR: test-failure.t output changed
1016 ERROR: test-failure.t output changed
1017 !.s
1017 !.s
1018 Skipped test-skip.t: missing feature: nail clipper
1018 Skipped test-skip.t: missing feature: nail clipper
1019 Failed test-failure.t: output changed
1019 Failed test-failure.t: output changed
1020 # Ran 2 tests, 1 skipped, 1 failed.
1020 # Ran 2 tests, 1 skipped, 1 failed.
1021 python hash seed: * (glob)
1021 python hash seed: * (glob)
1022 [1]
1022 [1]
1023
1023
1024 $ cat report.json
1024 $ cat report.json
1025 testreport ={
1025 testreport ={
1026 "test-failure.t": [\{] (re)
1026 "test-failure.t": [\{] (re)
1027 "csys": "\s*[\d\.]{4,5}", ? (re)
1027 "csys": "\s*[\d\.]{4,5}", ? (re)
1028 "cuser": "\s*[\d\.]{4,5}", ? (re)
1028 "cuser": "\s*[\d\.]{4,5}", ? (re)
1029 "diff": "---.+\+\+\+.+", ? (re)
1029 "diff": "---.+\+\+\+.+", ? (re)
1030 "end": "\s*[\d\.]{4,5}", ? (re)
1030 "end": "\s*[\d\.]{4,5}", ? (re)
1031 "result": "failure", ? (re)
1031 "result": "failure", ? (re)
1032 "start": "\s*[\d\.]{4,5}", ? (re)
1032 "start": "\s*[\d\.]{4,5}", ? (re)
1033 "time": "\s*[\d\.]{4,5}" (re)
1033 "time": "\s*[\d\.]{4,5}" (re)
1034 }, ? (re)
1034 }, ? (re)
1035 "test-skip.t": {
1035 "test-skip.t": {
1036 "csys": "\s*[\d\.]{4,5}", ? (re)
1036 "csys": "\s*[\d\.]{4,5}", ? (re)
1037 "cuser": "\s*[\d\.]{4,5}", ? (re)
1037 "cuser": "\s*[\d\.]{4,5}", ? (re)
1038 "diff": "", ? (re)
1038 "diff": "", ? (re)
1039 "end": "\s*[\d\.]{4,5}", ? (re)
1039 "end": "\s*[\d\.]{4,5}", ? (re)
1040 "result": "skip", ? (re)
1040 "result": "skip", ? (re)
1041 "start": "\s*[\d\.]{4,5}", ? (re)
1041 "start": "\s*[\d\.]{4,5}", ? (re)
1042 "time": "\s*[\d\.]{4,5}" (re)
1042 "time": "\s*[\d\.]{4,5}" (re)
1043 }, ? (re)
1043 }, ? (re)
1044 "test-success.t": [\{] (re)
1044 "test-success.t": [\{] (re)
1045 "csys": "\s*[\d\.]{4,5}", ? (re)
1045 "csys": "\s*[\d\.]{4,5}", ? (re)
1046 "cuser": "\s*[\d\.]{4,5}", ? (re)
1046 "cuser": "\s*[\d\.]{4,5}", ? (re)
1047 "diff": "", ? (re)
1047 "diff": "", ? (re)
1048 "end": "\s*[\d\.]{4,5}", ? (re)
1048 "end": "\s*[\d\.]{4,5}", ? (re)
1049 "result": "success", ? (re)
1049 "result": "success", ? (re)
1050 "start": "\s*[\d\.]{4,5}", ? (re)
1050 "start": "\s*[\d\.]{4,5}", ? (re)
1051 "time": "\s*[\d\.]{4,5}" (re)
1051 "time": "\s*[\d\.]{4,5}" (re)
1052 }
1052 }
1053 } (no-eol)
1053 } (no-eol)
1054 --json with --outputdir
1054 --json with --outputdir
1055
1055
1056 $ rm report.json
1056 $ rm report.json
1057 $ rm -r output
1057 $ rm -r output
1058 $ mkdir output
1058 $ mkdir output
1059 $ rt --json --outputdir output
1059 $ rt --json --outputdir output
1060
1060
1061 --- $TESTTMP/test-failure.t
1061 --- $TESTTMP/test-failure.t
1062 +++ $TESTTMP/output/test-failure.t.err
1062 +++ $TESTTMP/output/test-failure.t.err
1063 @@ -1,5 +1,5 @@
1063 @@ -1,5 +1,5 @@
1064 $ echo babar
1064 $ echo babar
1065 - rataxes
1065 - rataxes
1066 + babar
1066 + babar
1067 This is a noop statement so that
1067 This is a noop statement so that
1068 this test is still more bytes than success.
1068 this test is still more bytes than success.
1069 pad pad pad pad............................................................
1069 pad pad pad pad............................................................
1070
1070
1071 ERROR: test-failure.t output changed
1071 ERROR: test-failure.t output changed
1072 !.s
1072 !.s
1073 Skipped test-skip.t: missing feature: nail clipper
1073 Skipped test-skip.t: missing feature: nail clipper
1074 Failed test-failure.t: output changed
1074 Failed test-failure.t: output changed
1075 # Ran 2 tests, 1 skipped, 1 failed.
1075 # Ran 2 tests, 1 skipped, 1 failed.
1076 python hash seed: * (glob)
1076 python hash seed: * (glob)
1077 [1]
1077 [1]
1078 $ f report.json
1078 $ f report.json
1079 report.json: file not found
1079 report.json: file not found
1080 $ cat output/report.json
1080 $ cat output/report.json
1081 testreport ={
1081 testreport ={
1082 "test-failure.t": [\{] (re)
1082 "test-failure.t": [\{] (re)
1083 "csys": "\s*[\d\.]{4,5}", ? (re)
1083 "csys": "\s*[\d\.]{4,5}", ? (re)
1084 "cuser": "\s*[\d\.]{4,5}", ? (re)
1084 "cuser": "\s*[\d\.]{4,5}", ? (re)
1085 "diff": "---.+\+\+\+.+", ? (re)
1085 "diff": "---.+\+\+\+.+", ? (re)
1086 "end": "\s*[\d\.]{4,5}", ? (re)
1086 "end": "\s*[\d\.]{4,5}", ? (re)
1087 "result": "failure", ? (re)
1087 "result": "failure", ? (re)
1088 "start": "\s*[\d\.]{4,5}", ? (re)
1088 "start": "\s*[\d\.]{4,5}", ? (re)
1089 "time": "\s*[\d\.]{4,5}" (re)
1089 "time": "\s*[\d\.]{4,5}" (re)
1090 }, ? (re)
1090 }, ? (re)
1091 "test-skip.t": {
1091 "test-skip.t": {
1092 "csys": "\s*[\d\.]{4,5}", ? (re)
1092 "csys": "\s*[\d\.]{4,5}", ? (re)
1093 "cuser": "\s*[\d\.]{4,5}", ? (re)
1093 "cuser": "\s*[\d\.]{4,5}", ? (re)
1094 "diff": "", ? (re)
1094 "diff": "", ? (re)
1095 "end": "\s*[\d\.]{4,5}", ? (re)
1095 "end": "\s*[\d\.]{4,5}", ? (re)
1096 "result": "skip", ? (re)
1096 "result": "skip", ? (re)
1097 "start": "\s*[\d\.]{4,5}", ? (re)
1097 "start": "\s*[\d\.]{4,5}", ? (re)
1098 "time": "\s*[\d\.]{4,5}" (re)
1098 "time": "\s*[\d\.]{4,5}" (re)
1099 }, ? (re)
1099 }, ? (re)
1100 "test-success.t": [\{] (re)
1100 "test-success.t": [\{] (re)
1101 "csys": "\s*[\d\.]{4,5}", ? (re)
1101 "csys": "\s*[\d\.]{4,5}", ? (re)
1102 "cuser": "\s*[\d\.]{4,5}", ? (re)
1102 "cuser": "\s*[\d\.]{4,5}", ? (re)
1103 "diff": "", ? (re)
1103 "diff": "", ? (re)
1104 "end": "\s*[\d\.]{4,5}", ? (re)
1104 "end": "\s*[\d\.]{4,5}", ? (re)
1105 "result": "success", ? (re)
1105 "result": "success", ? (re)
1106 "start": "\s*[\d\.]{4,5}", ? (re)
1106 "start": "\s*[\d\.]{4,5}", ? (re)
1107 "time": "\s*[\d\.]{4,5}" (re)
1107 "time": "\s*[\d\.]{4,5}" (re)
1108 }
1108 }
1109 } (no-eol)
1109 } (no-eol)
1110 $ ls -a output
1110 $ ls -a output
1111 .
1111 .
1112 ..
1112 ..
1113 .testtimes
1113 .testtimes
1114 report.json
1114 report.json
1115 test-failure.t.err
1115 test-failure.t.err
1116
1116
1117 Test that failed test accepted through interactive are properly reported:
1117 Test that failed test accepted through interactive are properly reported:
1118
1118
1119 $ cp test-failure.t backup
1119 $ cp test-failure.t backup
1120 $ echo y | rt --json -i
1120 $ echo y | rt --json -i
1121
1121
1122 --- $TESTTMP/test-failure.t
1122 --- $TESTTMP/test-failure.t
1123 +++ $TESTTMP/test-failure.t.err
1123 +++ $TESTTMP/test-failure.t.err
1124 @@ -1,5 +1,5 @@
1124 @@ -1,5 +1,5 @@
1125 $ echo babar
1125 $ echo babar
1126 - rataxes
1126 - rataxes
1127 + babar
1127 + babar
1128 This is a noop statement so that
1128 This is a noop statement so that
1129 this test is still more bytes than success.
1129 this test is still more bytes than success.
1130 pad pad pad pad............................................................
1130 pad pad pad pad............................................................
1131 Accept this change? [n] ..s
1131 Accept this change? [n] ..s
1132 Skipped test-skip.t: missing feature: nail clipper
1132 Skipped test-skip.t: missing feature: nail clipper
1133 # Ran 2 tests, 1 skipped, 0 failed.
1133 # Ran 2 tests, 1 skipped, 0 failed.
1134
1134
1135 $ cat report.json
1135 $ cat report.json
1136 testreport ={
1136 testreport ={
1137 "test-failure.t": [\{] (re)
1137 "test-failure.t": [\{] (re)
1138 "csys": "\s*[\d\.]{4,5}", ? (re)
1138 "csys": "\s*[\d\.]{4,5}", ? (re)
1139 "cuser": "\s*[\d\.]{4,5}", ? (re)
1139 "cuser": "\s*[\d\.]{4,5}", ? (re)
1140 "diff": "", ? (re)
1140 "diff": "", ? (re)
1141 "end": "\s*[\d\.]{4,5}", ? (re)
1141 "end": "\s*[\d\.]{4,5}", ? (re)
1142 "result": "success", ? (re)
1142 "result": "success", ? (re)
1143 "start": "\s*[\d\.]{4,5}", ? (re)
1143 "start": "\s*[\d\.]{4,5}", ? (re)
1144 "time": "\s*[\d\.]{4,5}" (re)
1144 "time": "\s*[\d\.]{4,5}" (re)
1145 }, ? (re)
1145 }, ? (re)
1146 "test-skip.t": {
1146 "test-skip.t": {
1147 "csys": "\s*[\d\.]{4,5}", ? (re)
1147 "csys": "\s*[\d\.]{4,5}", ? (re)
1148 "cuser": "\s*[\d\.]{4,5}", ? (re)
1148 "cuser": "\s*[\d\.]{4,5}", ? (re)
1149 "diff": "", ? (re)
1149 "diff": "", ? (re)
1150 "end": "\s*[\d\.]{4,5}", ? (re)
1150 "end": "\s*[\d\.]{4,5}", ? (re)
1151 "result": "skip", ? (re)
1151 "result": "skip", ? (re)
1152 "start": "\s*[\d\.]{4,5}", ? (re)
1152 "start": "\s*[\d\.]{4,5}", ? (re)
1153 "time": "\s*[\d\.]{4,5}" (re)
1153 "time": "\s*[\d\.]{4,5}" (re)
1154 }, ? (re)
1154 }, ? (re)
1155 "test-success.t": [\{] (re)
1155 "test-success.t": [\{] (re)
1156 "csys": "\s*[\d\.]{4,5}", ? (re)
1156 "csys": "\s*[\d\.]{4,5}", ? (re)
1157 "cuser": "\s*[\d\.]{4,5}", ? (re)
1157 "cuser": "\s*[\d\.]{4,5}", ? (re)
1158 "diff": "", ? (re)
1158 "diff": "", ? (re)
1159 "end": "\s*[\d\.]{4,5}", ? (re)
1159 "end": "\s*[\d\.]{4,5}", ? (re)
1160 "result": "success", ? (re)
1160 "result": "success", ? (re)
1161 "start": "\s*[\d\.]{4,5}", ? (re)
1161 "start": "\s*[\d\.]{4,5}", ? (re)
1162 "time": "\s*[\d\.]{4,5}" (re)
1162 "time": "\s*[\d\.]{4,5}" (re)
1163 }
1163 }
1164 } (no-eol)
1164 } (no-eol)
1165 $ mv backup test-failure.t
1165 $ mv backup test-failure.t
1166
1166
1167 backslash on end of line with glob matching is handled properly
1167 backslash on end of line with glob matching is handled properly
1168
1168
1169 $ cat > test-glob-backslash.t << EOF
1169 $ cat > test-glob-backslash.t << EOF
1170 > $ echo 'foo bar \\'
1170 > $ echo 'foo bar \\'
1171 > foo * \ (glob)
1171 > foo * \ (glob)
1172 > EOF
1172 > EOF
1173
1173
1174 $ rt test-glob-backslash.t
1174 $ rt test-glob-backslash.t
1175 .
1175 .
1176 # Ran 1 tests, 0 skipped, 0 failed.
1176 # Ran 1 tests, 0 skipped, 0 failed.
1177
1177
1178 $ rm -f test-glob-backslash.t
1178 $ rm -f test-glob-backslash.t
1179
1179
1180 Test globbing of local IP addresses
1180 Test globbing of local IP addresses
1181 $ echo 172.16.18.1
1181 $ echo 172.16.18.1
1182 $LOCALIP (glob)
1182 $LOCALIP (glob)
1183 $ echo dead:beef::1
1183 $ echo dead:beef::1
1184 $LOCALIP (glob)
1184 $LOCALIP (glob)
1185
1185
1186 Test reusability for third party tools
1186 Test reusability for third party tools
1187 ======================================
1187 ======================================
1188
1188
1189 $ mkdir "$TESTTMP"/anothertests
1189 $ mkdir "$TESTTMP"/anothertests
1190 $ cd "$TESTTMP"/anothertests
1190 $ cd "$TESTTMP"/anothertests
1191
1191
1192 test that `run-tests.py` can execute hghave, even if it runs not in
1192 test that `run-tests.py` can execute hghave, even if it runs not in
1193 Mercurial source tree.
1193 Mercurial source tree.
1194
1194
1195 $ cat > test-hghave.t <<EOF
1195 $ cat > test-hghave.t <<EOF
1196 > #require true
1196 > #require true
1197 > $ echo foo
1197 > $ echo foo
1198 > foo
1198 > foo
1199 > EOF
1199 > EOF
1200 $ rt test-hghave.t
1200 $ rt test-hghave.t
1201 .
1201 .
1202 # Ran 1 tests, 0 skipped, 0 failed.
1202 # Ran 1 tests, 0 skipped, 0 failed.
1203
1203
1204 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1204 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1205 running is placed.
1205 running is placed.
1206
1206
1207 $ cat > test-runtestdir.t <<EOF
1207 $ cat > test-runtestdir.t <<EOF
1208 > - $TESTDIR, in which test-run-tests.t is placed
1208 > - $TESTDIR, in which test-run-tests.t is placed
1209 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1209 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1210 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1210 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1211 >
1211 >
1212 > #if windows
1212 > #if windows
1213 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
1213 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
1214 > #else
1214 > #else
1215 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
1215 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
1216 > #endif
1216 > #endif
1217 > $ test "\$RUNTESTDIR" = "$TESTDIR"
1217 > If this prints a path, that means RUNTESTDIR didn't equal
1218 > TESTDIR as it should have.
1219 > $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR"
1220 > This should print the start of check-code. If this passes but the
1221 > previous check failed, that means we found a copy of check-code at whatever
1222 > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR.
1218 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
1223 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
1219 > #!USRBINENVPY
1224 > #!USRBINENVPY
1220 > #
1225 > #
1221 > # check-code - a style and portability checker for Mercurial
1226 > # check-code - a style and portability checker for Mercurial
1222 > EOF
1227 > EOF
1223 $ rt test-runtestdir.t
1228 $ rt test-runtestdir.t
1224 .
1229 .
1225 # Ran 1 tests, 0 skipped, 0 failed.
1230 # Ran 1 tests, 0 skipped, 0 failed.
1226
1231
1227 #if execbit
1232 #if execbit
1228
1233
1229 test that TESTDIR is referred in PATH
1234 test that TESTDIR is referred in PATH
1230
1235
1231 $ cat > custom-command.sh <<EOF
1236 $ cat > custom-command.sh <<EOF
1232 > #!/bin/sh
1237 > #!/bin/sh
1233 > echo "hello world"
1238 > echo "hello world"
1234 > EOF
1239 > EOF
1235 $ chmod +x custom-command.sh
1240 $ chmod +x custom-command.sh
1236 $ cat > test-testdir-path.t <<EOF
1241 $ cat > test-testdir-path.t <<EOF
1237 > $ custom-command.sh
1242 > $ custom-command.sh
1238 > hello world
1243 > hello world
1239 > EOF
1244 > EOF
1240 $ rt test-testdir-path.t
1245 $ rt test-testdir-path.t
1241 .
1246 .
1242 # Ran 1 tests, 0 skipped, 0 failed.
1247 # Ran 1 tests, 0 skipped, 0 failed.
1243
1248
1244 #endif
1249 #endif
1245
1250
1246 test support for --allow-slow-tests
1251 test support for --allow-slow-tests
1247 $ cat > test-very-slow-test.t <<EOF
1252 $ cat > test-very-slow-test.t <<EOF
1248 > #require slow
1253 > #require slow
1249 > $ echo pass
1254 > $ echo pass
1250 > pass
1255 > pass
1251 > EOF
1256 > EOF
1252 $ rt test-very-slow-test.t
1257 $ rt test-very-slow-test.t
1253 s
1258 s
1254 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1259 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1255 # Ran 0 tests, 1 skipped, 0 failed.
1260 # Ran 0 tests, 1 skipped, 0 failed.
1256 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1261 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1257 .
1262 .
1258 # Ran 1 tests, 0 skipped, 0 failed.
1263 # Ran 1 tests, 0 skipped, 0 failed.
1259
1264
1260 support for running a test outside the current directory
1265 support for running a test outside the current directory
1261 $ mkdir nonlocal
1266 $ mkdir nonlocal
1262 $ cat > nonlocal/test-is-not-here.t << EOF
1267 $ cat > nonlocal/test-is-not-here.t << EOF
1263 > $ echo pass
1268 > $ echo pass
1264 > pass
1269 > pass
1265 > EOF
1270 > EOF
1266 $ rt nonlocal/test-is-not-here.t
1271 $ rt nonlocal/test-is-not-here.t
1267 .
1272 .
1268 # Ran 1 tests, 0 skipped, 0 failed.
1273 # Ran 1 tests, 0 skipped, 0 failed.
1269
1274
1270 support for automatically discovering test if arg is a folder
1275 support for automatically discovering test if arg is a folder
1271 $ mkdir tmp && cd tmp
1276 $ mkdir tmp && cd tmp
1272
1277
1273 $ cat > test-uno.t << EOF
1278 $ cat > test-uno.t << EOF
1274 > $ echo line
1279 > $ echo line
1275 > line
1280 > line
1276 > EOF
1281 > EOF
1277
1282
1278 $ cp test-uno.t test-dos.t
1283 $ cp test-uno.t test-dos.t
1279 $ cd ..
1284 $ cd ..
1280 $ cp -R tmp tmpp
1285 $ cp -R tmp tmpp
1281 $ cp tmp/test-uno.t test-solo.t
1286 $ cp tmp/test-uno.t test-solo.t
1282
1287
1283 $ rt tmp/ test-solo.t tmpp
1288 $ rt tmp/ test-solo.t tmpp
1284 .....
1289 .....
1285 # Ran 5 tests, 0 skipped, 0 failed.
1290 # Ran 5 tests, 0 skipped, 0 failed.
1286 $ rm -rf tmp tmpp
1291 $ rm -rf tmp tmpp
1287
1292
1288 support for running run-tests.py from another directory
1293 support for running run-tests.py from another directory
1289 $ mkdir tmp && cd tmp
1294 $ mkdir tmp && cd tmp
1290
1295
1291 $ cat > useful-file.sh << EOF
1296 $ cat > useful-file.sh << EOF
1292 > important command
1297 > important command
1293 > EOF
1298 > EOF
1294
1299
1295 $ cat > test-folder.t << EOF
1300 $ cat > test-folder.t << EOF
1296 > $ cat \$TESTDIR/useful-file.sh
1301 > $ cat \$TESTDIR/useful-file.sh
1297 > important command
1302 > important command
1298 > EOF
1303 > EOF
1299
1304
1300 $ cat > test-folder-fail.t << EOF
1305 $ cat > test-folder-fail.t << EOF
1301 > $ cat \$TESTDIR/useful-file.sh
1306 > $ cat \$TESTDIR/useful-file.sh
1302 > important commando
1307 > important commando
1303 > EOF
1308 > EOF
1304
1309
1305 $ cd ..
1310 $ cd ..
1306 $ rt tmp/test-*.t
1311 $ rt tmp/test-*.t
1307
1312
1308 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1313 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1309 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1314 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1310 @@ -1,2 +1,2 @@
1315 @@ -1,2 +1,2 @@
1311 $ cat $TESTDIR/useful-file.sh
1316 $ cat $TESTDIR/useful-file.sh
1312 - important commando
1317 - important commando
1313 + important command
1318 + important command
1314
1319
1315 ERROR: test-folder-fail.t output changed
1320 ERROR: test-folder-fail.t output changed
1316 !.
1321 !.
1317 Failed test-folder-fail.t: output changed
1322 Failed test-folder-fail.t: output changed
1318 # Ran 2 tests, 0 skipped, 1 failed.
1323 # Ran 2 tests, 0 skipped, 1 failed.
1319 python hash seed: * (glob)
1324 python hash seed: * (glob)
1320 [1]
1325 [1]
1321
1326
1322 support for bisecting failed tests automatically
1327 support for bisecting failed tests automatically
1323 $ hg init bisect
1328 $ hg init bisect
1324 $ cd bisect
1329 $ cd bisect
1325 $ cat >> test-bisect.t <<EOF
1330 $ cat >> test-bisect.t <<EOF
1326 > $ echo pass
1331 > $ echo pass
1327 > pass
1332 > pass
1328 > EOF
1333 > EOF
1329 $ hg add test-bisect.t
1334 $ hg add test-bisect.t
1330 $ hg ci -m 'good'
1335 $ hg ci -m 'good'
1331 $ cat >> test-bisect.t <<EOF
1336 $ cat >> test-bisect.t <<EOF
1332 > $ echo pass
1337 > $ echo pass
1333 > fail
1338 > fail
1334 > EOF
1339 > EOF
1335 $ hg ci -m 'bad'
1340 $ hg ci -m 'bad'
1336 $ rt --known-good-rev=0 test-bisect.t
1341 $ rt --known-good-rev=0 test-bisect.t
1337
1342
1338 --- $TESTTMP/anothertests/bisect/test-bisect.t
1343 --- $TESTTMP/anothertests/bisect/test-bisect.t
1339 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1344 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1340 @@ -1,4 +1,4 @@
1345 @@ -1,4 +1,4 @@
1341 $ echo pass
1346 $ echo pass
1342 pass
1347 pass
1343 $ echo pass
1348 $ echo pass
1344 - fail
1349 - fail
1345 + pass
1350 + pass
1346
1351
1347 ERROR: test-bisect.t output changed
1352 ERROR: test-bisect.t output changed
1348 !
1353 !
1349 Failed test-bisect.t: output changed
1354 Failed test-bisect.t: output changed
1350 test-bisect.t broken by 72cbf122d116 (bad)
1355 test-bisect.t broken by 72cbf122d116 (bad)
1351 # Ran 1 tests, 0 skipped, 1 failed.
1356 # Ran 1 tests, 0 skipped, 1 failed.
1352 python hash seed: * (glob)
1357 python hash seed: * (glob)
1353 [1]
1358 [1]
1354
1359
1355 $ cd ..
1360 $ cd ..
1356
1361
1357 support bisecting a separate repo
1362 support bisecting a separate repo
1358
1363
1359 $ hg init bisect-dependent
1364 $ hg init bisect-dependent
1360 $ cd bisect-dependent
1365 $ cd bisect-dependent
1361 $ cat > test-bisect-dependent.t <<EOF
1366 $ cat > test-bisect-dependent.t <<EOF
1362 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1367 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1363 > pass
1368 > pass
1364 > EOF
1369 > EOF
1365 $ hg commit -Am dependent test-bisect-dependent.t
1370 $ hg commit -Am dependent test-bisect-dependent.t
1366
1371
1367 $ rt --known-good-rev=0 test-bisect-dependent.t
1372 $ rt --known-good-rev=0 test-bisect-dependent.t
1368
1373
1369 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1374 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1370 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1375 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1371 @@ -1,2 +1,2 @@
1376 @@ -1,2 +1,2 @@
1372 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1377 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1373 - pass
1378 - pass
1374 + fail
1379 + fail
1375
1380
1376 ERROR: test-bisect-dependent.t output changed
1381 ERROR: test-bisect-dependent.t output changed
1377 !
1382 !
1378 Failed test-bisect-dependent.t: output changed
1383 Failed test-bisect-dependent.t: output changed
1379 Failed to identify failure point for test-bisect-dependent.t
1384 Failed to identify failure point for test-bisect-dependent.t
1380 # Ran 1 tests, 0 skipped, 1 failed.
1385 # Ran 1 tests, 0 skipped, 1 failed.
1381 python hash seed: * (glob)
1386 python hash seed: * (glob)
1382 [1]
1387 [1]
1383
1388
1384 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1389 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1385 usage: run-tests.py [options] [tests]
1390 usage: run-tests.py [options] [tests]
1386 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1391 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1387 [2]
1392 [2]
1388
1393
1389 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1394 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1390
1395
1391 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1396 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1392 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1397 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1393 @@ -1,2 +1,2 @@
1398 @@ -1,2 +1,2 @@
1394 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1399 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1395 - pass
1400 - pass
1396 + fail
1401 + fail
1397
1402
1398 ERROR: test-bisect-dependent.t output changed
1403 ERROR: test-bisect-dependent.t output changed
1399 !
1404 !
1400 Failed test-bisect-dependent.t: output changed
1405 Failed test-bisect-dependent.t: output changed
1401 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1406 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1402 # Ran 1 tests, 0 skipped, 1 failed.
1407 # Ran 1 tests, 0 skipped, 1 failed.
1403 python hash seed: * (glob)
1408 python hash seed: * (glob)
1404 [1]
1409 [1]
1405
1410
1406 $ cd ..
1411 $ cd ..
1407
1412
1408 Test a broken #if statement doesn't break run-tests threading.
1413 Test a broken #if statement doesn't break run-tests threading.
1409 ==============================================================
1414 ==============================================================
1410 $ mkdir broken
1415 $ mkdir broken
1411 $ cd broken
1416 $ cd broken
1412 $ cat > test-broken.t <<EOF
1417 $ cat > test-broken.t <<EOF
1413 > true
1418 > true
1414 > #if notarealhghavefeature
1419 > #if notarealhghavefeature
1415 > $ false
1420 > $ false
1416 > #endif
1421 > #endif
1417 > EOF
1422 > EOF
1418 $ for f in 1 2 3 4 ; do
1423 $ for f in 1 2 3 4 ; do
1419 > cat > test-works-$f.t <<EOF
1424 > cat > test-works-$f.t <<EOF
1420 > This is test case $f
1425 > This is test case $f
1421 > $ sleep 1
1426 > $ sleep 1
1422 > EOF
1427 > EOF
1423 > done
1428 > done
1424 $ rt -j 2
1429 $ rt -j 2
1425 ....
1430 ....
1426 # Ran 5 tests, 0 skipped, 0 failed.
1431 # Ran 5 tests, 0 skipped, 0 failed.
1427 skipped: unknown feature: notarealhghavefeature
1432 skipped: unknown feature: notarealhghavefeature
1428
1433
1429 $ cd ..
1434 $ cd ..
1430 $ rm -rf broken
1435 $ rm -rf broken
1431
1436
1432 Test cases in .t files
1437 Test cases in .t files
1433 ======================
1438 ======================
1434 $ mkdir cases
1439 $ mkdir cases
1435 $ cd cases
1440 $ cd cases
1436 $ cat > test-cases-abc.t <<'EOF'
1441 $ cat > test-cases-abc.t <<'EOF'
1437 > #testcases A B C
1442 > #testcases A B C
1438 > $ V=B
1443 > $ V=B
1439 > #if A
1444 > #if A
1440 > $ V=A
1445 > $ V=A
1441 > #endif
1446 > #endif
1442 > #if C
1447 > #if C
1443 > $ V=C
1448 > $ V=C
1444 > #endif
1449 > #endif
1445 > $ echo $V | sed 's/A/C/'
1450 > $ echo $V | sed 's/A/C/'
1446 > C
1451 > C
1447 > #if C
1452 > #if C
1448 > $ [ $V = C ]
1453 > $ [ $V = C ]
1449 > #endif
1454 > #endif
1450 > #if A
1455 > #if A
1451 > $ [ $V = C ]
1456 > $ [ $V = C ]
1452 > [1]
1457 > [1]
1453 > #endif
1458 > #endif
1454 > #if no-C
1459 > #if no-C
1455 > $ [ $V = C ]
1460 > $ [ $V = C ]
1456 > [1]
1461 > [1]
1457 > #endif
1462 > #endif
1458 > $ [ $V = D ]
1463 > $ [ $V = D ]
1459 > [1]
1464 > [1]
1460 > EOF
1465 > EOF
1461 $ rt
1466 $ rt
1462 .
1467 .
1463 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1468 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1464 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1469 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1465 @@ -7,7 +7,7 @@
1470 @@ -7,7 +7,7 @@
1466 $ V=C
1471 $ V=C
1467 #endif
1472 #endif
1468 $ echo $V | sed 's/A/C/'
1473 $ echo $V | sed 's/A/C/'
1469 - C
1474 - C
1470 + B
1475 + B
1471 #if C
1476 #if C
1472 $ [ $V = C ]
1477 $ [ $V = C ]
1473 #endif
1478 #endif
1474
1479
1475 ERROR: test-cases-abc.t (case B) output changed
1480 ERROR: test-cases-abc.t (case B) output changed
1476 !.
1481 !.
1477 Failed test-cases-abc.t (case B): output changed
1482 Failed test-cases-abc.t (case B): output changed
1478 # Ran 3 tests, 0 skipped, 1 failed.
1483 # Ran 3 tests, 0 skipped, 1 failed.
1479 python hash seed: * (glob)
1484 python hash seed: * (glob)
1480 [1]
1485 [1]
1481
1486
1482 --restart works
1487 --restart works
1483
1488
1484 $ rt --restart
1489 $ rt --restart
1485
1490
1486 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1491 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1487 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1492 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1488 @@ -7,7 +7,7 @@
1493 @@ -7,7 +7,7 @@
1489 $ V=C
1494 $ V=C
1490 #endif
1495 #endif
1491 $ echo $V | sed 's/A/C/'
1496 $ echo $V | sed 's/A/C/'
1492 - C
1497 - C
1493 + B
1498 + B
1494 #if C
1499 #if C
1495 $ [ $V = C ]
1500 $ [ $V = C ]
1496 #endif
1501 #endif
1497
1502
1498 ERROR: test-cases-abc.t (case B) output changed
1503 ERROR: test-cases-abc.t (case B) output changed
1499 !.
1504 !.
1500 Failed test-cases-abc.t (case B): output changed
1505 Failed test-cases-abc.t (case B): output changed
1501 # Ran 2 tests, 0 skipped, 1 failed.
1506 # Ran 2 tests, 0 skipped, 1 failed.
1502 python hash seed: * (glob)
1507 python hash seed: * (glob)
1503 [1]
1508 [1]
1504
1509
1505 --restart works with outputdir
1510 --restart works with outputdir
1506
1511
1507 $ mkdir output
1512 $ mkdir output
1508 $ mv test-cases-abc.t.B.err output
1513 $ mv test-cases-abc.t.B.err output
1509 $ rt --restart --outputdir output
1514 $ rt --restart --outputdir output
1510
1515
1511 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1516 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1512 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
1517 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
1513 @@ -7,7 +7,7 @@
1518 @@ -7,7 +7,7 @@
1514 $ V=C
1519 $ V=C
1515 #endif
1520 #endif
1516 $ echo $V | sed 's/A/C/'
1521 $ echo $V | sed 's/A/C/'
1517 - C
1522 - C
1518 + B
1523 + B
1519 #if C
1524 #if C
1520 $ [ $V = C ]
1525 $ [ $V = C ]
1521 #endif
1526 #endif
1522
1527
1523 ERROR: test-cases-abc.t (case B) output changed
1528 ERROR: test-cases-abc.t (case B) output changed
1524 !.
1529 !.
1525 Failed test-cases-abc.t (case B): output changed
1530 Failed test-cases-abc.t (case B): output changed
1526 # Ran 2 tests, 0 skipped, 1 failed.
1531 # Ran 2 tests, 0 skipped, 1 failed.
1527 python hash seed: * (glob)
1532 python hash seed: * (glob)
1528 [1]
1533 [1]
1529
1534
1530 Test automatic pattern replacement
1535 Test automatic pattern replacement
1531
1536
1532 $ cat << EOF >> common-pattern.py
1537 $ cat << EOF >> common-pattern.py
1533 > substitutions = [
1538 > substitutions = [
1534 > (br'foo-(.*)\\b',
1539 > (br'foo-(.*)\\b',
1535 > br'\$XXX=\\1\$'),
1540 > br'\$XXX=\\1\$'),
1536 > (br'bar\\n',
1541 > (br'bar\\n',
1537 > br'\$YYY$\\n'),
1542 > br'\$YYY$\\n'),
1538 > ]
1543 > ]
1539 > EOF
1544 > EOF
1540
1545
1541 $ cat << EOF >> test-substitution.t
1546 $ cat << EOF >> test-substitution.t
1542 > $ echo foo-12
1547 > $ echo foo-12
1543 > \$XXX=12$
1548 > \$XXX=12$
1544 > $ echo foo-42
1549 > $ echo foo-42
1545 > \$XXX=42$
1550 > \$XXX=42$
1546 > $ echo bar prior
1551 > $ echo bar prior
1547 > bar prior
1552 > bar prior
1548 > $ echo lastbar
1553 > $ echo lastbar
1549 > last\$YYY$
1554 > last\$YYY$
1550 > $ echo foo-bar foo-baz
1555 > $ echo foo-bar foo-baz
1551 > EOF
1556 > EOF
1552
1557
1553 $ rt test-substitution.t
1558 $ rt test-substitution.t
1554
1559
1555 --- $TESTTMP/anothertests/cases/test-substitution.t
1560 --- $TESTTMP/anothertests/cases/test-substitution.t
1556 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1561 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1557 @@ -7,3 +7,4 @@
1562 @@ -7,3 +7,4 @@
1558 $ echo lastbar
1563 $ echo lastbar
1559 last$YYY$
1564 last$YYY$
1560 $ echo foo-bar foo-baz
1565 $ echo foo-bar foo-baz
1561 + $XXX=bar foo-baz$
1566 + $XXX=bar foo-baz$
1562
1567
1563 ERROR: test-substitution.t output changed
1568 ERROR: test-substitution.t output changed
1564 !
1569 !
1565 Failed test-substitution.t: output changed
1570 Failed test-substitution.t: output changed
1566 # Ran 1 tests, 0 skipped, 1 failed.
1571 # Ran 1 tests, 0 skipped, 1 failed.
1567 python hash seed: * (glob)
1572 python hash seed: * (glob)
1568 [1]
1573 [1]
1569
1574
1570 --extra-config-opt works
1575 --extra-config-opt works
1571
1576
1572 $ cat << EOF >> test-config-opt.t
1577 $ cat << EOF >> test-config-opt.t
1573 > $ hg init test-config-opt
1578 > $ hg init test-config-opt
1574 > $ hg -R test-config-opt purge
1579 > $ hg -R test-config-opt purge
1575 > EOF
1580 > EOF
1576
1581
1577 $ rt --extra-config-opt extensions.purge= test-config-opt.t
1582 $ rt --extra-config-opt extensions.purge= test-config-opt.t
1578 .
1583 .
1579 # Ran 1 tests, 0 skipped, 0 failed.
1584 # Ran 1 tests, 0 skipped, 0 failed.
General Comments 0
You need to be logged in to leave comments. Login now