##// END OF EJS Templates
test-run-tests: add globs for Windows...
Matt Harbison -
r26432:39577d45 default
parent child Browse files
Show More
@@ -1,645 +1,645 b''
1 This file tests the behavior of run-tests.py itself.
1 This file tests the behavior of run-tests.py itself.
2
2
3 Avoid interference from actual test env:
3 Avoid interference from actual test env:
4
4
5 $ unset HGTEST_JOBS
5 $ unset HGTEST_JOBS
6 $ unset HGTEST_TIMEOUT
6 $ unset HGTEST_TIMEOUT
7 $ unset HGTEST_PORT
7 $ unset HGTEST_PORT
8 $ unset HGTEST_SHELL
8 $ unset HGTEST_SHELL
9
9
10 Smoke test
10 Smoke test
11 ============
11 ============
12
12
13 $ run-tests.py $HGTEST_RUN_TESTS_PURE
13 $ run-tests.py $HGTEST_RUN_TESTS_PURE
14
14
15 # Ran 0 tests, 0 skipped, 0 warned, 0 failed.
15 # Ran 0 tests, 0 skipped, 0 warned, 0 failed.
16
16
17 a succesful test
17 a succesful test
18 =======================
18 =======================
19
19
20 $ cat > test-success.t << EOF
20 $ cat > test-success.t << EOF
21 > $ echo babar
21 > $ echo babar
22 > babar
22 > babar
23 > $ echo xyzzy
23 > $ echo xyzzy
24 > never happens (?)
24 > never happens (?)
25 > xyzzy
25 > xyzzy
26 > nor this (?)
26 > nor this (?)
27 > EOF
27 > EOF
28
28
29 $ run-tests.py --with-hg=`which hg`
29 $ run-tests.py --with-hg=`which hg`
30 .
30 .
31 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
31 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
32
32
33 failing test
33 failing test
34 ==================
34 ==================
35
35
36 $ cat > test-failure.t << EOF
36 $ cat > test-failure.t << EOF
37 > $ echo babar
37 > $ echo babar
38 > rataxes
38 > rataxes
39 > This is a noop statement so that
39 > This is a noop statement so that
40 > this test is still more bytes than success.
40 > this test is still more bytes than success.
41 > EOF
41 > EOF
42
42
43 >>> fh = open('test-failure-unicode.t', 'wb')
43 >>> fh = open('test-failure-unicode.t', 'wb')
44 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
44 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
45 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
45 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
46
46
47 $ run-tests.py --with-hg=`which hg`
47 $ run-tests.py --with-hg=`which hg`
48
48
49 --- $TESTTMP/test-failure.t
49 --- $TESTTMP/test-failure.t
50 +++ $TESTTMP/test-failure.t.err
50 +++ $TESTTMP/test-failure.t.err
51 @@ -1,4 +1,4 @@
51 @@ -1,4 +1,4 @@
52 $ echo babar
52 $ echo babar
53 - rataxes
53 - rataxes
54 + babar
54 + babar
55 This is a noop statement so that
55 This is a noop statement so that
56 this test is still more bytes than success.
56 this test is still more bytes than success.
57
57
58 ERROR: test-failure.t output changed
58 ERROR: test-failure.t output changed
59 !.
59 !.
60 --- $TESTTMP/test-failure-unicode.t
60 --- $TESTTMP/test-failure-unicode.t
61 +++ $TESTTMP/test-failure-unicode.t.err
61 +++ $TESTTMP/test-failure-unicode.t.err
62 @@ -1,2 +1,2 @@
62 @@ -1,2 +1,2 @@
63 $ echo babar\xce\xb1 (esc)
63 $ echo babar\xce\xb1 (esc)
64 - l\xce\xb5\xce\xb5t (esc)
64 - l\xce\xb5\xce\xb5t (esc)
65 + babar\xce\xb1 (esc)
65 + babar\xce\xb1 (esc)
66
66
67 ERROR: test-failure-unicode.t output changed
67 ERROR: test-failure-unicode.t output changed
68 !
68 !
69 Failed test-failure.t: output changed
69 Failed test-failure.t: output changed
70 Failed test-failure-unicode.t: output changed
70 Failed test-failure-unicode.t: output changed
71 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
71 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
72 python hash seed: * (glob)
72 python hash seed: * (glob)
73 [1]
73 [1]
74
74
75 test --xunit support
75 test --xunit support
76 $ run-tests.py --with-hg=`which hg` --xunit=xunit.xml
76 $ run-tests.py --with-hg=`which hg` --xunit=xunit.xml
77
77
78 --- $TESTTMP/test-failure.t
78 --- $TESTTMP/test-failure.t
79 +++ $TESTTMP/test-failure.t.err
79 +++ $TESTTMP/test-failure.t.err
80 @@ -1,4 +1,4 @@
80 @@ -1,4 +1,4 @@
81 $ echo babar
81 $ echo babar
82 - rataxes
82 - rataxes
83 + babar
83 + babar
84 This is a noop statement so that
84 This is a noop statement so that
85 this test is still more bytes than success.
85 this test is still more bytes than success.
86
86
87 ERROR: test-failure.t output changed
87 ERROR: test-failure.t output changed
88 !.
88 !.
89 --- $TESTTMP/test-failure-unicode.t
89 --- $TESTTMP/test-failure-unicode.t
90 +++ $TESTTMP/test-failure-unicode.t.err
90 +++ $TESTTMP/test-failure-unicode.t.err
91 @@ -1,2 +1,2 @@
91 @@ -1,2 +1,2 @@
92 $ echo babar\xce\xb1 (esc)
92 $ echo babar\xce\xb1 (esc)
93 - l\xce\xb5\xce\xb5t (esc)
93 - l\xce\xb5\xce\xb5t (esc)
94 + babar\xce\xb1 (esc)
94 + babar\xce\xb1 (esc)
95
95
96 ERROR: test-failure-unicode.t output changed
96 ERROR: test-failure-unicode.t output changed
97 !
97 !
98 Failed test-failure.t: output changed
98 Failed test-failure.t: output changed
99 Failed test-failure-unicode.t: output changed
99 Failed test-failure-unicode.t: output changed
100 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
100 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
101 python hash seed: * (glob)
101 python hash seed: * (glob)
102 [1]
102 [1]
103 $ cat xunit.xml
103 $ cat xunit.xml
104 <?xml version="1.0" encoding="utf-8"?>
104 <?xml version="1.0" encoding="utf-8"?>
105 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
105 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
106 <testcase name="test-success.t" time="*"/> (glob)
106 <testcase name="test-success.t" time="*"/> (glob)
107 <testcase name="test-failure-unicode.t" time="*"> (glob)
107 <testcase name="test-failure-unicode.t" time="*"> (glob)
108 <![CDATA[--- $TESTTMP/test-failure-unicode.t
108 <![CDATA[--- $TESTTMP/test-failure-unicode.t
109 +++ $TESTTMP/test-failure-unicode.t.err
109 +++ $TESTTMP/test-failure-unicode.t.err
110 @@ -1,2 +1,2 @@
110 @@ -1,2 +1,2 @@
111 $ echo babar\xce\xb1 (esc)
111 $ echo babar\xce\xb1 (esc)
112 - l\xce\xb5\xce\xb5t (esc)
112 - l\xce\xb5\xce\xb5t (esc)
113 + babar\xce\xb1 (esc)
113 + babar\xce\xb1 (esc)
114 ]]> </testcase>
114 ]]> </testcase>
115 <testcase name="test-failure.t" time="*"> (glob)
115 <testcase name="test-failure.t" time="*"> (glob)
116 <![CDATA[--- $TESTTMP/test-failure.t
116 <![CDATA[--- $TESTTMP/test-failure.t
117 +++ $TESTTMP/test-failure.t.err
117 +++ $TESTTMP/test-failure.t.err
118 @@ -1,4 +1,4 @@
118 @@ -1,4 +1,4 @@
119 $ echo babar
119 $ echo babar
120 - rataxes
120 - rataxes
121 + babar
121 + babar
122 This is a noop statement so that
122 This is a noop statement so that
123 this test is still more bytes than success.
123 this test is still more bytes than success.
124 ]]> </testcase>
124 ]]> </testcase>
125 </testsuite>
125 </testsuite>
126
126
127 $ rm test-failure-unicode.t
127 $ rm test-failure-unicode.t
128
128
129 test for --retest
129 test for --retest
130 ====================
130 ====================
131
131
132 $ run-tests.py --with-hg=`which hg` --retest
132 $ run-tests.py --with-hg=`which hg` --retest
133
133
134 --- $TESTTMP/test-failure.t
134 --- $TESTTMP/test-failure.t
135 +++ $TESTTMP/test-failure.t.err
135 +++ $TESTTMP/test-failure.t.err
136 @@ -1,4 +1,4 @@
136 @@ -1,4 +1,4 @@
137 $ echo babar
137 $ echo babar
138 - rataxes
138 - rataxes
139 + babar
139 + babar
140 This is a noop statement so that
140 This is a noop statement so that
141 this test is still more bytes than success.
141 this test is still more bytes than success.
142
142
143 ERROR: test-failure.t output changed
143 ERROR: test-failure.t output changed
144 !
144 !
145 Failed test-failure.t: output changed
145 Failed test-failure.t: output changed
146 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
146 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
147 python hash seed: * (glob)
147 python hash seed: * (glob)
148 [1]
148 [1]
149
149
150 Selecting Tests To Run
150 Selecting Tests To Run
151 ======================
151 ======================
152
152
153 successful
153 successful
154
154
155 $ run-tests.py --with-hg=`which hg` test-success.t
155 $ run-tests.py --with-hg=`which hg` test-success.t
156 .
156 .
157 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
157 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
158
158
159 success w/ keyword
159 success w/ keyword
160 $ run-tests.py --with-hg=`which hg` -k xyzzy
160 $ run-tests.py --with-hg=`which hg` -k xyzzy
161 .
161 .
162 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
162 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
163
163
164 failed
164 failed
165
165
166 $ run-tests.py --with-hg=`which hg` test-failure.t
166 $ run-tests.py --with-hg=`which hg` test-failure.t
167
167
168 --- $TESTTMP/test-failure.t
168 --- $TESTTMP/test-failure.t
169 +++ $TESTTMP/test-failure.t.err
169 +++ $TESTTMP/test-failure.t.err
170 @@ -1,4 +1,4 @@
170 @@ -1,4 +1,4 @@
171 $ echo babar
171 $ echo babar
172 - rataxes
172 - rataxes
173 + babar
173 + babar
174 This is a noop statement so that
174 This is a noop statement so that
175 this test is still more bytes than success.
175 this test is still more bytes than success.
176
176
177 ERROR: test-failure.t output changed
177 ERROR: test-failure.t output changed
178 !
178 !
179 Failed test-failure.t: output changed
179 Failed test-failure.t: output changed
180 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
180 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
181 python hash seed: * (glob)
181 python hash seed: * (glob)
182 [1]
182 [1]
183
183
184 failure w/ keyword
184 failure w/ keyword
185 $ run-tests.py --with-hg=`which hg` -k rataxes
185 $ run-tests.py --with-hg=`which hg` -k rataxes
186
186
187 --- $TESTTMP/test-failure.t
187 --- $TESTTMP/test-failure.t
188 +++ $TESTTMP/test-failure.t.err
188 +++ $TESTTMP/test-failure.t.err
189 @@ -1,4 +1,4 @@
189 @@ -1,4 +1,4 @@
190 $ echo babar
190 $ echo babar
191 - rataxes
191 - rataxes
192 + babar
192 + babar
193 This is a noop statement so that
193 This is a noop statement so that
194 this test is still more bytes than success.
194 this test is still more bytes than success.
195
195
196 ERROR: test-failure.t output changed
196 ERROR: test-failure.t output changed
197 !
197 !
198 Failed test-failure.t: output changed
198 Failed test-failure.t: output changed
199 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
199 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
200 python hash seed: * (glob)
200 python hash seed: * (glob)
201 [1]
201 [1]
202
202
203 Verify that when a process fails to start we show a useful message
203 Verify that when a process fails to start we show a useful message
204 ==================================================================
204 ==================================================================
205 NOTE: there is currently a bug where this shows "2 failed" even though
205 NOTE: there is currently a bug where this shows "2 failed" even though
206 it's actually the same test being reported for failure twice.
206 it's actually the same test being reported for failure twice.
207
207
208 $ cat > test-serve-fail.t <<EOF
208 $ cat > test-serve-fail.t <<EOF
209 > $ echo 'abort: child process failed to start blah'
209 > $ echo 'abort: child process failed to start blah'
210 > EOF
210 > EOF
211 $ run-tests.py --with-hg=`which hg` test-serve-fail.t
211 $ run-tests.py --with-hg=`which hg` test-serve-fail.t
212
212
213 ERROR: test-serve-fail.t output changed
213 ERROR: test-serve-fail.t output changed
214 !
214 !
215 ERROR: test-serve-fail.t output changed
215 ERROR: test-serve-fail.t output changed
216 !
216 !
217 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
217 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
218 Failed test-serve-fail.t: output changed
218 Failed test-serve-fail.t: output changed
219 # Ran 1 tests, 0 skipped, 0 warned, 2 failed.
219 # Ran 1 tests, 0 skipped, 0 warned, 2 failed.
220 python hash seed: * (glob)
220 python hash seed: * (glob)
221 [1]
221 [1]
222 $ rm test-serve-fail.t
222 $ rm test-serve-fail.t
223
223
224 Running In Debug Mode
224 Running In Debug Mode
225 ======================
225 ======================
226
226
227 $ run-tests.py --with-hg=`which hg` --debug 2>&1 | grep -v pwd
227 $ run-tests.py --with-hg=`which hg` --debug 2>&1 | grep -v pwd
228 + echo *SALT* 0 0 (glob)
228 + echo *SALT* 0 0 (glob)
229 *SALT* 0 0 (glob)
229 *SALT* 0 0 (glob)
230 + echo babar
230 + echo babar
231 babar
231 babar
232 + echo *SALT* 4 0 (glob)
232 + echo *SALT* 4 0 (glob)
233 *SALT* 4 0 (glob)
233 *SALT* 4 0 (glob)
234 .+ echo *SALT* 0 0 (glob)
234 .+ echo *SALT* 0 0 (glob)
235 *SALT* 0 0 (glob)
235 *SALT* 0 0 (glob)
236 + echo babar
236 + echo babar
237 babar
237 babar
238 + echo *SALT* 2 0 (glob)
238 + echo *SALT* 2 0 (glob)
239 *SALT* 2 0 (glob)
239 *SALT* 2 0 (glob)
240 + echo xyzzy
240 + echo xyzzy
241 xyzzy
241 xyzzy
242 + echo *SALT* 6 0 (glob)
242 + echo *SALT* 6 0 (glob)
243 *SALT* 6 0 (glob)
243 *SALT* 6 0 (glob)
244 .
244 .
245 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
245 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
246
246
247 Parallel runs
247 Parallel runs
248 ==============
248 ==============
249
249
250 (duplicate the failing test to get predictable output)
250 (duplicate the failing test to get predictable output)
251 $ cp test-failure.t test-failure-copy.t
251 $ cp test-failure.t test-failure-copy.t
252
252
253 $ run-tests.py --with-hg=`which hg` --jobs 2 test-failure*.t -n
253 $ run-tests.py --with-hg=`which hg` --jobs 2 test-failure*.t -n
254 !!
254 !!
255 Failed test-failure*.t: output changed (glob)
255 Failed test-failure*.t: output changed (glob)
256 Failed test-failure*.t: output changed (glob)
256 Failed test-failure*.t: output changed (glob)
257 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
257 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
258 python hash seed: * (glob)
258 python hash seed: * (glob)
259 [1]
259 [1]
260
260
261 failures in parallel with --first should only print one failure
261 failures in parallel with --first should only print one failure
262 >>> f = open('test-nothing.t', 'w')
262 >>> f = open('test-nothing.t', 'w')
263 >>> f.write('foo\n' * 1024) and None
263 >>> f.write('foo\n' * 1024) and None
264 >>> f.write(' $ sleep 1') and None
264 >>> f.write(' $ sleep 1') and None
265 $ run-tests.py --with-hg=`which hg` --jobs 2 --first
265 $ run-tests.py --with-hg=`which hg` --jobs 2 --first
266
266
267 --- $TESTTMP/test-failure*.t (glob)
267 --- $TESTTMP/test-failure*.t (glob)
268 +++ $TESTTMP/test-failure*.t.err (glob)
268 +++ $TESTTMP/test-failure*.t.err (glob)
269 @@ -1,4 +1,4 @@
269 @@ -1,4 +1,4 @@
270 $ echo babar
270 $ echo babar
271 - rataxes
271 - rataxes
272 + babar
272 + babar
273 This is a noop statement so that
273 This is a noop statement so that
274 this test is still more bytes than success.
274 this test is still more bytes than success.
275
275
276 Failed test-failure*.t: output changed (glob)
276 Failed test-failure*.t: output changed (glob)
277 Failed test-nothing.t: output changed
277 Failed test-nothing.t: output changed
278 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
278 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
279 python hash seed: * (glob)
279 python hash seed: * (glob)
280 [1]
280 [1]
281
281
282
282
283 (delete the duplicated test file)
283 (delete the duplicated test file)
284 $ rm test-failure-copy.t test-nothing.t
284 $ rm test-failure-copy.t test-nothing.t
285
285
286
286
287 Interactive run
287 Interactive run
288 ===============
288 ===============
289
289
290 (backup the failing test)
290 (backup the failing test)
291 $ cp test-failure.t backup
291 $ cp test-failure.t backup
292
292
293 Refuse the fix
293 Refuse the fix
294
294
295 $ echo 'n' | run-tests.py --with-hg=`which hg` -i
295 $ echo 'n' | run-tests.py --with-hg=`which hg` -i
296
296
297 --- $TESTTMP/test-failure.t
297 --- $TESTTMP/test-failure.t
298 +++ $TESTTMP/test-failure.t.err
298 +++ $TESTTMP/test-failure.t.err
299 @@ -1,4 +1,4 @@
299 @@ -1,4 +1,4 @@
300 $ echo babar
300 $ echo babar
301 - rataxes
301 - rataxes
302 + babar
302 + babar
303 This is a noop statement so that
303 This is a noop statement so that
304 this test is still more bytes than success.
304 this test is still more bytes than success.
305 Accept this change? [n]
305 Accept this change? [n]
306 ERROR: test-failure.t output changed
306 ERROR: test-failure.t output changed
307 !.
307 !.
308 Failed test-failure.t: output changed
308 Failed test-failure.t: output changed
309 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
309 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
310 python hash seed: * (glob)
310 python hash seed: * (glob)
311 [1]
311 [1]
312
312
313 $ cat test-failure.t
313 $ cat test-failure.t
314 $ echo babar
314 $ echo babar
315 rataxes
315 rataxes
316 This is a noop statement so that
316 This is a noop statement so that
317 this test is still more bytes than success.
317 this test is still more bytes than success.
318
318
319 Interactive with custom view
319 Interactive with custom view
320
320
321 $ echo 'n' | run-tests.py --with-hg=`which hg` -i --view echo
321 $ echo 'n' | run-tests.py --with-hg=`which hg` -i --view echo
322 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
322 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
323 Accept this change? [n]* (glob)
323 Accept this change? [n]* (glob)
324 ERROR: test-failure.t output changed
324 ERROR: test-failure.t output changed
325 !.
325 !.
326 Failed test-failure.t: output changed
326 Failed test-failure.t: output changed
327 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
327 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
328 python hash seed: * (glob)
328 python hash seed: * (glob)
329 [1]
329 [1]
330
330
331 View the fix
331 View the fix
332
332
333 $ echo 'y' | run-tests.py --with-hg=`which hg` --view echo
333 $ echo 'y' | run-tests.py --with-hg=`which hg` --view echo
334 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
334 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
335
335
336 ERROR: test-failure.t output changed
336 ERROR: test-failure.t output changed
337 !.
337 !.
338 Failed test-failure.t: output changed
338 Failed test-failure.t: output changed
339 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
339 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
340 python hash seed: * (glob)
340 python hash seed: * (glob)
341 [1]
341 [1]
342
342
343 Accept the fix
343 Accept the fix
344
344
345 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
345 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
346 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
346 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
347 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
347 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
348 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
348 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
349 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
349 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
350 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
350 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
351 $ echo 'y' | run-tests.py --with-hg=`which hg` -i 2>&1 | \
351 $ echo 'y' | run-tests.py --with-hg=`which hg` -i 2>&1 | \
352 > sed -e 's,(glob)$,&<,g'
352 > sed -e 's,(glob)$,&<,g'
353
353
354 --- $TESTTMP/test-failure.t
354 --- $TESTTMP/test-failure.t
355 +++ $TESTTMP/test-failure.t.err
355 +++ $TESTTMP/test-failure.t.err
356 @@ -1,9 +1,9 @@
356 @@ -1,9 +1,9 @@
357 $ echo babar
357 $ echo babar
358 - rataxes
358 - rataxes
359 + babar
359 + babar
360 This is a noop statement so that
360 This is a noop statement so that
361 this test is still more bytes than success.
361 this test is still more bytes than success.
362 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
362 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
363 - saved backup bundle to $TESTTMP/foo.hg
363 - saved backup bundle to $TESTTMP/foo.hg
364 + saved backup bundle to $TESTTMP/foo.hg (glob)<
364 + saved backup bundle to $TESTTMP/foo.hg (glob)<
365 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
365 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
366 saved backup bundle to $TESTTMP/foo.hg (glob)<
366 saved backup bundle to $TESTTMP/foo.hg (glob)<
367 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
367 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
368 Accept this change? [n] ..
368 Accept this change? [n] ..
369 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
369 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
370
370
371 $ sed -e 's,(glob)$,&<,g' test-failure.t
371 $ sed -e 's,(glob)$,&<,g' test-failure.t
372 $ echo babar
372 $ echo babar
373 babar
373 babar
374 This is a noop statement so that
374 This is a noop statement so that
375 this test is still more bytes than success.
375 this test is still more bytes than success.
376 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
376 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
377 saved backup bundle to $TESTTMP/foo.hg (glob)<
377 saved backup bundle to $TESTTMP/foo.hg (glob)<
378 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
378 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
379 saved backup bundle to $TESTTMP/foo.hg (glob)<
379 saved backup bundle to $TESTTMP/foo.hg (glob)<
380 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
380 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
381 saved backup bundle to $TESTTMP/*.hg (glob)<
381 saved backup bundle to $TESTTMP/*.hg (glob)<
382
382
383 (reinstall)
383 (reinstall)
384 $ mv backup test-failure.t
384 $ mv backup test-failure.t
385
385
386 No Diff
386 No Diff
387 ===============
387 ===============
388
388
389 $ run-tests.py --with-hg=`which hg` --nodiff
389 $ run-tests.py --with-hg=`which hg` --nodiff
390 !.
390 !.
391 Failed test-failure.t: output changed
391 Failed test-failure.t: output changed
392 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
392 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
393 python hash seed: * (glob)
393 python hash seed: * (glob)
394 [1]
394 [1]
395
395
396 test --tmpdir support
396 test --tmpdir support
397 $ run-tests.py --with-hg=`which hg` --tmpdir=$TESTTMP/keep test-success.t
397 $ run-tests.py --with-hg=`which hg` --tmpdir=$TESTTMP/keep test-success.t
398
398
399 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
399 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
400 Keeping threadtmp dir: $TESTTMP/keep/child1
400 Keeping threadtmp dir: $TESTTMP/keep/child1 (glob)
401 .
401 .
402 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
402 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
403
403
404 test for --time
404 test for --time
405 ==================
405 ==================
406
406
407 $ run-tests.py --with-hg=`which hg` test-success.t --time
407 $ run-tests.py --with-hg=`which hg` test-success.t --time
408 .
408 .
409 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
409 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
410 # Producing time report
410 # Producing time report
411 start end cuser csys real Test
411 start end cuser csys real Test
412 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
412 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
413
413
414 test for --time with --job enabled
414 test for --time with --job enabled
415 ====================================
415 ====================================
416
416
417 $ run-tests.py --with-hg=`which hg` test-success.t --time --jobs 2
417 $ run-tests.py --with-hg=`which hg` test-success.t --time --jobs 2
418 .
418 .
419 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
419 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
420 # Producing time report
420 # Producing time report
421 start end cuser csys real Test
421 start end cuser csys real Test
422 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
422 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
423
423
424 Skips
424 Skips
425 ================
425 ================
426 $ cat > test-skip.t <<EOF
426 $ cat > test-skip.t <<EOF
427 > $ echo xyzzy
427 > $ echo xyzzy
428 > #require false
428 > #require false
429 > EOF
429 > EOF
430 $ run-tests.py --with-hg=`which hg` --nodiff
430 $ run-tests.py --with-hg=`which hg` --nodiff
431 !.s
431 !.s
432 Skipped test-skip.t: skipped
432 Skipped test-skip.t: skipped
433 Failed test-failure.t: output changed
433 Failed test-failure.t: output changed
434 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
434 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
435 python hash seed: * (glob)
435 python hash seed: * (glob)
436 [1]
436 [1]
437
437
438 $ run-tests.py --with-hg=`which hg` --keyword xyzzy
438 $ run-tests.py --with-hg=`which hg` --keyword xyzzy
439 .s
439 .s
440 Skipped test-skip.t: skipped
440 Skipped test-skip.t: skipped
441 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
441 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
442
442
443 Skips with xml
443 Skips with xml
444 $ run-tests.py --with-hg=`which hg` --keyword xyzzy \
444 $ run-tests.py --with-hg=`which hg` --keyword xyzzy \
445 > --xunit=xunit.xml
445 > --xunit=xunit.xml
446 .s
446 .s
447 Skipped test-skip.t: skipped
447 Skipped test-skip.t: skipped
448 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
448 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
449 $ cat xunit.xml
449 $ cat xunit.xml
450 <?xml version="1.0" encoding="utf-8"?>
450 <?xml version="1.0" encoding="utf-8"?>
451 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
451 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
452 <testcase name="test-success.t" time="*"/> (glob)
452 <testcase name="test-success.t" time="*"/> (glob)
453 </testsuite>
453 </testsuite>
454
454
455 Missing skips or blacklisted skips don't count as executed:
455 Missing skips or blacklisted skips don't count as executed:
456 $ echo test-failure.t > blacklist
456 $ echo test-failure.t > blacklist
457 $ run-tests.py --with-hg=`which hg` --blacklist=blacklist \
457 $ run-tests.py --with-hg=`which hg` --blacklist=blacklist \
458 > test-failure.t test-bogus.t
458 > test-failure.t test-bogus.t
459 ss
459 ss
460 Skipped test-bogus.t: Doesn't exist
460 Skipped test-bogus.t: Doesn't exist
461 Skipped test-failure.t: blacklisted
461 Skipped test-failure.t: blacklisted
462 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
462 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
463
463
464 #if json
464 #if json
465
465
466 test for --json
466 test for --json
467 ==================
467 ==================
468
468
469 $ run-tests.py --with-hg=`which hg` --json
469 $ run-tests.py --with-hg=`which hg` --json
470
470
471 --- $TESTTMP/test-failure.t
471 --- $TESTTMP/test-failure.t
472 +++ $TESTTMP/test-failure.t.err
472 +++ $TESTTMP/test-failure.t.err
473 @@ -1,4 +1,4 @@
473 @@ -1,4 +1,4 @@
474 $ echo babar
474 $ echo babar
475 - rataxes
475 - rataxes
476 + babar
476 + babar
477 This is a noop statement so that
477 This is a noop statement so that
478 this test is still more bytes than success.
478 this test is still more bytes than success.
479
479
480 ERROR: test-failure.t output changed
480 ERROR: test-failure.t output changed
481 !.s
481 !.s
482 Skipped test-skip.t: skipped
482 Skipped test-skip.t: skipped
483 Failed test-failure.t: output changed
483 Failed test-failure.t: output changed
484 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
484 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
485 python hash seed: * (glob)
485 python hash seed: * (glob)
486 [1]
486 [1]
487
487
488 $ cat report.json
488 $ cat report.json
489 testreport ={
489 testreport ={
490 "test-failure.t": [\{] (re)
490 "test-failure.t": [\{] (re)
491 "csys": "\s*[\d\.]{4,5}", ? (re)
491 "csys": "\s*[\d\.]{4,5}", ? (re)
492 "cuser": "\s*[\d\.]{4,5}", ? (re)
492 "cuser": "\s*[\d\.]{4,5}", ? (re)
493 "end": "\s*[\d\.]{4,5}", ? (re)
493 "end": "\s*[\d\.]{4,5}", ? (re)
494 "result": "failure", ? (re)
494 "result": "failure", ? (re)
495 "start": "\s*[\d\.]{4,5}", ? (re)
495 "start": "\s*[\d\.]{4,5}", ? (re)
496 "time": "\s*[\d\.]{4,5}" (re)
496 "time": "\s*[\d\.]{4,5}" (re)
497 }, ? (re)
497 }, ? (re)
498 "test-skip.t": {
498 "test-skip.t": {
499 "csys": "\s*[\d\.]{4,5}", ? (re)
499 "csys": "\s*[\d\.]{4,5}", ? (re)
500 "cuser": "\s*[\d\.]{4,5}", ? (re)
500 "cuser": "\s*[\d\.]{4,5}", ? (re)
501 "end": "\s*[\d\.]{4,5}", ? (re)
501 "end": "\s*[\d\.]{4,5}", ? (re)
502 "result": "skip", ? (re)
502 "result": "skip", ? (re)
503 "start": "\s*[\d\.]{4,5}", ? (re)
503 "start": "\s*[\d\.]{4,5}", ? (re)
504 "time": "\s*[\d\.]{4,5}" (re)
504 "time": "\s*[\d\.]{4,5}" (re)
505 }, ? (re)
505 }, ? (re)
506 "test-success.t": [\{] (re)
506 "test-success.t": [\{] (re)
507 "csys": "\s*[\d\.]{4,5}", ? (re)
507 "csys": "\s*[\d\.]{4,5}", ? (re)
508 "cuser": "\s*[\d\.]{4,5}", ? (re)
508 "cuser": "\s*[\d\.]{4,5}", ? (re)
509 "end": "\s*[\d\.]{4,5}", ? (re)
509 "end": "\s*[\d\.]{4,5}", ? (re)
510 "result": "success", ? (re)
510 "result": "success", ? (re)
511 "start": "\s*[\d\.]{4,5}", ? (re)
511 "start": "\s*[\d\.]{4,5}", ? (re)
512 "time": "\s*[\d\.]{4,5}" (re)
512 "time": "\s*[\d\.]{4,5}" (re)
513 }
513 }
514 } (no-eol)
514 } (no-eol)
515
515
516 Test that failed test accepted through interactive are properly reported:
516 Test that failed test accepted through interactive are properly reported:
517
517
518 $ cp test-failure.t backup
518 $ cp test-failure.t backup
519 $ echo y | run-tests.py --with-hg=`which hg` --json -i
519 $ echo y | run-tests.py --with-hg=`which hg` --json -i
520
520
521 --- $TESTTMP/test-failure.t
521 --- $TESTTMP/test-failure.t
522 +++ $TESTTMP/test-failure.t.err
522 +++ $TESTTMP/test-failure.t.err
523 @@ -1,4 +1,4 @@
523 @@ -1,4 +1,4 @@
524 $ echo babar
524 $ echo babar
525 - rataxes
525 - rataxes
526 + babar
526 + babar
527 This is a noop statement so that
527 This is a noop statement so that
528 this test is still more bytes than success.
528 this test is still more bytes than success.
529 Accept this change? [n] ..s
529 Accept this change? [n] ..s
530 Skipped test-skip.t: skipped
530 Skipped test-skip.t: skipped
531 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
531 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
532
532
533 $ cat report.json
533 $ cat report.json
534 testreport ={
534 testreport ={
535 "test-failure.t": [\{] (re)
535 "test-failure.t": [\{] (re)
536 "csys": "\s*[\d\.]{4,5}", ? (re)
536 "csys": "\s*[\d\.]{4,5}", ? (re)
537 "cuser": "\s*[\d\.]{4,5}", ? (re)
537 "cuser": "\s*[\d\.]{4,5}", ? (re)
538 "end": "\s*[\d\.]{4,5}", ? (re)
538 "end": "\s*[\d\.]{4,5}", ? (re)
539 "result": "success", ? (re)
539 "result": "success", ? (re)
540 "start": "\s*[\d\.]{4,5}", ? (re)
540 "start": "\s*[\d\.]{4,5}", ? (re)
541 "time": "\s*[\d\.]{4,5}" (re)
541 "time": "\s*[\d\.]{4,5}" (re)
542 }, ? (re)
542 }, ? (re)
543 "test-skip.t": {
543 "test-skip.t": {
544 "csys": "\s*[\d\.]{4,5}", ? (re)
544 "csys": "\s*[\d\.]{4,5}", ? (re)
545 "cuser": "\s*[\d\.]{4,5}", ? (re)
545 "cuser": "\s*[\d\.]{4,5}", ? (re)
546 "end": "\s*[\d\.]{4,5}", ? (re)
546 "end": "\s*[\d\.]{4,5}", ? (re)
547 "result": "skip", ? (re)
547 "result": "skip", ? (re)
548 "start": "\s*[\d\.]{4,5}", ? (re)
548 "start": "\s*[\d\.]{4,5}", ? (re)
549 "time": "\s*[\d\.]{4,5}" (re)
549 "time": "\s*[\d\.]{4,5}" (re)
550 }, ? (re)
550 }, ? (re)
551 "test-success.t": [\{] (re)
551 "test-success.t": [\{] (re)
552 "csys": "\s*[\d\.]{4,5}", ? (re)
552 "csys": "\s*[\d\.]{4,5}", ? (re)
553 "cuser": "\s*[\d\.]{4,5}", ? (re)
553 "cuser": "\s*[\d\.]{4,5}", ? (re)
554 "end": "\s*[\d\.]{4,5}", ? (re)
554 "end": "\s*[\d\.]{4,5}", ? (re)
555 "result": "success", ? (re)
555 "result": "success", ? (re)
556 "start": "\s*[\d\.]{4,5}", ? (re)
556 "start": "\s*[\d\.]{4,5}", ? (re)
557 "time": "\s*[\d\.]{4,5}" (re)
557 "time": "\s*[\d\.]{4,5}" (re)
558 }
558 }
559 } (no-eol)
559 } (no-eol)
560 $ mv backup test-failure.t
560 $ mv backup test-failure.t
561
561
562 #endif
562 #endif
563
563
564 backslash on end of line with glob matching is handled properly
564 backslash on end of line with glob matching is handled properly
565
565
566 $ cat > test-glob-backslash.t << EOF
566 $ cat > test-glob-backslash.t << EOF
567 > $ echo 'foo bar \\'
567 > $ echo 'foo bar \\'
568 > foo * \ (glob)
568 > foo * \ (glob)
569 > EOF
569 > EOF
570
570
571 $ run-tests.py --with-hg=`which hg` test-glob-backslash.t
571 $ run-tests.py --with-hg=`which hg` test-glob-backslash.t
572 .
572 .
573 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
573 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
574
574
575 $ rm -f test-glob-backslash.t
575 $ rm -f test-glob-backslash.t
576
576
577 Test reusability for third party tools
577 Test reusability for third party tools
578 ======================================
578 ======================================
579
579
580 $ mkdir "$TESTTMP"/anothertests
580 $ mkdir "$TESTTMP"/anothertests
581 $ cd "$TESTTMP"/anothertests
581 $ cd "$TESTTMP"/anothertests
582
582
583 test that `run-tests.py` can execute hghave, even if it runs not in
583 test that `run-tests.py` can execute hghave, even if it runs not in
584 Mercurial source tree.
584 Mercurial source tree.
585
585
586 $ cat > test-hghave.t <<EOF
586 $ cat > test-hghave.t <<EOF
587 > #require true
587 > #require true
588 > $ echo foo
588 > $ echo foo
589 > foo
589 > foo
590 > EOF
590 > EOF
591 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-hghave.t
591 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-hghave.t
592 .
592 .
593 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
593 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
594
594
595 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
595 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
596 running is placed.
596 running is placed.
597
597
598 $ cat > test-runtestdir.t <<EOF
598 $ cat > test-runtestdir.t <<EOF
599 > - $TESTDIR, in which test-run-tests.t is placed
599 > - $TESTDIR, in which test-run-tests.t is placed
600 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
600 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
601 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
601 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
602 >
602 >
603 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
603 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
604 > $ test "\$RUNTESTDIR" = "$TESTDIR"
604 > $ test "\$RUNTESTDIR" = "$TESTDIR"
605 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
605 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py
606 > #!/usr/bin/env python
606 > #!/usr/bin/env python
607 > #
607 > #
608 > # check-code - a style and portability checker for Mercurial
608 > # check-code - a style and portability checker for Mercurial
609 > EOF
609 > EOF
610 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-runtestdir.t
610 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-runtestdir.t
611 .
611 .
612 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
612 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
613
613
614 #if execbit
614 #if execbit
615
615
616 test that TESTDIR is referred in PATH
616 test that TESTDIR is referred in PATH
617
617
618 $ cat > custom-command.sh <<EOF
618 $ cat > custom-command.sh <<EOF
619 > #!/bin/sh
619 > #!/bin/sh
620 > echo "hello world"
620 > echo "hello world"
621 > EOF
621 > EOF
622 $ chmod +x custom-command.sh
622 $ chmod +x custom-command.sh
623 $ cat > test-testdir-path.t <<EOF
623 $ cat > test-testdir-path.t <<EOF
624 > $ custom-command.sh
624 > $ custom-command.sh
625 > hello world
625 > hello world
626 > EOF
626 > EOF
627 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-testdir-path.t
627 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-testdir-path.t
628 .
628 .
629 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
629 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
630
630
631 #endif
631 #endif
632
632
633 test support for --allow-slow-tests
633 test support for --allow-slow-tests
634 $ cat > test-very-slow-test.t <<EOF
634 $ cat > test-very-slow-test.t <<EOF
635 > #require slow
635 > #require slow
636 > $ echo pass
636 > $ echo pass
637 > pass
637 > pass
638 > EOF
638 > EOF
639 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-very-slow-test.t
639 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-very-slow-test.t
640 s
640 s
641 Skipped test-very-slow-test.t: skipped
641 Skipped test-very-slow-test.t: skipped
642 # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
642 # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
643 $ run-tests.py $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
643 $ run-tests.py $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
644 .
644 .
645 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
645 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
General Comments 0
You need to be logged in to leave comments. Login now