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