##// END OF EJS Templates
tests: avoid echo with backslash escapes...
Martin von Zweigbergk -
r35417:417fa230 default
parent child Browse files
Show More
@@ -1,1583 +1,1585
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
683 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
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
695 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
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 $ cat >> test-failure.t <<EOF
707 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
707 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
708 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
708 > saved backup bundle to \$TESTTMP/foo.hg
709 $ echo " saved backup bundle to \$TESTTMP\\foo.hg" >> test-failure.t
709 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
710 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
710 > saved backup bundle to $TESTTMP\\foo.hg
711 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
711 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
712 > saved backup bundle to \$TESTTMP/*.hg (glob)
713 > EOF
712 $ echo 'y' | rt -i 2>&1
714 $ echo 'y' | rt -i 2>&1
713
715
714 --- $TESTTMP/test-failure.t
716 --- $TESTTMP/test-failure.t
715 +++ $TESTTMP/test-failure.t.err
717 +++ $TESTTMP/test-failure.t.err
716 @@ -1,5 +1,5 @@
718 @@ -1,5 +1,5 @@
717 $ echo babar
719 $ echo babar
718 - rataxes
720 - rataxes
719 + babar
721 + babar
720 This is a noop statement so that
722 This is a noop statement so that
721 this test is still more bytes than success.
723 this test is still more bytes than success.
722 pad pad pad pad............................................................
724 pad pad pad pad............................................................
723 @@ -11,6 +11,6 @@
725 @@ -11,6 +11,6 @@
724 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
726 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
725 saved backup bundle to $TESTTMP/foo.hg
727 saved backup bundle to $TESTTMP/foo.hg
726 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
728 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
727 - saved backup bundle to $TESTTMP\foo.hg
729 - saved backup bundle to $TESTTMP\foo.hg
728 + saved backup bundle to $TESTTMP/foo.hg
730 + saved backup bundle to $TESTTMP/foo.hg
729 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
731 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
730 saved backup bundle to $TESTTMP/*.hg (glob)
732 saved backup bundle to $TESTTMP/*.hg (glob)
731 Accept this change? [n] ..
733 Accept this change? [n] ..
732 # Ran 2 tests, 0 skipped, 0 failed.
734 # Ran 2 tests, 0 skipped, 0 failed.
733
735
734 $ sed -e 's,(glob)$,&<,g' test-failure.t
736 $ sed -e 's,(glob)$,&<,g' test-failure.t
735 $ echo babar
737 $ echo babar
736 babar
738 babar
737 This is a noop statement so that
739 This is a noop statement so that
738 this test is still more bytes than success.
740 this test is still more bytes than success.
739 pad pad pad pad............................................................
741 pad pad pad pad............................................................
740 pad pad pad pad............................................................
742 pad pad pad pad............................................................
741 pad pad pad pad............................................................
743 pad pad pad pad............................................................
742 pad pad pad pad............................................................
744 pad pad pad pad............................................................
743 pad pad pad pad............................................................
745 pad pad pad pad............................................................
744 pad pad pad pad............................................................
746 pad pad pad pad............................................................
745 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
747 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
746 saved backup bundle to $TESTTMP/foo.hg
748 saved backup bundle to $TESTTMP/foo.hg
747 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
749 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
748 saved backup bundle to $TESTTMP/foo.hg
750 saved backup bundle to $TESTTMP/foo.hg
749 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
751 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
750 saved backup bundle to $TESTTMP/*.hg (glob)<
752 saved backup bundle to $TESTTMP/*.hg (glob)<
751
753
752 Race condition - test file was modified when test is running
754 Race condition - test file was modified when test is running
753
755
754 $ TESTRACEDIR=`pwd`
756 $ TESTRACEDIR=`pwd`
755 $ export TESTRACEDIR
757 $ export TESTRACEDIR
756 $ cat > test-race.t <<EOF
758 $ cat > test-race.t <<EOF
757 > $ echo 1
759 > $ echo 1
758 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
760 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
759 > EOF
761 > EOF
760
762
761 $ rt -i test-race.t
763 $ rt -i test-race.t
762
764
763 --- $TESTTMP/test-race.t
765 --- $TESTTMP/test-race.t
764 +++ $TESTTMP/test-race.t.err
766 +++ $TESTTMP/test-race.t.err
765 @@ -1,2 +1,3 @@
767 @@ -1,2 +1,3 @@
766 $ echo 1
768 $ echo 1
767 + 1
769 + 1
768 $ echo "# a new line" >> $TESTTMP/test-race.t
770 $ echo "# a new line" >> $TESTTMP/test-race.t
769 Reference output has changed (run again to prompt changes)
771 Reference output has changed (run again to prompt changes)
770 ERROR: test-race.t output changed
772 ERROR: test-race.t output changed
771 !
773 !
772 Failed test-race.t: output changed
774 Failed test-race.t: output changed
773 # Ran 1 tests, 0 skipped, 1 failed.
775 # Ran 1 tests, 0 skipped, 1 failed.
774 python hash seed: * (glob)
776 python hash seed: * (glob)
775 [1]
777 [1]
776
778
777 $ rm test-race.t
779 $ rm test-race.t
778
780
779 When "#testcases" is used in .t files
781 When "#testcases" is used in .t files
780
782
781 $ cat >> test-cases.t <<EOF
783 $ cat >> test-cases.t <<EOF
782 > #testcases a b
784 > #testcases a b
783 > #if a
785 > #if a
784 > $ echo 1
786 > $ echo 1
785 > #endif
787 > #endif
786 > #if b
788 > #if b
787 > $ echo 2
789 > $ echo 2
788 > #endif
790 > #endif
789 > EOF
791 > EOF
790
792
791 $ cat <<EOF | rt -i test-cases.t 2>&1
793 $ cat <<EOF | rt -i test-cases.t 2>&1
792 > y
794 > y
793 > y
795 > y
794 > EOF
796 > EOF
795
797
796 --- $TESTTMP/test-cases.t
798 --- $TESTTMP/test-cases.t
797 +++ $TESTTMP/test-cases.t.a.err
799 +++ $TESTTMP/test-cases.t.a.err
798 @@ -1,6 +1,7 @@
800 @@ -1,6 +1,7 @@
799 #testcases a b
801 #testcases a b
800 #if a
802 #if a
801 $ echo 1
803 $ echo 1
802 + 1
804 + 1
803 #endif
805 #endif
804 #if b
806 #if b
805 $ echo 2
807 $ echo 2
806 Accept this change? [n] .
808 Accept this change? [n] .
807 --- $TESTTMP/test-cases.t
809 --- $TESTTMP/test-cases.t
808 +++ $TESTTMP/test-cases.t.b.err
810 +++ $TESTTMP/test-cases.t.b.err
809 @@ -5,4 +5,5 @@
811 @@ -5,4 +5,5 @@
810 #endif
812 #endif
811 #if b
813 #if b
812 $ echo 2
814 $ echo 2
813 + 2
815 + 2
814 #endif
816 #endif
815 Accept this change? [n] .
817 Accept this change? [n] .
816 # Ran 2 tests, 0 skipped, 0 failed.
818 # Ran 2 tests, 0 skipped, 0 failed.
817
819
818 $ cat test-cases.t
820 $ cat test-cases.t
819 #testcases a b
821 #testcases a b
820 #if a
822 #if a
821 $ echo 1
823 $ echo 1
822 1
824 1
823 #endif
825 #endif
824 #if b
826 #if b
825 $ echo 2
827 $ echo 2
826 2
828 2
827 #endif
829 #endif
828
830
829 $ cat >> test-cases.t <<'EOF'
831 $ cat >> test-cases.t <<'EOF'
830 > #if a
832 > #if a
831 > $ NAME=A
833 > $ NAME=A
832 > #else
834 > #else
833 > $ NAME=B
835 > $ NAME=B
834 > #endif
836 > #endif
835 > $ echo $NAME
837 > $ echo $NAME
836 > A (a !)
838 > A (a !)
837 > B (b !)
839 > B (b !)
838 > EOF
840 > EOF
839 $ rt test-cases.t
841 $ rt test-cases.t
840 ..
842 ..
841 # Ran 2 tests, 0 skipped, 0 failed.
843 # Ran 2 tests, 0 skipped, 0 failed.
842
844
843 $ rm test-cases.t
845 $ rm test-cases.t
844
846
845 (reinstall)
847 (reinstall)
846 $ mv backup test-failure.t
848 $ mv backup test-failure.t
847
849
848 No Diff
850 No Diff
849 ===============
851 ===============
850
852
851 $ rt --nodiff
853 $ rt --nodiff
852 !.
854 !.
853 Failed test-failure.t: output changed
855 Failed test-failure.t: output changed
854 # Ran 2 tests, 0 skipped, 1 failed.
856 # Ran 2 tests, 0 skipped, 1 failed.
855 python hash seed: * (glob)
857 python hash seed: * (glob)
856 [1]
858 [1]
857
859
858 test --tmpdir support
860 test --tmpdir support
859 $ rt --tmpdir=$TESTTMP/keep test-success.t
861 $ rt --tmpdir=$TESTTMP/keep test-success.t
860
862
861 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
863 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
862 Keeping threadtmp dir: $TESTTMP/keep/child1
864 Keeping threadtmp dir: $TESTTMP/keep/child1
863 .
865 .
864 # Ran 1 tests, 0 skipped, 0 failed.
866 # Ran 1 tests, 0 skipped, 0 failed.
865
867
866 timeouts
868 timeouts
867 ========
869 ========
868 $ cat > test-timeout.t <<EOF
870 $ cat > test-timeout.t <<EOF
869 > $ sleep 2
871 > $ sleep 2
870 > $ echo pass
872 > $ echo pass
871 > pass
873 > pass
872 > EOF
874 > EOF
873 > echo '#require slow' > test-slow-timeout.t
875 > echo '#require slow' > test-slow-timeout.t
874 > cat test-timeout.t >> test-slow-timeout.t
876 > cat test-timeout.t >> test-slow-timeout.t
875 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
877 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
876 st
878 st
877 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
879 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
878 Failed test-timeout.t: timed out
880 Failed test-timeout.t: timed out
879 # Ran 1 tests, 1 skipped, 1 failed.
881 # Ran 1 tests, 1 skipped, 1 failed.
880 python hash seed: * (glob)
882 python hash seed: * (glob)
881 [1]
883 [1]
882 $ rt --timeout=1 --slowtimeout=3 \
884 $ rt --timeout=1 --slowtimeout=3 \
883 > test-timeout.t test-slow-timeout.t --allow-slow-tests
885 > test-timeout.t test-slow-timeout.t --allow-slow-tests
884 .t
886 .t
885 Failed test-timeout.t: timed out
887 Failed test-timeout.t: timed out
886 # Ran 2 tests, 0 skipped, 1 failed.
888 # Ran 2 tests, 0 skipped, 1 failed.
887 python hash seed: * (glob)
889 python hash seed: * (glob)
888 [1]
890 [1]
889 $ rm test-timeout.t test-slow-timeout.t
891 $ rm test-timeout.t test-slow-timeout.t
890
892
891 test for --time
893 test for --time
892 ==================
894 ==================
893
895
894 $ rt test-success.t --time
896 $ rt test-success.t --time
895 .
897 .
896 # Ran 1 tests, 0 skipped, 0 failed.
898 # Ran 1 tests, 0 skipped, 0 failed.
897 # Producing time report
899 # Producing time report
898 start end cuser csys real Test
900 start end cuser csys real Test
899 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
901 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
900
902
901 test for --time with --job enabled
903 test for --time with --job enabled
902 ====================================
904 ====================================
903
905
904 $ rt test-success.t --time --jobs 2
906 $ rt test-success.t --time --jobs 2
905 .
907 .
906 # Ran 1 tests, 0 skipped, 0 failed.
908 # Ran 1 tests, 0 skipped, 0 failed.
907 # Producing time report
909 # Producing time report
908 start end cuser csys real Test
910 start end cuser csys real Test
909 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
911 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
910
912
911 Skips
913 Skips
912 ================
914 ================
913 $ cat > test-skip.t <<EOF
915 $ cat > test-skip.t <<EOF
914 > $ echo xyzzy
916 > $ echo xyzzy
915 > #require false
917 > #require false
916 > EOF
918 > EOF
917 $ rt --nodiff
919 $ rt --nodiff
918 !.s
920 !.s
919 Skipped test-skip.t: missing feature: nail clipper
921 Skipped test-skip.t: missing feature: nail clipper
920 Failed test-failure.t: output changed
922 Failed test-failure.t: output changed
921 # Ran 2 tests, 1 skipped, 1 failed.
923 # Ran 2 tests, 1 skipped, 1 failed.
922 python hash seed: * (glob)
924 python hash seed: * (glob)
923 [1]
925 [1]
924
926
925 $ rt --keyword xyzzy
927 $ rt --keyword xyzzy
926 .s
928 .s
927 Skipped test-skip.t: missing feature: nail clipper
929 Skipped test-skip.t: missing feature: nail clipper
928 # Ran 2 tests, 2 skipped, 0 failed.
930 # Ran 2 tests, 2 skipped, 0 failed.
929
931
930 Skips with xml
932 Skips with xml
931 $ rt --keyword xyzzy \
933 $ rt --keyword xyzzy \
932 > --xunit=xunit.xml
934 > --xunit=xunit.xml
933 .s
935 .s
934 Skipped test-skip.t: missing feature: nail clipper
936 Skipped test-skip.t: missing feature: nail clipper
935 # Ran 2 tests, 2 skipped, 0 failed.
937 # Ran 2 tests, 2 skipped, 0 failed.
936 $ cat xunit.xml
938 $ cat xunit.xml
937 <?xml version="1.0" encoding="utf-8"?>
939 <?xml version="1.0" encoding="utf-8"?>
938 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
940 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
939 <testcase name="test-success.t" time="*"/> (glob)
941 <testcase name="test-success.t" time="*"/> (glob)
940 <testcase name="test-skip.t">
942 <testcase name="test-skip.t">
941 <skipped>
943 <skipped>
942 <![CDATA[missing feature: nail clipper]]> </skipped>
944 <![CDATA[missing feature: nail clipper]]> </skipped>
943 </testcase>
945 </testcase>
944 </testsuite>
946 </testsuite>
945
947
946 Missing skips or blacklisted skips don't count as executed:
948 Missing skips or blacklisted skips don't count as executed:
947 $ echo test-failure.t > blacklist
949 $ echo test-failure.t > blacklist
948 $ rt --blacklist=blacklist --json\
950 $ rt --blacklist=blacklist --json\
949 > test-failure.t test-bogus.t
951 > test-failure.t test-bogus.t
950 ss
952 ss
951 Skipped test-bogus.t: Doesn't exist
953 Skipped test-bogus.t: Doesn't exist
952 Skipped test-failure.t: blacklisted
954 Skipped test-failure.t: blacklisted
953 # Ran 0 tests, 2 skipped, 0 failed.
955 # Ran 0 tests, 2 skipped, 0 failed.
954 $ cat report.json
956 $ cat report.json
955 testreport ={
957 testreport ={
956 "test-bogus.t": {
958 "test-bogus.t": {
957 "result": "skip"
959 "result": "skip"
958 },
960 },
959 "test-failure.t": {
961 "test-failure.t": {
960 "result": "skip"
962 "result": "skip"
961 }
963 }
962 } (no-eol)
964 } (no-eol)
963
965
964 Whitelist trumps blacklist
966 Whitelist trumps blacklist
965 $ echo test-failure.t > whitelist
967 $ echo test-failure.t > whitelist
966 $ rt --blacklist=blacklist --whitelist=whitelist --json\
968 $ rt --blacklist=blacklist --whitelist=whitelist --json\
967 > test-failure.t test-bogus.t
969 > test-failure.t test-bogus.t
968 s
970 s
969 --- $TESTTMP/test-failure.t
971 --- $TESTTMP/test-failure.t
970 +++ $TESTTMP/test-failure.t.err
972 +++ $TESTTMP/test-failure.t.err
971 @@ -1,5 +1,5 @@
973 @@ -1,5 +1,5 @@
972 $ echo babar
974 $ echo babar
973 - rataxes
975 - rataxes
974 + babar
976 + babar
975 This is a noop statement so that
977 This is a noop statement so that
976 this test is still more bytes than success.
978 this test is still more bytes than success.
977 pad pad pad pad............................................................
979 pad pad pad pad............................................................
978
980
979 ERROR: test-failure.t output changed
981 ERROR: test-failure.t output changed
980 !
982 !
981 Skipped test-bogus.t: Doesn't exist
983 Skipped test-bogus.t: Doesn't exist
982 Failed test-failure.t: output changed
984 Failed test-failure.t: output changed
983 # Ran 1 tests, 1 skipped, 1 failed.
985 # Ran 1 tests, 1 skipped, 1 failed.
984 python hash seed: * (glob)
986 python hash seed: * (glob)
985 [1]
987 [1]
986
988
987 Ensure that --test-list causes only the tests listed in that file to
989 Ensure that --test-list causes only the tests listed in that file to
988 be executed.
990 be executed.
989 $ echo test-success.t >> onlytest
991 $ echo test-success.t >> onlytest
990 $ rt --test-list=onlytest
992 $ rt --test-list=onlytest
991 .
993 .
992 # Ran 1 tests, 0 skipped, 0 failed.
994 # Ran 1 tests, 0 skipped, 0 failed.
993 $ echo test-bogus.t >> anothertest
995 $ echo test-bogus.t >> anothertest
994 $ rt --test-list=onlytest --test-list=anothertest
996 $ rt --test-list=onlytest --test-list=anothertest
995 s.
997 s.
996 Skipped test-bogus.t: Doesn't exist
998 Skipped test-bogus.t: Doesn't exist
997 # Ran 1 tests, 1 skipped, 0 failed.
999 # Ran 1 tests, 1 skipped, 0 failed.
998 $ rm onlytest anothertest
1000 $ rm onlytest anothertest
999
1001
1000 test for --json
1002 test for --json
1001 ==================
1003 ==================
1002
1004
1003 $ rt --json
1005 $ rt --json
1004
1006
1005 --- $TESTTMP/test-failure.t
1007 --- $TESTTMP/test-failure.t
1006 +++ $TESTTMP/test-failure.t.err
1008 +++ $TESTTMP/test-failure.t.err
1007 @@ -1,5 +1,5 @@
1009 @@ -1,5 +1,5 @@
1008 $ echo babar
1010 $ echo babar
1009 - rataxes
1011 - rataxes
1010 + babar
1012 + babar
1011 This is a noop statement so that
1013 This is a noop statement so that
1012 this test is still more bytes than success.
1014 this test is still more bytes than success.
1013 pad pad pad pad............................................................
1015 pad pad pad pad............................................................
1014
1016
1015 ERROR: test-failure.t output changed
1017 ERROR: test-failure.t output changed
1016 !.s
1018 !.s
1017 Skipped test-skip.t: missing feature: nail clipper
1019 Skipped test-skip.t: missing feature: nail clipper
1018 Failed test-failure.t: output changed
1020 Failed test-failure.t: output changed
1019 # Ran 2 tests, 1 skipped, 1 failed.
1021 # Ran 2 tests, 1 skipped, 1 failed.
1020 python hash seed: * (glob)
1022 python hash seed: * (glob)
1021 [1]
1023 [1]
1022
1024
1023 $ cat report.json
1025 $ cat report.json
1024 testreport ={
1026 testreport ={
1025 "test-failure.t": [\{] (re)
1027 "test-failure.t": [\{] (re)
1026 "csys": "\s*[\d\.]{4,5}", ? (re)
1028 "csys": "\s*[\d\.]{4,5}", ? (re)
1027 "cuser": "\s*[\d\.]{4,5}", ? (re)
1029 "cuser": "\s*[\d\.]{4,5}", ? (re)
1028 "diff": "---.+\+\+\+.+", ? (re)
1030 "diff": "---.+\+\+\+.+", ? (re)
1029 "end": "\s*[\d\.]{4,5}", ? (re)
1031 "end": "\s*[\d\.]{4,5}", ? (re)
1030 "result": "failure", ? (re)
1032 "result": "failure", ? (re)
1031 "start": "\s*[\d\.]{4,5}", ? (re)
1033 "start": "\s*[\d\.]{4,5}", ? (re)
1032 "time": "\s*[\d\.]{4,5}" (re)
1034 "time": "\s*[\d\.]{4,5}" (re)
1033 }, ? (re)
1035 }, ? (re)
1034 "test-skip.t": {
1036 "test-skip.t": {
1035 "csys": "\s*[\d\.]{4,5}", ? (re)
1037 "csys": "\s*[\d\.]{4,5}", ? (re)
1036 "cuser": "\s*[\d\.]{4,5}", ? (re)
1038 "cuser": "\s*[\d\.]{4,5}", ? (re)
1037 "diff": "", ? (re)
1039 "diff": "", ? (re)
1038 "end": "\s*[\d\.]{4,5}", ? (re)
1040 "end": "\s*[\d\.]{4,5}", ? (re)
1039 "result": "skip", ? (re)
1041 "result": "skip", ? (re)
1040 "start": "\s*[\d\.]{4,5}", ? (re)
1042 "start": "\s*[\d\.]{4,5}", ? (re)
1041 "time": "\s*[\d\.]{4,5}" (re)
1043 "time": "\s*[\d\.]{4,5}" (re)
1042 }, ? (re)
1044 }, ? (re)
1043 "test-success.t": [\{] (re)
1045 "test-success.t": [\{] (re)
1044 "csys": "\s*[\d\.]{4,5}", ? (re)
1046 "csys": "\s*[\d\.]{4,5}", ? (re)
1045 "cuser": "\s*[\d\.]{4,5}", ? (re)
1047 "cuser": "\s*[\d\.]{4,5}", ? (re)
1046 "diff": "", ? (re)
1048 "diff": "", ? (re)
1047 "end": "\s*[\d\.]{4,5}", ? (re)
1049 "end": "\s*[\d\.]{4,5}", ? (re)
1048 "result": "success", ? (re)
1050 "result": "success", ? (re)
1049 "start": "\s*[\d\.]{4,5}", ? (re)
1051 "start": "\s*[\d\.]{4,5}", ? (re)
1050 "time": "\s*[\d\.]{4,5}" (re)
1052 "time": "\s*[\d\.]{4,5}" (re)
1051 }
1053 }
1052 } (no-eol)
1054 } (no-eol)
1053 --json with --outputdir
1055 --json with --outputdir
1054
1056
1055 $ rm report.json
1057 $ rm report.json
1056 $ rm -r output
1058 $ rm -r output
1057 $ mkdir output
1059 $ mkdir output
1058 $ rt --json --outputdir output
1060 $ rt --json --outputdir output
1059
1061
1060 --- $TESTTMP/test-failure.t
1062 --- $TESTTMP/test-failure.t
1061 +++ $TESTTMP/output/test-failure.t.err
1063 +++ $TESTTMP/output/test-failure.t.err
1062 @@ -1,5 +1,5 @@
1064 @@ -1,5 +1,5 @@
1063 $ echo babar
1065 $ echo babar
1064 - rataxes
1066 - rataxes
1065 + babar
1067 + babar
1066 This is a noop statement so that
1068 This is a noop statement so that
1067 this test is still more bytes than success.
1069 this test is still more bytes than success.
1068 pad pad pad pad............................................................
1070 pad pad pad pad............................................................
1069
1071
1070 ERROR: test-failure.t output changed
1072 ERROR: test-failure.t output changed
1071 !.s
1073 !.s
1072 Skipped test-skip.t: missing feature: nail clipper
1074 Skipped test-skip.t: missing feature: nail clipper
1073 Failed test-failure.t: output changed
1075 Failed test-failure.t: output changed
1074 # Ran 2 tests, 1 skipped, 1 failed.
1076 # Ran 2 tests, 1 skipped, 1 failed.
1075 python hash seed: * (glob)
1077 python hash seed: * (glob)
1076 [1]
1078 [1]
1077 $ f report.json
1079 $ f report.json
1078 report.json: file not found
1080 report.json: file not found
1079 $ cat output/report.json
1081 $ cat output/report.json
1080 testreport ={
1082 testreport ={
1081 "test-failure.t": [\{] (re)
1083 "test-failure.t": [\{] (re)
1082 "csys": "\s*[\d\.]{4,5}", ? (re)
1084 "csys": "\s*[\d\.]{4,5}", ? (re)
1083 "cuser": "\s*[\d\.]{4,5}", ? (re)
1085 "cuser": "\s*[\d\.]{4,5}", ? (re)
1084 "diff": "---.+\+\+\+.+", ? (re)
1086 "diff": "---.+\+\+\+.+", ? (re)
1085 "end": "\s*[\d\.]{4,5}", ? (re)
1087 "end": "\s*[\d\.]{4,5}", ? (re)
1086 "result": "failure", ? (re)
1088 "result": "failure", ? (re)
1087 "start": "\s*[\d\.]{4,5}", ? (re)
1089 "start": "\s*[\d\.]{4,5}", ? (re)
1088 "time": "\s*[\d\.]{4,5}" (re)
1090 "time": "\s*[\d\.]{4,5}" (re)
1089 }, ? (re)
1091 }, ? (re)
1090 "test-skip.t": {
1092 "test-skip.t": {
1091 "csys": "\s*[\d\.]{4,5}", ? (re)
1093 "csys": "\s*[\d\.]{4,5}", ? (re)
1092 "cuser": "\s*[\d\.]{4,5}", ? (re)
1094 "cuser": "\s*[\d\.]{4,5}", ? (re)
1093 "diff": "", ? (re)
1095 "diff": "", ? (re)
1094 "end": "\s*[\d\.]{4,5}", ? (re)
1096 "end": "\s*[\d\.]{4,5}", ? (re)
1095 "result": "skip", ? (re)
1097 "result": "skip", ? (re)
1096 "start": "\s*[\d\.]{4,5}", ? (re)
1098 "start": "\s*[\d\.]{4,5}", ? (re)
1097 "time": "\s*[\d\.]{4,5}" (re)
1099 "time": "\s*[\d\.]{4,5}" (re)
1098 }, ? (re)
1100 }, ? (re)
1099 "test-success.t": [\{] (re)
1101 "test-success.t": [\{] (re)
1100 "csys": "\s*[\d\.]{4,5}", ? (re)
1102 "csys": "\s*[\d\.]{4,5}", ? (re)
1101 "cuser": "\s*[\d\.]{4,5}", ? (re)
1103 "cuser": "\s*[\d\.]{4,5}", ? (re)
1102 "diff": "", ? (re)
1104 "diff": "", ? (re)
1103 "end": "\s*[\d\.]{4,5}", ? (re)
1105 "end": "\s*[\d\.]{4,5}", ? (re)
1104 "result": "success", ? (re)
1106 "result": "success", ? (re)
1105 "start": "\s*[\d\.]{4,5}", ? (re)
1107 "start": "\s*[\d\.]{4,5}", ? (re)
1106 "time": "\s*[\d\.]{4,5}" (re)
1108 "time": "\s*[\d\.]{4,5}" (re)
1107 }
1109 }
1108 } (no-eol)
1110 } (no-eol)
1109 $ ls -a output
1111 $ ls -a output
1110 .
1112 .
1111 ..
1113 ..
1112 .testtimes
1114 .testtimes
1113 report.json
1115 report.json
1114 test-failure.t.err
1116 test-failure.t.err
1115
1117
1116 Test that failed test accepted through interactive are properly reported:
1118 Test that failed test accepted through interactive are properly reported:
1117
1119
1118 $ cp test-failure.t backup
1120 $ cp test-failure.t backup
1119 $ echo y | rt --json -i
1121 $ echo y | rt --json -i
1120
1122
1121 --- $TESTTMP/test-failure.t
1123 --- $TESTTMP/test-failure.t
1122 +++ $TESTTMP/test-failure.t.err
1124 +++ $TESTTMP/test-failure.t.err
1123 @@ -1,5 +1,5 @@
1125 @@ -1,5 +1,5 @@
1124 $ echo babar
1126 $ echo babar
1125 - rataxes
1127 - rataxes
1126 + babar
1128 + babar
1127 This is a noop statement so that
1129 This is a noop statement so that
1128 this test is still more bytes than success.
1130 this test is still more bytes than success.
1129 pad pad pad pad............................................................
1131 pad pad pad pad............................................................
1130 Accept this change? [n] ..s
1132 Accept this change? [n] ..s
1131 Skipped test-skip.t: missing feature: nail clipper
1133 Skipped test-skip.t: missing feature: nail clipper
1132 # Ran 2 tests, 1 skipped, 0 failed.
1134 # Ran 2 tests, 1 skipped, 0 failed.
1133
1135
1134 $ cat report.json
1136 $ cat report.json
1135 testreport ={
1137 testreport ={
1136 "test-failure.t": [\{] (re)
1138 "test-failure.t": [\{] (re)
1137 "csys": "\s*[\d\.]{4,5}", ? (re)
1139 "csys": "\s*[\d\.]{4,5}", ? (re)
1138 "cuser": "\s*[\d\.]{4,5}", ? (re)
1140 "cuser": "\s*[\d\.]{4,5}", ? (re)
1139 "diff": "", ? (re)
1141 "diff": "", ? (re)
1140 "end": "\s*[\d\.]{4,5}", ? (re)
1142 "end": "\s*[\d\.]{4,5}", ? (re)
1141 "result": "success", ? (re)
1143 "result": "success", ? (re)
1142 "start": "\s*[\d\.]{4,5}", ? (re)
1144 "start": "\s*[\d\.]{4,5}", ? (re)
1143 "time": "\s*[\d\.]{4,5}" (re)
1145 "time": "\s*[\d\.]{4,5}" (re)
1144 }, ? (re)
1146 }, ? (re)
1145 "test-skip.t": {
1147 "test-skip.t": {
1146 "csys": "\s*[\d\.]{4,5}", ? (re)
1148 "csys": "\s*[\d\.]{4,5}", ? (re)
1147 "cuser": "\s*[\d\.]{4,5}", ? (re)
1149 "cuser": "\s*[\d\.]{4,5}", ? (re)
1148 "diff": "", ? (re)
1150 "diff": "", ? (re)
1149 "end": "\s*[\d\.]{4,5}", ? (re)
1151 "end": "\s*[\d\.]{4,5}", ? (re)
1150 "result": "skip", ? (re)
1152 "result": "skip", ? (re)
1151 "start": "\s*[\d\.]{4,5}", ? (re)
1153 "start": "\s*[\d\.]{4,5}", ? (re)
1152 "time": "\s*[\d\.]{4,5}" (re)
1154 "time": "\s*[\d\.]{4,5}" (re)
1153 }, ? (re)
1155 }, ? (re)
1154 "test-success.t": [\{] (re)
1156 "test-success.t": [\{] (re)
1155 "csys": "\s*[\d\.]{4,5}", ? (re)
1157 "csys": "\s*[\d\.]{4,5}", ? (re)
1156 "cuser": "\s*[\d\.]{4,5}", ? (re)
1158 "cuser": "\s*[\d\.]{4,5}", ? (re)
1157 "diff": "", ? (re)
1159 "diff": "", ? (re)
1158 "end": "\s*[\d\.]{4,5}", ? (re)
1160 "end": "\s*[\d\.]{4,5}", ? (re)
1159 "result": "success", ? (re)
1161 "result": "success", ? (re)
1160 "start": "\s*[\d\.]{4,5}", ? (re)
1162 "start": "\s*[\d\.]{4,5}", ? (re)
1161 "time": "\s*[\d\.]{4,5}" (re)
1163 "time": "\s*[\d\.]{4,5}" (re)
1162 }
1164 }
1163 } (no-eol)
1165 } (no-eol)
1164 $ mv backup test-failure.t
1166 $ mv backup test-failure.t
1165
1167
1166 backslash on end of line with glob matching is handled properly
1168 backslash on end of line with glob matching is handled properly
1167
1169
1168 $ cat > test-glob-backslash.t << EOF
1170 $ cat > test-glob-backslash.t << EOF
1169 > $ echo 'foo bar \\'
1171 > $ echo 'foo bar \\'
1170 > foo * \ (glob)
1172 > foo * \ (glob)
1171 > EOF
1173 > EOF
1172
1174
1173 $ rt test-glob-backslash.t
1175 $ rt test-glob-backslash.t
1174 .
1176 .
1175 # Ran 1 tests, 0 skipped, 0 failed.
1177 # Ran 1 tests, 0 skipped, 0 failed.
1176
1178
1177 $ rm -f test-glob-backslash.t
1179 $ rm -f test-glob-backslash.t
1178
1180
1179 Test globbing of local IP addresses
1181 Test globbing of local IP addresses
1180 $ echo 172.16.18.1
1182 $ echo 172.16.18.1
1181 $LOCALIP (glob)
1183 $LOCALIP (glob)
1182 $ echo dead:beef::1
1184 $ echo dead:beef::1
1183 $LOCALIP (glob)
1185 $LOCALIP (glob)
1184
1186
1185 Test reusability for third party tools
1187 Test reusability for third party tools
1186 ======================================
1188 ======================================
1187
1189
1188 $ mkdir "$TESTTMP"/anothertests
1190 $ mkdir "$TESTTMP"/anothertests
1189 $ cd "$TESTTMP"/anothertests
1191 $ cd "$TESTTMP"/anothertests
1190
1192
1191 test that `run-tests.py` can execute hghave, even if it runs not in
1193 test that `run-tests.py` can execute hghave, even if it runs not in
1192 Mercurial source tree.
1194 Mercurial source tree.
1193
1195
1194 $ cat > test-hghave.t <<EOF
1196 $ cat > test-hghave.t <<EOF
1195 > #require true
1197 > #require true
1196 > $ echo foo
1198 > $ echo foo
1197 > foo
1199 > foo
1198 > EOF
1200 > EOF
1199 $ rt test-hghave.t
1201 $ rt test-hghave.t
1200 .
1202 .
1201 # Ran 1 tests, 0 skipped, 0 failed.
1203 # Ran 1 tests, 0 skipped, 0 failed.
1202
1204
1203 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1205 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1204 running is placed.
1206 running is placed.
1205
1207
1206 $ cat > test-runtestdir.t <<EOF
1208 $ cat > test-runtestdir.t <<EOF
1207 > - $TESTDIR, in which test-run-tests.t is placed
1209 > - $TESTDIR, in which test-run-tests.t is placed
1208 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1210 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1209 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1211 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1210 >
1212 >
1211 > #if windows
1213 > #if windows
1212 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
1214 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
1213 > #else
1215 > #else
1214 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
1216 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
1215 > #endif
1217 > #endif
1216 > If this prints a path, that means RUNTESTDIR didn't equal
1218 > If this prints a path, that means RUNTESTDIR didn't equal
1217 > TESTDIR as it should have.
1219 > TESTDIR as it should have.
1218 > $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR"
1220 > $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR"
1219 > This should print the start of check-code. If this passes but the
1221 > This should print the start of check-code. If this passes but the
1220 > previous check failed, that means we found a copy of check-code at whatever
1222 > previous check failed, that means we found a copy of check-code at whatever
1221 > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR.
1223 > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR.
1222 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
1224 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
1223 > #!USRBINENVPY
1225 > #!USRBINENVPY
1224 > #
1226 > #
1225 > # check-code - a style and portability checker for Mercurial
1227 > # check-code - a style and portability checker for Mercurial
1226 > EOF
1228 > EOF
1227 $ rt test-runtestdir.t
1229 $ rt test-runtestdir.t
1228 .
1230 .
1229 # Ran 1 tests, 0 skipped, 0 failed.
1231 # Ran 1 tests, 0 skipped, 0 failed.
1230
1232
1231 #if execbit
1233 #if execbit
1232
1234
1233 test that TESTDIR is referred in PATH
1235 test that TESTDIR is referred in PATH
1234
1236
1235 $ cat > custom-command.sh <<EOF
1237 $ cat > custom-command.sh <<EOF
1236 > #!/bin/sh
1238 > #!/bin/sh
1237 > echo "hello world"
1239 > echo "hello world"
1238 > EOF
1240 > EOF
1239 $ chmod +x custom-command.sh
1241 $ chmod +x custom-command.sh
1240 $ cat > test-testdir-path.t <<EOF
1242 $ cat > test-testdir-path.t <<EOF
1241 > $ custom-command.sh
1243 > $ custom-command.sh
1242 > hello world
1244 > hello world
1243 > EOF
1245 > EOF
1244 $ rt test-testdir-path.t
1246 $ rt test-testdir-path.t
1245 .
1247 .
1246 # Ran 1 tests, 0 skipped, 0 failed.
1248 # Ran 1 tests, 0 skipped, 0 failed.
1247
1249
1248 #endif
1250 #endif
1249
1251
1250 test support for --allow-slow-tests
1252 test support for --allow-slow-tests
1251 $ cat > test-very-slow-test.t <<EOF
1253 $ cat > test-very-slow-test.t <<EOF
1252 > #require slow
1254 > #require slow
1253 > $ echo pass
1255 > $ echo pass
1254 > pass
1256 > pass
1255 > EOF
1257 > EOF
1256 $ rt test-very-slow-test.t
1258 $ rt test-very-slow-test.t
1257 s
1259 s
1258 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1260 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1259 # Ran 0 tests, 1 skipped, 0 failed.
1261 # Ran 0 tests, 1 skipped, 0 failed.
1260 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1262 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1261 .
1263 .
1262 # Ran 1 tests, 0 skipped, 0 failed.
1264 # Ran 1 tests, 0 skipped, 0 failed.
1263
1265
1264 support for running a test outside the current directory
1266 support for running a test outside the current directory
1265 $ mkdir nonlocal
1267 $ mkdir nonlocal
1266 $ cat > nonlocal/test-is-not-here.t << EOF
1268 $ cat > nonlocal/test-is-not-here.t << EOF
1267 > $ echo pass
1269 > $ echo pass
1268 > pass
1270 > pass
1269 > EOF
1271 > EOF
1270 $ rt nonlocal/test-is-not-here.t
1272 $ rt nonlocal/test-is-not-here.t
1271 .
1273 .
1272 # Ran 1 tests, 0 skipped, 0 failed.
1274 # Ran 1 tests, 0 skipped, 0 failed.
1273
1275
1274 support for automatically discovering test if arg is a folder
1276 support for automatically discovering test if arg is a folder
1275 $ mkdir tmp && cd tmp
1277 $ mkdir tmp && cd tmp
1276
1278
1277 $ cat > test-uno.t << EOF
1279 $ cat > test-uno.t << EOF
1278 > $ echo line
1280 > $ echo line
1279 > line
1281 > line
1280 > EOF
1282 > EOF
1281
1283
1282 $ cp test-uno.t test-dos.t
1284 $ cp test-uno.t test-dos.t
1283 $ cd ..
1285 $ cd ..
1284 $ cp -R tmp tmpp
1286 $ cp -R tmp tmpp
1285 $ cp tmp/test-uno.t test-solo.t
1287 $ cp tmp/test-uno.t test-solo.t
1286
1288
1287 $ rt tmp/ test-solo.t tmpp
1289 $ rt tmp/ test-solo.t tmpp
1288 .....
1290 .....
1289 # Ran 5 tests, 0 skipped, 0 failed.
1291 # Ran 5 tests, 0 skipped, 0 failed.
1290 $ rm -rf tmp tmpp
1292 $ rm -rf tmp tmpp
1291
1293
1292 support for running run-tests.py from another directory
1294 support for running run-tests.py from another directory
1293 $ mkdir tmp && cd tmp
1295 $ mkdir tmp && cd tmp
1294
1296
1295 $ cat > useful-file.sh << EOF
1297 $ cat > useful-file.sh << EOF
1296 > important command
1298 > important command
1297 > EOF
1299 > EOF
1298
1300
1299 $ cat > test-folder.t << EOF
1301 $ cat > test-folder.t << EOF
1300 > $ cat \$TESTDIR/useful-file.sh
1302 > $ cat \$TESTDIR/useful-file.sh
1301 > important command
1303 > important command
1302 > EOF
1304 > EOF
1303
1305
1304 $ cat > test-folder-fail.t << EOF
1306 $ cat > test-folder-fail.t << EOF
1305 > $ cat \$TESTDIR/useful-file.sh
1307 > $ cat \$TESTDIR/useful-file.sh
1306 > important commando
1308 > important commando
1307 > EOF
1309 > EOF
1308
1310
1309 $ cd ..
1311 $ cd ..
1310 $ rt tmp/test-*.t
1312 $ rt tmp/test-*.t
1311
1313
1312 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1314 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1313 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1315 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1314 @@ -1,2 +1,2 @@
1316 @@ -1,2 +1,2 @@
1315 $ cat $TESTDIR/useful-file.sh
1317 $ cat $TESTDIR/useful-file.sh
1316 - important commando
1318 - important commando
1317 + important command
1319 + important command
1318
1320
1319 ERROR: test-folder-fail.t output changed
1321 ERROR: test-folder-fail.t output changed
1320 !.
1322 !.
1321 Failed test-folder-fail.t: output changed
1323 Failed test-folder-fail.t: output changed
1322 # Ran 2 tests, 0 skipped, 1 failed.
1324 # Ran 2 tests, 0 skipped, 1 failed.
1323 python hash seed: * (glob)
1325 python hash seed: * (glob)
1324 [1]
1326 [1]
1325
1327
1326 support for bisecting failed tests automatically
1328 support for bisecting failed tests automatically
1327 $ hg init bisect
1329 $ hg init bisect
1328 $ cd bisect
1330 $ cd bisect
1329 $ cat >> test-bisect.t <<EOF
1331 $ cat >> test-bisect.t <<EOF
1330 > $ echo pass
1332 > $ echo pass
1331 > pass
1333 > pass
1332 > EOF
1334 > EOF
1333 $ hg add test-bisect.t
1335 $ hg add test-bisect.t
1334 $ hg ci -m 'good'
1336 $ hg ci -m 'good'
1335 $ cat >> test-bisect.t <<EOF
1337 $ cat >> test-bisect.t <<EOF
1336 > $ echo pass
1338 > $ echo pass
1337 > fail
1339 > fail
1338 > EOF
1340 > EOF
1339 $ hg ci -m 'bad'
1341 $ hg ci -m 'bad'
1340 $ rt --known-good-rev=0 test-bisect.t
1342 $ rt --known-good-rev=0 test-bisect.t
1341
1343
1342 --- $TESTTMP/anothertests/bisect/test-bisect.t
1344 --- $TESTTMP/anothertests/bisect/test-bisect.t
1343 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1345 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1344 @@ -1,4 +1,4 @@
1346 @@ -1,4 +1,4 @@
1345 $ echo pass
1347 $ echo pass
1346 pass
1348 pass
1347 $ echo pass
1349 $ echo pass
1348 - fail
1350 - fail
1349 + pass
1351 + pass
1350
1352
1351 ERROR: test-bisect.t output changed
1353 ERROR: test-bisect.t output changed
1352 !
1354 !
1353 Failed test-bisect.t: output changed
1355 Failed test-bisect.t: output changed
1354 test-bisect.t broken by 72cbf122d116 (bad)
1356 test-bisect.t broken by 72cbf122d116 (bad)
1355 # Ran 1 tests, 0 skipped, 1 failed.
1357 # Ran 1 tests, 0 skipped, 1 failed.
1356 python hash seed: * (glob)
1358 python hash seed: * (glob)
1357 [1]
1359 [1]
1358
1360
1359 $ cd ..
1361 $ cd ..
1360
1362
1361 support bisecting a separate repo
1363 support bisecting a separate repo
1362
1364
1363 $ hg init bisect-dependent
1365 $ hg init bisect-dependent
1364 $ cd bisect-dependent
1366 $ cd bisect-dependent
1365 $ cat > test-bisect-dependent.t <<EOF
1367 $ cat > test-bisect-dependent.t <<EOF
1366 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1368 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1367 > pass
1369 > pass
1368 > EOF
1370 > EOF
1369 $ hg commit -Am dependent test-bisect-dependent.t
1371 $ hg commit -Am dependent test-bisect-dependent.t
1370
1372
1371 $ rt --known-good-rev=0 test-bisect-dependent.t
1373 $ rt --known-good-rev=0 test-bisect-dependent.t
1372
1374
1373 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1375 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1374 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1376 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1375 @@ -1,2 +1,2 @@
1377 @@ -1,2 +1,2 @@
1376 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1378 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1377 - pass
1379 - pass
1378 + fail
1380 + fail
1379
1381
1380 ERROR: test-bisect-dependent.t output changed
1382 ERROR: test-bisect-dependent.t output changed
1381 !
1383 !
1382 Failed test-bisect-dependent.t: output changed
1384 Failed test-bisect-dependent.t: output changed
1383 Failed to identify failure point for test-bisect-dependent.t
1385 Failed to identify failure point for test-bisect-dependent.t
1384 # Ran 1 tests, 0 skipped, 1 failed.
1386 # Ran 1 tests, 0 skipped, 1 failed.
1385 python hash seed: * (glob)
1387 python hash seed: * (glob)
1386 [1]
1388 [1]
1387
1389
1388 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1390 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1389 usage: run-tests.py [options] [tests]
1391 usage: run-tests.py [options] [tests]
1390 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1392 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1391 [2]
1393 [2]
1392
1394
1393 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1395 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1394
1396
1395 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1397 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1396 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1398 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1397 @@ -1,2 +1,2 @@
1399 @@ -1,2 +1,2 @@
1398 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1400 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1399 - pass
1401 - pass
1400 + fail
1402 + fail
1401
1403
1402 ERROR: test-bisect-dependent.t output changed
1404 ERROR: test-bisect-dependent.t output changed
1403 !
1405 !
1404 Failed test-bisect-dependent.t: output changed
1406 Failed test-bisect-dependent.t: output changed
1405 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1407 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1406 # Ran 1 tests, 0 skipped, 1 failed.
1408 # Ran 1 tests, 0 skipped, 1 failed.
1407 python hash seed: * (glob)
1409 python hash seed: * (glob)
1408 [1]
1410 [1]
1409
1411
1410 $ cd ..
1412 $ cd ..
1411
1413
1412 Test a broken #if statement doesn't break run-tests threading.
1414 Test a broken #if statement doesn't break run-tests threading.
1413 ==============================================================
1415 ==============================================================
1414 $ mkdir broken
1416 $ mkdir broken
1415 $ cd broken
1417 $ cd broken
1416 $ cat > test-broken.t <<EOF
1418 $ cat > test-broken.t <<EOF
1417 > true
1419 > true
1418 > #if notarealhghavefeature
1420 > #if notarealhghavefeature
1419 > $ false
1421 > $ false
1420 > #endif
1422 > #endif
1421 > EOF
1423 > EOF
1422 $ for f in 1 2 3 4 ; do
1424 $ for f in 1 2 3 4 ; do
1423 > cat > test-works-$f.t <<EOF
1425 > cat > test-works-$f.t <<EOF
1424 > This is test case $f
1426 > This is test case $f
1425 > $ sleep 1
1427 > $ sleep 1
1426 > EOF
1428 > EOF
1427 > done
1429 > done
1428 $ rt -j 2
1430 $ rt -j 2
1429 ....
1431 ....
1430 # Ran 5 tests, 0 skipped, 0 failed.
1432 # Ran 5 tests, 0 skipped, 0 failed.
1431 skipped: unknown feature: notarealhghavefeature
1433 skipped: unknown feature: notarealhghavefeature
1432
1434
1433 $ cd ..
1435 $ cd ..
1434 $ rm -rf broken
1436 $ rm -rf broken
1435
1437
1436 Test cases in .t files
1438 Test cases in .t files
1437 ======================
1439 ======================
1438 $ mkdir cases
1440 $ mkdir cases
1439 $ cd cases
1441 $ cd cases
1440 $ cat > test-cases-abc.t <<'EOF'
1442 $ cat > test-cases-abc.t <<'EOF'
1441 > #testcases A B C
1443 > #testcases A B C
1442 > $ V=B
1444 > $ V=B
1443 > #if A
1445 > #if A
1444 > $ V=A
1446 > $ V=A
1445 > #endif
1447 > #endif
1446 > #if C
1448 > #if C
1447 > $ V=C
1449 > $ V=C
1448 > #endif
1450 > #endif
1449 > $ echo $V | sed 's/A/C/'
1451 > $ echo $V | sed 's/A/C/'
1450 > C
1452 > C
1451 > #if C
1453 > #if C
1452 > $ [ $V = C ]
1454 > $ [ $V = C ]
1453 > #endif
1455 > #endif
1454 > #if A
1456 > #if A
1455 > $ [ $V = C ]
1457 > $ [ $V = C ]
1456 > [1]
1458 > [1]
1457 > #endif
1459 > #endif
1458 > #if no-C
1460 > #if no-C
1459 > $ [ $V = C ]
1461 > $ [ $V = C ]
1460 > [1]
1462 > [1]
1461 > #endif
1463 > #endif
1462 > $ [ $V = D ]
1464 > $ [ $V = D ]
1463 > [1]
1465 > [1]
1464 > EOF
1466 > EOF
1465 $ rt
1467 $ rt
1466 .
1468 .
1467 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1469 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1468 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1470 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1469 @@ -7,7 +7,7 @@
1471 @@ -7,7 +7,7 @@
1470 $ V=C
1472 $ V=C
1471 #endif
1473 #endif
1472 $ echo $V | sed 's/A/C/'
1474 $ echo $V | sed 's/A/C/'
1473 - C
1475 - C
1474 + B
1476 + B
1475 #if C
1477 #if C
1476 $ [ $V = C ]
1478 $ [ $V = C ]
1477 #endif
1479 #endif
1478
1480
1479 ERROR: test-cases-abc.t (case B) output changed
1481 ERROR: test-cases-abc.t (case B) output changed
1480 !.
1482 !.
1481 Failed test-cases-abc.t (case B): output changed
1483 Failed test-cases-abc.t (case B): output changed
1482 # Ran 3 tests, 0 skipped, 1 failed.
1484 # Ran 3 tests, 0 skipped, 1 failed.
1483 python hash seed: * (glob)
1485 python hash seed: * (glob)
1484 [1]
1486 [1]
1485
1487
1486 --restart works
1488 --restart works
1487
1489
1488 $ rt --restart
1490 $ rt --restart
1489
1491
1490 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1492 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1491 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1493 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1492 @@ -7,7 +7,7 @@
1494 @@ -7,7 +7,7 @@
1493 $ V=C
1495 $ V=C
1494 #endif
1496 #endif
1495 $ echo $V | sed 's/A/C/'
1497 $ echo $V | sed 's/A/C/'
1496 - C
1498 - C
1497 + B
1499 + B
1498 #if C
1500 #if C
1499 $ [ $V = C ]
1501 $ [ $V = C ]
1500 #endif
1502 #endif
1501
1503
1502 ERROR: test-cases-abc.t (case B) output changed
1504 ERROR: test-cases-abc.t (case B) output changed
1503 !.
1505 !.
1504 Failed test-cases-abc.t (case B): output changed
1506 Failed test-cases-abc.t (case B): output changed
1505 # Ran 2 tests, 0 skipped, 1 failed.
1507 # Ran 2 tests, 0 skipped, 1 failed.
1506 python hash seed: * (glob)
1508 python hash seed: * (glob)
1507 [1]
1509 [1]
1508
1510
1509 --restart works with outputdir
1511 --restart works with outputdir
1510
1512
1511 $ mkdir output
1513 $ mkdir output
1512 $ mv test-cases-abc.t.B.err output
1514 $ mv test-cases-abc.t.B.err output
1513 $ rt --restart --outputdir output
1515 $ rt --restart --outputdir output
1514
1516
1515 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1517 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1516 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
1518 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
1517 @@ -7,7 +7,7 @@
1519 @@ -7,7 +7,7 @@
1518 $ V=C
1520 $ V=C
1519 #endif
1521 #endif
1520 $ echo $V | sed 's/A/C/'
1522 $ echo $V | sed 's/A/C/'
1521 - C
1523 - C
1522 + B
1524 + B
1523 #if C
1525 #if C
1524 $ [ $V = C ]
1526 $ [ $V = C ]
1525 #endif
1527 #endif
1526
1528
1527 ERROR: test-cases-abc.t (case B) output changed
1529 ERROR: test-cases-abc.t (case B) output changed
1528 !.
1530 !.
1529 Failed test-cases-abc.t (case B): output changed
1531 Failed test-cases-abc.t (case B): output changed
1530 # Ran 2 tests, 0 skipped, 1 failed.
1532 # Ran 2 tests, 0 skipped, 1 failed.
1531 python hash seed: * (glob)
1533 python hash seed: * (glob)
1532 [1]
1534 [1]
1533
1535
1534 Test automatic pattern replacement
1536 Test automatic pattern replacement
1535
1537
1536 $ cat << EOF >> common-pattern.py
1538 $ cat << EOF >> common-pattern.py
1537 > substitutions = [
1539 > substitutions = [
1538 > (br'foo-(.*)\\b',
1540 > (br'foo-(.*)\\b',
1539 > br'\$XXX=\\1\$'),
1541 > br'\$XXX=\\1\$'),
1540 > (br'bar\\n',
1542 > (br'bar\\n',
1541 > br'\$YYY$\\n'),
1543 > br'\$YYY$\\n'),
1542 > ]
1544 > ]
1543 > EOF
1545 > EOF
1544
1546
1545 $ cat << EOF >> test-substitution.t
1547 $ cat << EOF >> test-substitution.t
1546 > $ echo foo-12
1548 > $ echo foo-12
1547 > \$XXX=12$
1549 > \$XXX=12$
1548 > $ echo foo-42
1550 > $ echo foo-42
1549 > \$XXX=42$
1551 > \$XXX=42$
1550 > $ echo bar prior
1552 > $ echo bar prior
1551 > bar prior
1553 > bar prior
1552 > $ echo lastbar
1554 > $ echo lastbar
1553 > last\$YYY$
1555 > last\$YYY$
1554 > $ echo foo-bar foo-baz
1556 > $ echo foo-bar foo-baz
1555 > EOF
1557 > EOF
1556
1558
1557 $ rt test-substitution.t
1559 $ rt test-substitution.t
1558
1560
1559 --- $TESTTMP/anothertests/cases/test-substitution.t
1561 --- $TESTTMP/anothertests/cases/test-substitution.t
1560 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1562 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1561 @@ -7,3 +7,4 @@
1563 @@ -7,3 +7,4 @@
1562 $ echo lastbar
1564 $ echo lastbar
1563 last$YYY$
1565 last$YYY$
1564 $ echo foo-bar foo-baz
1566 $ echo foo-bar foo-baz
1565 + $XXX=bar foo-baz$
1567 + $XXX=bar foo-baz$
1566
1568
1567 ERROR: test-substitution.t output changed
1569 ERROR: test-substitution.t output changed
1568 !
1570 !
1569 Failed test-substitution.t: output changed
1571 Failed test-substitution.t: output changed
1570 # Ran 1 tests, 0 skipped, 1 failed.
1572 # Ran 1 tests, 0 skipped, 1 failed.
1571 python hash seed: * (glob)
1573 python hash seed: * (glob)
1572 [1]
1574 [1]
1573
1575
1574 --extra-config-opt works
1576 --extra-config-opt works
1575
1577
1576 $ cat << EOF >> test-config-opt.t
1578 $ cat << EOF >> test-config-opt.t
1577 > $ hg init test-config-opt
1579 > $ hg init test-config-opt
1578 > $ hg -R test-config-opt purge
1580 > $ hg -R test-config-opt purge
1579 > EOF
1581 > EOF
1580
1582
1581 $ rt --extra-config-opt extensions.purge= test-config-opt.t
1583 $ rt --extra-config-opt extensions.purge= test-config-opt.t
1582 .
1584 .
1583 # Ran 1 tests, 0 skipped, 0 failed.
1585 # Ran 1 tests, 0 skipped, 0 failed.
General Comments 0
You need to be logged in to leave comments. Login now