##// END OF EJS Templates
test-run-tests.t: work around file.write() returning an int...
Augie Fackler -
r25054:af5a778f default
parent child Browse files
Show More
@@ -1,554 +1,554 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 $ $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE
13 $ $TESTDIR/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 > xyzzy
24 > xyzzy
25 > EOF
25 > EOF
26
26
27 $ $TESTDIR/run-tests.py --with-hg=`which hg`
27 $ $TESTDIR/run-tests.py --with-hg=`which hg`
28 .
28 .
29 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
29 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
30
30
31 failing test
31 failing test
32 ==================
32 ==================
33
33
34 $ cat > test-failure.t << EOF
34 $ cat > test-failure.t << EOF
35 > $ echo babar
35 > $ echo babar
36 > rataxes
36 > rataxes
37 > This is a noop statement so that
37 > This is a noop statement so that
38 > this test is still more bytes than success.
38 > this test is still more bytes than success.
39 > EOF
39 > EOF
40
40
41 >>> fh = open('test-failure-unicode.t', 'wb')
41 >>> fh = open('test-failure-unicode.t', 'wb')
42 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8'))
42 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
43 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8'))
43 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
44
44
45 $ $TESTDIR/run-tests.py --with-hg=`which hg`
45 $ $TESTDIR/run-tests.py --with-hg=`which hg`
46
46
47 --- $TESTTMP/test-failure.t
47 --- $TESTTMP/test-failure.t
48 +++ $TESTTMP/test-failure.t.err
48 +++ $TESTTMP/test-failure.t.err
49 @@ -1,4 +1,4 @@
49 @@ -1,4 +1,4 @@
50 $ echo babar
50 $ echo babar
51 - rataxes
51 - rataxes
52 + babar
52 + babar
53 This is a noop statement so that
53 This is a noop statement so that
54 this test is still more bytes than success.
54 this test is still more bytes than success.
55
55
56 ERROR: test-failure.t output changed
56 ERROR: test-failure.t output changed
57 !.
57 !.
58 --- $TESTTMP/test-failure-unicode.t
58 --- $TESTTMP/test-failure-unicode.t
59 +++ $TESTTMP/test-failure-unicode.t.err
59 +++ $TESTTMP/test-failure-unicode.t.err
60 @@ -1,2 +1,2 @@
60 @@ -1,2 +1,2 @@
61 $ echo babar\xce\xb1 (esc)
61 $ echo babar\xce\xb1 (esc)
62 - l\xce\xb5\xce\xb5t (esc)
62 - l\xce\xb5\xce\xb5t (esc)
63 + babar\xce\xb1 (esc)
63 + babar\xce\xb1 (esc)
64
64
65 ERROR: test-failure-unicode.t output changed
65 ERROR: test-failure-unicode.t output changed
66 !
66 !
67 Failed test-failure.t: output changed
67 Failed test-failure.t: output changed
68 Failed test-failure-unicode.t: output changed
68 Failed test-failure-unicode.t: output changed
69 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
69 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
70 python hash seed: * (glob)
70 python hash seed: * (glob)
71 [1]
71 [1]
72
72
73 test --xunit support
73 test --xunit support
74 $ $TESTDIR/run-tests.py --with-hg=`which hg` --xunit=xunit.xml
74 $ $TESTDIR/run-tests.py --with-hg=`which hg` --xunit=xunit.xml
75
75
76 --- $TESTTMP/test-failure.t
76 --- $TESTTMP/test-failure.t
77 +++ $TESTTMP/test-failure.t.err
77 +++ $TESTTMP/test-failure.t.err
78 @@ -1,4 +1,4 @@
78 @@ -1,4 +1,4 @@
79 $ echo babar
79 $ echo babar
80 - rataxes
80 - rataxes
81 + babar
81 + babar
82 This is a noop statement so that
82 This is a noop statement so that
83 this test is still more bytes than success.
83 this test is still more bytes than success.
84
84
85 ERROR: test-failure.t output changed
85 ERROR: test-failure.t output changed
86 !.
86 !.
87 --- $TESTTMP/test-failure-unicode.t
87 --- $TESTTMP/test-failure-unicode.t
88 +++ $TESTTMP/test-failure-unicode.t.err
88 +++ $TESTTMP/test-failure-unicode.t.err
89 @@ -1,2 +1,2 @@
89 @@ -1,2 +1,2 @@
90 $ echo babar\xce\xb1 (esc)
90 $ echo babar\xce\xb1 (esc)
91 - l\xce\xb5\xce\xb5t (esc)
91 - l\xce\xb5\xce\xb5t (esc)
92 + babar\xce\xb1 (esc)
92 + babar\xce\xb1 (esc)
93
93
94 ERROR: test-failure-unicode.t output changed
94 ERROR: test-failure-unicode.t output changed
95 !
95 !
96 Failed test-failure.t: output changed
96 Failed test-failure.t: output changed
97 Failed test-failure-unicode.t: output changed
97 Failed test-failure-unicode.t: output changed
98 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
98 # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
99 python hash seed: * (glob)
99 python hash seed: * (glob)
100 [1]
100 [1]
101 $ cat xunit.xml
101 $ cat xunit.xml
102 <?xml version="1.0" encoding="utf-8"?>
102 <?xml version="1.0" encoding="utf-8"?>
103 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
103 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
104 <testcase name="test-success.t" time="*"/> (glob)
104 <testcase name="test-success.t" time="*"/> (glob)
105 <testcase name="test-failure-unicode.t" time="*"> (glob)
105 <testcase name="test-failure-unicode.t" time="*"> (glob)
106 <![CDATA[--- $TESTTMP/test-failure-unicode.t
106 <![CDATA[--- $TESTTMP/test-failure-unicode.t
107 +++ $TESTTMP/test-failure-unicode.t.err
107 +++ $TESTTMP/test-failure-unicode.t.err
108 @@ -1,2 +1,2 @@
108 @@ -1,2 +1,2 @@
109 $ echo babar\xce\xb1 (esc)
109 $ echo babar\xce\xb1 (esc)
110 - l\xce\xb5\xce\xb5t (esc)
110 - l\xce\xb5\xce\xb5t (esc)
111 + babar\xce\xb1 (esc)
111 + babar\xce\xb1 (esc)
112 ]]> </testcase>
112 ]]> </testcase>
113 <testcase name="test-failure.t" time="*"> (glob)
113 <testcase name="test-failure.t" time="*"> (glob)
114 <![CDATA[--- $TESTTMP/test-failure.t
114 <![CDATA[--- $TESTTMP/test-failure.t
115 +++ $TESTTMP/test-failure.t.err
115 +++ $TESTTMP/test-failure.t.err
116 @@ -1,4 +1,4 @@
116 @@ -1,4 +1,4 @@
117 $ echo babar
117 $ echo babar
118 - rataxes
118 - rataxes
119 + babar
119 + babar
120 This is a noop statement so that
120 This is a noop statement so that
121 this test is still more bytes than success.
121 this test is still more bytes than success.
122 ]]> </testcase>
122 ]]> </testcase>
123 </testsuite>
123 </testsuite>
124
124
125 $ rm test-failure-unicode.t
125 $ rm test-failure-unicode.t
126
126
127 test for --retest
127 test for --retest
128 ====================
128 ====================
129
129
130 $ $TESTDIR/run-tests.py --with-hg=`which hg` --retest
130 $ $TESTDIR/run-tests.py --with-hg=`which hg` --retest
131
131
132 --- $TESTTMP/test-failure.t
132 --- $TESTTMP/test-failure.t
133 +++ $TESTTMP/test-failure.t.err
133 +++ $TESTTMP/test-failure.t.err
134 @@ -1,4 +1,4 @@
134 @@ -1,4 +1,4 @@
135 $ echo babar
135 $ echo babar
136 - rataxes
136 - rataxes
137 + babar
137 + babar
138 This is a noop statement so that
138 This is a noop statement so that
139 this test is still more bytes than success.
139 this test is still more bytes than success.
140
140
141 ERROR: test-failure.t output changed
141 ERROR: test-failure.t output changed
142 !
142 !
143 Failed test-failure.t: output changed
143 Failed test-failure.t: output changed
144 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
144 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
145 python hash seed: * (glob)
145 python hash seed: * (glob)
146 [1]
146 [1]
147
147
148 Selecting Tests To Run
148 Selecting Tests To Run
149 ======================
149 ======================
150
150
151 successful
151 successful
152
152
153 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-success.t
153 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-success.t
154 .
154 .
155 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
155 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
156
156
157 success w/ keyword
157 success w/ keyword
158 $ $TESTDIR/run-tests.py --with-hg=`which hg` -k xyzzy
158 $ $TESTDIR/run-tests.py --with-hg=`which hg` -k xyzzy
159 .
159 .
160 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
160 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
161
161
162 failed
162 failed
163
163
164 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-failure.t
164 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-failure.t
165
165
166 --- $TESTTMP/test-failure.t
166 --- $TESTTMP/test-failure.t
167 +++ $TESTTMP/test-failure.t.err
167 +++ $TESTTMP/test-failure.t.err
168 @@ -1,4 +1,4 @@
168 @@ -1,4 +1,4 @@
169 $ echo babar
169 $ echo babar
170 - rataxes
170 - rataxes
171 + babar
171 + babar
172 This is a noop statement so that
172 This is a noop statement so that
173 this test is still more bytes than success.
173 this test is still more bytes than success.
174
174
175 ERROR: test-failure.t output changed
175 ERROR: test-failure.t output changed
176 !
176 !
177 Failed test-failure.t: output changed
177 Failed test-failure.t: output changed
178 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
178 # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
179 python hash seed: * (glob)
179 python hash seed: * (glob)
180 [1]
180 [1]
181
181
182 failure w/ keyword
182 failure w/ keyword
183 $ $TESTDIR/run-tests.py --with-hg=`which hg` -k rataxes
183 $ $TESTDIR/run-tests.py --with-hg=`which hg` -k rataxes
184
184
185 --- $TESTTMP/test-failure.t
185 --- $TESTTMP/test-failure.t
186 +++ $TESTTMP/test-failure.t.err
186 +++ $TESTTMP/test-failure.t.err
187 @@ -1,4 +1,4 @@
187 @@ -1,4 +1,4 @@
188 $ echo babar
188 $ echo babar
189 - rataxes
189 - rataxes
190 + babar
190 + babar
191 This is a noop statement so that
191 This is a noop statement so that
192 this test is still more bytes than success.
192 this test is still more bytes than success.
193
193
194 ERROR: test-failure.t output changed
194 ERROR: test-failure.t output changed
195 !
195 !
196 Failed test-failure.t: output changed
196 Failed test-failure.t: output changed
197 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
197 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
198 python hash seed: * (glob)
198 python hash seed: * (glob)
199 [1]
199 [1]
200
200
201 Verify that when a process fails to start we show a useful message
201 Verify that when a process fails to start we show a useful message
202 ==================================================================
202 ==================================================================
203 NOTE: there is currently a bug where this shows "2 failed" even though
203 NOTE: there is currently a bug where this shows "2 failed" even though
204 it's actually the same test being reported for failure twice.
204 it's actually the same test being reported for failure twice.
205
205
206 $ cat > test-serve-fail.t <<EOF
206 $ cat > test-serve-fail.t <<EOF
207 > $ echo 'abort: child process failed to start blah'
207 > $ echo 'abort: child process failed to start blah'
208 > EOF
208 > EOF
209 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-serve-fail.t
209 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-serve-fail.t
210
210
211 ERROR: test-serve-fail.t output changed
211 ERROR: test-serve-fail.t output changed
212 !
212 !
213 ERROR: test-serve-fail.t output changed
213 ERROR: test-serve-fail.t output changed
214 !
214 !
215 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
215 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
216 Failed test-serve-fail.t: output changed
216 Failed test-serve-fail.t: output changed
217 # Ran 1 tests, 0 skipped, 0 warned, 2 failed.
217 # Ran 1 tests, 0 skipped, 0 warned, 2 failed.
218 python hash seed: * (glob)
218 python hash seed: * (glob)
219 [1]
219 [1]
220 $ rm test-serve-fail.t
220 $ rm test-serve-fail.t
221
221
222 Running In Debug Mode
222 Running In Debug Mode
223 ======================
223 ======================
224
224
225 $ $TESTDIR/run-tests.py --with-hg=`which hg` --debug 2>&1 | grep -v pwd
225 $ $TESTDIR/run-tests.py --with-hg=`which hg` --debug 2>&1 | grep -v pwd
226 + echo *SALT* 0 0 (glob)
226 + echo *SALT* 0 0 (glob)
227 *SALT* 0 0 (glob)
227 *SALT* 0 0 (glob)
228 + echo babar
228 + echo babar
229 babar
229 babar
230 + echo *SALT* 4 0 (glob)
230 + echo *SALT* 4 0 (glob)
231 *SALT* 4 0 (glob)
231 *SALT* 4 0 (glob)
232 .+ echo *SALT* 0 0 (glob)
232 .+ echo *SALT* 0 0 (glob)
233 *SALT* 0 0 (glob)
233 *SALT* 0 0 (glob)
234 + echo babar
234 + echo babar
235 babar
235 babar
236 + echo *SALT* 2 0 (glob)
236 + echo *SALT* 2 0 (glob)
237 *SALT* 2 0 (glob)
237 *SALT* 2 0 (glob)
238 + echo xyzzy
238 + echo xyzzy
239 xyzzy
239 xyzzy
240 + echo *SALT* 4 0 (glob)
240 + echo *SALT* 4 0 (glob)
241 *SALT* 4 0 (glob)
241 *SALT* 4 0 (glob)
242 .
242 .
243 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
243 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
244
244
245 Parallel runs
245 Parallel runs
246 ==============
246 ==============
247
247
248 (duplicate the failing test to get predictable output)
248 (duplicate the failing test to get predictable output)
249 $ cp test-failure.t test-failure-copy.t
249 $ cp test-failure.t test-failure-copy.t
250
250
251 $ $TESTDIR/run-tests.py --with-hg=`which hg` --jobs 2 test-failure*.t -n
251 $ $TESTDIR/run-tests.py --with-hg=`which hg` --jobs 2 test-failure*.t -n
252 !!
252 !!
253 Failed test-failure*.t: output changed (glob)
253 Failed test-failure*.t: output changed (glob)
254 Failed test-failure*.t: output changed (glob)
254 Failed test-failure*.t: output changed (glob)
255 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
255 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
256 python hash seed: * (glob)
256 python hash seed: * (glob)
257 [1]
257 [1]
258
258
259 failures in parallel with --first should only print one failure
259 failures in parallel with --first should only print one failure
260 >>> f = open('test-nothing.t', 'w')
260 >>> f = open('test-nothing.t', 'w')
261 >>> f.write('foo\n' * 1024)
261 >>> f.write('foo\n' * 1024) and None
262 >>> f.write(' $ sleep 1')
262 >>> f.write(' $ sleep 1') and None
263 $ $TESTDIR/run-tests.py --with-hg=`which hg` --jobs 2 --first
263 $ $TESTDIR/run-tests.py --with-hg=`which hg` --jobs 2 --first
264
264
265 --- $TESTTMP/test-failure*.t (glob)
265 --- $TESTTMP/test-failure*.t (glob)
266 +++ $TESTTMP/test-failure*.t.err (glob)
266 +++ $TESTTMP/test-failure*.t.err (glob)
267 @@ -1,4 +1,4 @@
267 @@ -1,4 +1,4 @@
268 $ echo babar
268 $ echo babar
269 - rataxes
269 - rataxes
270 + babar
270 + babar
271 This is a noop statement so that
271 This is a noop statement so that
272 this test is still more bytes than success.
272 this test is still more bytes than success.
273
273
274 Failed test-failure*.t: output changed (glob)
274 Failed test-failure*.t: output changed (glob)
275 Failed test-nothing.t: output changed
275 Failed test-nothing.t: output changed
276 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
276 # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
277 python hash seed: * (glob)
277 python hash seed: * (glob)
278 [1]
278 [1]
279
279
280
280
281 (delete the duplicated test file)
281 (delete the duplicated test file)
282 $ rm test-failure-copy.t test-nothing.t
282 $ rm test-failure-copy.t test-nothing.t
283
283
284
284
285 Interactive run
285 Interactive run
286 ===============
286 ===============
287
287
288 (backup the failing test)
288 (backup the failing test)
289 $ cp test-failure.t backup
289 $ cp test-failure.t backup
290
290
291 Refuse the fix
291 Refuse the fix
292
292
293 $ echo 'n' | $TESTDIR/run-tests.py --with-hg=`which hg` -i
293 $ echo 'n' | $TESTDIR/run-tests.py --with-hg=`which hg` -i
294
294
295 --- $TESTTMP/test-failure.t
295 --- $TESTTMP/test-failure.t
296 +++ $TESTTMP/test-failure.t.err
296 +++ $TESTTMP/test-failure.t.err
297 @@ -1,4 +1,4 @@
297 @@ -1,4 +1,4 @@
298 $ echo babar
298 $ echo babar
299 - rataxes
299 - rataxes
300 + babar
300 + babar
301 This is a noop statement so that
301 This is a noop statement so that
302 this test is still more bytes than success.
302 this test is still more bytes than success.
303 Accept this change? [n]
303 Accept this change? [n]
304 ERROR: test-failure.t output changed
304 ERROR: test-failure.t output changed
305 !.
305 !.
306 Failed test-failure.t: output changed
306 Failed test-failure.t: output changed
307 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
307 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
308 python hash seed: * (glob)
308 python hash seed: * (glob)
309 [1]
309 [1]
310
310
311 $ cat test-failure.t
311 $ cat test-failure.t
312 $ echo babar
312 $ echo babar
313 rataxes
313 rataxes
314 This is a noop statement so that
314 This is a noop statement so that
315 this test is still more bytes than success.
315 this test is still more bytes than success.
316
316
317 Interactive with custom view
317 Interactive with custom view
318
318
319 $ echo 'n' | $TESTDIR/run-tests.py --with-hg=`which hg` -i --view echo
319 $ echo 'n' | $TESTDIR/run-tests.py --with-hg=`which hg` -i --view echo
320 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
320 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
321 Accept this change? [n]* (glob)
321 Accept this change? [n]* (glob)
322 ERROR: test-failure.t output changed
322 ERROR: test-failure.t output changed
323 !.
323 !.
324 Failed test-failure.t: output changed
324 Failed test-failure.t: output changed
325 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
325 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
326 python hash seed: * (glob)
326 python hash seed: * (glob)
327 [1]
327 [1]
328
328
329 View the fix
329 View the fix
330
330
331 $ echo 'y' | $TESTDIR/run-tests.py --with-hg=`which hg` --view echo
331 $ echo 'y' | $TESTDIR/run-tests.py --with-hg=`which hg` --view echo
332 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
332 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
333
333
334 ERROR: test-failure.t output changed
334 ERROR: test-failure.t output changed
335 !.
335 !.
336 Failed test-failure.t: output changed
336 Failed test-failure.t: output changed
337 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
337 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
338 python hash seed: * (glob)
338 python hash seed: * (glob)
339 [1]
339 [1]
340
340
341 Accept the fix
341 Accept the fix
342
342
343 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
343 $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
344 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
344 $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
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 (glob)" >> test-failure.t
346 $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> 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/*.hg (glob)" >> test-failure.t
348 $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
349 $ echo 'y' | $TESTDIR/run-tests.py --with-hg=`which hg` -i 2>&1 | \
349 $ echo 'y' | $TESTDIR/run-tests.py --with-hg=`which hg` -i 2>&1 | \
350 > sed -e 's,(glob)$,&<,g'
350 > sed -e 's,(glob)$,&<,g'
351
351
352 --- $TESTTMP/test-failure.t
352 --- $TESTTMP/test-failure.t
353 +++ $TESTTMP/test-failure.t.err
353 +++ $TESTTMP/test-failure.t.err
354 @@ -1,9 +1,9 @@
354 @@ -1,9 +1,9 @@
355 $ echo babar
355 $ echo babar
356 - rataxes
356 - rataxes
357 + babar
357 + babar
358 This is a noop statement so that
358 This is a noop statement so that
359 this test is still more bytes than success.
359 this test is still more bytes than success.
360 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
360 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
361 - saved backup bundle to $TESTTMP/foo.hg
361 - saved backup bundle to $TESTTMP/foo.hg
362 + saved backup bundle to $TESTTMP/foo.hg (glob)<
362 + saved backup bundle to $TESTTMP/foo.hg (glob)<
363 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
363 $ echo '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 Accept this change? [n] ..
366 Accept this change? [n] ..
367 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
367 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
368
368
369 $ sed -e 's,(glob)$,&<,g' test-failure.t
369 $ sed -e 's,(glob)$,&<,g' test-failure.t
370 $ echo babar
370 $ echo babar
371 babar
371 babar
372 This is a noop statement so that
372 This is a noop statement so that
373 this test is still more bytes than success.
373 this test is still more bytes than success.
374 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
374 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
375 saved backup bundle to $TESTTMP/foo.hg (glob)<
375 saved backup bundle to $TESTTMP/foo.hg (glob)<
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/*.hg (glob)<
379 saved backup bundle to $TESTTMP/*.hg (glob)<
380
380
381 (reinstall)
381 (reinstall)
382 $ mv backup test-failure.t
382 $ mv backup test-failure.t
383
383
384 No Diff
384 No Diff
385 ===============
385 ===============
386
386
387 $ $TESTDIR/run-tests.py --with-hg=`which hg` --nodiff
387 $ $TESTDIR/run-tests.py --with-hg=`which hg` --nodiff
388 !.
388 !.
389 Failed test-failure.t: output changed
389 Failed test-failure.t: output changed
390 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
390 # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
391 python hash seed: * (glob)
391 python hash seed: * (glob)
392 [1]
392 [1]
393
393
394 test for --time
394 test for --time
395 ==================
395 ==================
396
396
397 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-success.t --time
397 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-success.t --time
398 .
398 .
399 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
399 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
400 # Producing time report
400 # Producing time report
401 cuser csys real Test
401 cuser csys real Test
402 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
402 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
403
403
404 test for --time with --job enabled
404 test for --time with --job enabled
405 ====================================
405 ====================================
406
406
407 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-success.t --time --jobs 2
407 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-success.t --time --jobs 2
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 cuser csys real Test
411 cuser csys real Test
412 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
412 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
413
413
414 Skips
414 Skips
415 ================
415 ================
416 $ cat > test-skip.t <<EOF
416 $ cat > test-skip.t <<EOF
417 > $ echo xyzzy
417 > $ echo xyzzy
418 > #require false
418 > #require false
419 > EOF
419 > EOF
420 $ $TESTDIR/run-tests.py --with-hg=`which hg` --nodiff
420 $ $TESTDIR/run-tests.py --with-hg=`which hg` --nodiff
421 !.s
421 !.s
422 Skipped test-skip.t: skipped
422 Skipped test-skip.t: skipped
423 Failed test-failure.t: output changed
423 Failed test-failure.t: output changed
424 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
424 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
425 python hash seed: * (glob)
425 python hash seed: * (glob)
426 [1]
426 [1]
427
427
428 $ $TESTDIR/run-tests.py --with-hg=`which hg` --keyword xyzzy
428 $ $TESTDIR/run-tests.py --with-hg=`which hg` --keyword xyzzy
429 .s
429 .s
430 Skipped test-skip.t: skipped
430 Skipped test-skip.t: skipped
431 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
431 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
432
432
433 Skips with xml
433 Skips with xml
434 $ $TESTDIR/run-tests.py --with-hg=`which hg` --keyword xyzzy \
434 $ $TESTDIR/run-tests.py --with-hg=`which hg` --keyword xyzzy \
435 > --xunit=xunit.xml
435 > --xunit=xunit.xml
436 .s
436 .s
437 Skipped test-skip.t: skipped
437 Skipped test-skip.t: skipped
438 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
438 # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
439 $ cat xunit.xml
439 $ cat xunit.xml
440 <?xml version="1.0" encoding="utf-8"?>
440 <?xml version="1.0" encoding="utf-8"?>
441 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
441 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
442 <testcase name="test-success.t" time="*"/> (glob)
442 <testcase name="test-success.t" time="*"/> (glob)
443 </testsuite>
443 </testsuite>
444
444
445 Missing skips or blacklisted skips don't count as executed:
445 Missing skips or blacklisted skips don't count as executed:
446 $ echo test-failure.t > blacklist
446 $ echo test-failure.t > blacklist
447 $ $TESTDIR/run-tests.py --with-hg=`which hg` --blacklist=blacklist \
447 $ $TESTDIR/run-tests.py --with-hg=`which hg` --blacklist=blacklist \
448 > test-failure.t test-bogus.t
448 > test-failure.t test-bogus.t
449 ss
449 ss
450 Skipped test-bogus.t: Doesn't exist
450 Skipped test-bogus.t: Doesn't exist
451 Skipped test-failure.t: blacklisted
451 Skipped test-failure.t: blacklisted
452 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
452 # Ran 0 tests, 2 skipped, 0 warned, 0 failed.
453
453
454 #if json
454 #if json
455
455
456 test for --json
456 test for --json
457 ==================
457 ==================
458
458
459 $ $TESTDIR/run-tests.py --with-hg=`which hg` --json
459 $ $TESTDIR/run-tests.py --with-hg=`which hg` --json
460
460
461 --- $TESTTMP/test-failure.t
461 --- $TESTTMP/test-failure.t
462 +++ $TESTTMP/test-failure.t.err
462 +++ $TESTTMP/test-failure.t.err
463 @@ -1,4 +1,4 @@
463 @@ -1,4 +1,4 @@
464 $ echo babar
464 $ echo babar
465 - rataxes
465 - rataxes
466 + babar
466 + babar
467 This is a noop statement so that
467 This is a noop statement so that
468 this test is still more bytes than success.
468 this test is still more bytes than success.
469
469
470 ERROR: test-failure.t output changed
470 ERROR: test-failure.t output changed
471 !.s
471 !.s
472 Skipped test-skip.t: skipped
472 Skipped test-skip.t: skipped
473 Failed test-failure.t: output changed
473 Failed test-failure.t: output changed
474 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
474 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
475 python hash seed: * (glob)
475 python hash seed: * (glob)
476 [1]
476 [1]
477
477
478 $ cat report.json
478 $ cat report.json
479 testreport ={
479 testreport ={
480 "test-failure.t": [\{] (re)
480 "test-failure.t": [\{] (re)
481 "csys": "\s*[\d\.]{4,5}", ? (re)
481 "csys": "\s*[\d\.]{4,5}", ? (re)
482 "cuser": "\s*[\d\.]{4,5}", ? (re)
482 "cuser": "\s*[\d\.]{4,5}", ? (re)
483 "result": "failure", ? (re)
483 "result": "failure", ? (re)
484 "time": "\s*[\d\.]{4,5}" (re)
484 "time": "\s*[\d\.]{4,5}" (re)
485 }, ? (re)
485 }, ? (re)
486 "test-skip.t": {
486 "test-skip.t": {
487 "csys": "\s*[\d\.]{4,5}", ? (re)
487 "csys": "\s*[\d\.]{4,5}", ? (re)
488 "cuser": "\s*[\d\.]{4,5}", ? (re)
488 "cuser": "\s*[\d\.]{4,5}", ? (re)
489 "result": "skip", ? (re)
489 "result": "skip", ? (re)
490 "time": "\s*[\d\.]{4,5}" (re)
490 "time": "\s*[\d\.]{4,5}" (re)
491 }, ? (re)
491 }, ? (re)
492 "test-success.t": [\{] (re)
492 "test-success.t": [\{] (re)
493 "csys": "\s*[\d\.]{4,5}", ? (re)
493 "csys": "\s*[\d\.]{4,5}", ? (re)
494 "cuser": "\s*[\d\.]{4,5}", ? (re)
494 "cuser": "\s*[\d\.]{4,5}", ? (re)
495 "result": "success", ? (re)
495 "result": "success", ? (re)
496 "time": "\s*[\d\.]{4,5}" (re)
496 "time": "\s*[\d\.]{4,5}" (re)
497 }
497 }
498 } (no-eol)
498 } (no-eol)
499
499
500 Test that failed test accepted through interactive are properly reported:
500 Test that failed test accepted through interactive are properly reported:
501
501
502 $ cp test-failure.t backup
502 $ cp test-failure.t backup
503 $ echo y | $TESTDIR/run-tests.py --with-hg=`which hg` --json -i
503 $ echo y | $TESTDIR/run-tests.py --with-hg=`which hg` --json -i
504
504
505 --- $TESTTMP/test-failure.t
505 --- $TESTTMP/test-failure.t
506 +++ $TESTTMP/test-failure.t.err
506 +++ $TESTTMP/test-failure.t.err
507 @@ -1,4 +1,4 @@
507 @@ -1,4 +1,4 @@
508 $ echo babar
508 $ echo babar
509 - rataxes
509 - rataxes
510 + babar
510 + babar
511 This is a noop statement so that
511 This is a noop statement so that
512 this test is still more bytes than success.
512 this test is still more bytes than success.
513 Accept this change? [n] ..s
513 Accept this change? [n] ..s
514 Skipped test-skip.t: skipped
514 Skipped test-skip.t: skipped
515 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
515 # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
516
516
517 $ cat report.json
517 $ cat report.json
518 testreport ={
518 testreport ={
519 "test-failure.t": [\{] (re)
519 "test-failure.t": [\{] (re)
520 "csys": "\s*[\d\.]{4,5}", ? (re)
520 "csys": "\s*[\d\.]{4,5}", ? (re)
521 "cuser": "\s*[\d\.]{4,5}", ? (re)
521 "cuser": "\s*[\d\.]{4,5}", ? (re)
522 "result": "success", ? (re)
522 "result": "success", ? (re)
523 "time": "\s*[\d\.]{4,5}" (re)
523 "time": "\s*[\d\.]{4,5}" (re)
524 }, ? (re)
524 }, ? (re)
525 "test-skip.t": {
525 "test-skip.t": {
526 "csys": "\s*[\d\.]{4,5}", ? (re)
526 "csys": "\s*[\d\.]{4,5}", ? (re)
527 "cuser": "\s*[\d\.]{4,5}", ? (re)
527 "cuser": "\s*[\d\.]{4,5}", ? (re)
528 "result": "skip", ? (re)
528 "result": "skip", ? (re)
529 "time": "\s*[\d\.]{4,5}" (re)
529 "time": "\s*[\d\.]{4,5}" (re)
530 }, ? (re)
530 }, ? (re)
531 "test-success.t": [\{] (re)
531 "test-success.t": [\{] (re)
532 "csys": "\s*[\d\.]{4,5}", ? (re)
532 "csys": "\s*[\d\.]{4,5}", ? (re)
533 "cuser": "\s*[\d\.]{4,5}", ? (re)
533 "cuser": "\s*[\d\.]{4,5}", ? (re)
534 "result": "success", ? (re)
534 "result": "success", ? (re)
535 "time": "\s*[\d\.]{4,5}" (re)
535 "time": "\s*[\d\.]{4,5}" (re)
536 }
536 }
537 } (no-eol)
537 } (no-eol)
538 $ mv backup test-failure.t
538 $ mv backup test-failure.t
539
539
540 #endif
540 #endif
541
541
542 backslash on end of line with glob matching is handled properly
542 backslash on end of line with glob matching is handled properly
543
543
544 $ cat > test-glob-backslash.t << EOF
544 $ cat > test-glob-backslash.t << EOF
545 > $ echo 'foo bar \\'
545 > $ echo 'foo bar \\'
546 > foo * \ (glob)
546 > foo * \ (glob)
547 > EOF
547 > EOF
548
548
549 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-glob-backslash.t
549 $ $TESTDIR/run-tests.py --with-hg=`which hg` test-glob-backslash.t
550 .
550 .
551 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
551 # Ran 1 tests, 0 skipped, 0 warned, 0 failed.
552
552
553 $ rm -f test-glob-backslash.t
553 $ rm -f test-glob-backslash.t
554
554
General Comments 0
You need to be logged in to leave comments. Login now