##// END OF EJS Templates
tests: allow the true command to be provided by coreutils...
pacien -
r49134:bc04a761 stable
parent child Browse files
Show More
@@ -1,2085 +1,2085 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 $ . "$TESTDIR/helper-runtests.sh"
6 6
7 7 Smoke test with install
8 8 ============
9 9 $ "$PYTHON" $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE -l
10 10 running 0 tests using 0 parallel processes
11 11
12 12 # Ran 0 tests, 0 skipped, 0 failed.
13 13
14 14 Define a helper to avoid the install step
15 15 =============
16 16 $ rt()
17 17 > {
18 18 > "$PYTHON" $TESTDIR/run-tests.py --with-hg=$HGTEST_REAL_HG -j1 "$@"
19 19 > }
20 20
21 21 error paths
22 22
23 23 #if symlink
24 24 $ ln -s `which true` hg
25 25 $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
26 warning: --with-hg should specify an hg script, not: true
26 ^warning: --with-hg should specify an hg script, not: (true|coreutils)$ (re)
27 27 running 0 tests using 0 parallel processes
28 28
29 29 # Ran 0 tests, 0 skipped, 0 failed.
30 30 $ rm hg
31 31 #endif
32 32
33 33 #if execbit
34 34 $ touch hg
35 35 $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
36 36 usage: run-tests.py [options] [tests]
37 37 run-tests.py: error: --with-hg must specify an executable hg script
38 38 [2]
39 39 $ rm hg
40 40 #endif
41 41
42 42 Features for testing optional lines
43 43 ===================================
44 44
45 45 $ cat > hghaveaddon.py <<EOF
46 46 > import hghave
47 47 > @hghave.check("custom", "custom hghave feature")
48 48 > def has_custom():
49 49 > return True
50 50 > @hghave.check("missing", "missing hghave feature")
51 51 > def has_missing():
52 52 > return False
53 53 > EOF
54 54
55 55 an empty test
56 56 =======================
57 57
58 58 $ touch test-empty.t
59 59 $ rt
60 60 running 1 tests using 1 parallel processes
61 61 .
62 62 # Ran 1 tests, 0 skipped, 0 failed.
63 63 $ rm test-empty.t
64 64
65 65 a succesful test
66 66 =======================
67 67
68 68 $ cat > test-success.t << EOF
69 69 > $ echo babar
70 70 > babar
71 71 > $ echo xyzzy
72 72 > dont_print (?)
73 73 > nothing[42]line (re) (?)
74 74 > never*happens (glob) (?)
75 75 > more_nothing (?)
76 76 > xyzzy
77 77 > nor this (?)
78 78 > $ printf 'abc\ndef\nxyz\n'
79 79 > 123 (?)
80 80 > abc
81 81 > def (?)
82 82 > 456 (?)
83 83 > xyz
84 84 > $ printf 'zyx\nwvu\ntsr\n'
85 85 > abc (?)
86 86 > zyx (custom !)
87 87 > wvu
88 88 > no_print (no-custom !)
89 89 > tsr (no-missing !)
90 90 > missing (missing !)
91 91 > EOF
92 92
93 93 $ rt
94 94 running 1 tests using 1 parallel processes
95 95 .
96 96 # Ran 1 tests, 0 skipped, 0 failed.
97 97
98 98 failing test
99 99 ==================
100 100
101 101 test churn with globs
102 102 $ cat > test-failure.t <<EOF
103 103 > $ echo "bar-baz"; echo "bar-bad"; echo foo
104 104 > bar*bad (glob)
105 105 > bar*baz (glob)
106 106 > | fo (re)
107 107 > EOF
108 108 $ rt test-failure.t
109 109 running 1 tests using 1 parallel processes
110 110
111 111 --- $TESTTMP/test-failure.t
112 112 +++ $TESTTMP/test-failure.t.err
113 113 @@ -1,4 +1,4 @@
114 114 $ echo "bar-baz"; echo "bar-bad"; echo foo
115 115 + bar*baz (glob)
116 116 bar*bad (glob)
117 117 - bar*baz (glob)
118 118 - | fo (re)
119 119 + foo
120 120
121 121 ERROR: test-failure.t output changed
122 122 !
123 123 Failed test-failure.t: output changed
124 124 # Ran 1 tests, 0 skipped, 1 failed.
125 125 python hash seed: * (glob)
126 126 [1]
127 127
128 128 test how multiple globs gets matched with lines in output
129 129 $ cat > test-failure-globs.t <<EOF
130 130 > $ echo "context"; echo "context"; \
131 131 > echo "key: 1"; echo "value: not a"; \
132 132 > echo "key: 2"; echo "value: not b"; \
133 133 > echo "key: 3"; echo "value: c"; \
134 134 > echo "key: 4"; echo "value: d"
135 135 > context
136 136 > context
137 137 > key: 1
138 138 > value: a
139 139 > key: 2
140 140 > value: b
141 141 > key: 3
142 142 > value: * (glob)
143 143 > key: 4
144 144 > value: * (glob)
145 145 > EOF
146 146 $ rt test-failure-globs.t
147 147 running 1 tests using 1 parallel processes
148 148
149 149 --- $TESTTMP/test-failure-globs.t
150 150 +++ $TESTTMP/test-failure-globs.t.err
151 151 @@ -2,9 +2,9 @@
152 152 context
153 153 context
154 154 key: 1
155 155 - value: a
156 156 + value: not a
157 157 key: 2
158 158 - value: b
159 159 + value: not b
160 160 key: 3
161 161 value: * (glob)
162 162 key: 4
163 163
164 164 ERROR: test-failure-globs.t output changed
165 165 !
166 166 Failed test-failure-globs.t: output changed
167 167 # Ran 1 tests, 0 skipped, 1 failed.
168 168 python hash seed: * (glob)
169 169 [1]
170 170 $ rm test-failure-globs.t
171 171
172 172 test diff colorisation
173 173
174 174 #if no-windows pygments
175 175 $ rt test-failure.t --color always
176 176 running 1 tests using 1 parallel processes
177 177
178 178 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
179 179 \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
180 180 \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
181 181 $ echo "bar-baz"; echo "bar-bad"; echo foo
182 182 \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc)
183 183 bar*bad (glob)
184 184 \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc)
185 185 \x1b[38;5;124m- | fo (re)\x1b[39m (esc)
186 186 \x1b[38;5;34m+ foo\x1b[39m (esc)
187 187
188 188 \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
189 189 !
190 190 \x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc)
191 191 # Ran 1 tests, 0 skipped, 1 failed.
192 192 python hash seed: * (glob)
193 193 [1]
194 194
195 195 $ rt test-failure.t 2> tmp.log
196 196 running 1 tests using 1 parallel processes
197 197 [1]
198 198 $ cat tmp.log
199 199
200 200 --- $TESTTMP/test-failure.t
201 201 +++ $TESTTMP/test-failure.t.err
202 202 @@ -1,4 +1,4 @@
203 203 $ echo "bar-baz"; echo "bar-bad"; echo foo
204 204 + bar*baz (glob)
205 205 bar*bad (glob)
206 206 - bar*baz (glob)
207 207 - | fo (re)
208 208 + foo
209 209
210 210 ERROR: test-failure.t output changed
211 211 !
212 212 Failed test-failure.t: output changed
213 213 # Ran 1 tests, 0 skipped, 1 failed.
214 214 python hash seed: * (glob)
215 215 #endif
216 216
217 217 $ cat > test-failure.t << EOF
218 218 > $ true
219 219 > should go away (true !)
220 220 > $ true
221 221 > should stay (false !)
222 222 >
223 223 > Should remove first line, not second or third
224 224 > $ echo 'testing'
225 225 > baz*foo (glob) (true !)
226 226 > foobar*foo (glob) (false !)
227 227 > te*ting (glob) (true !)
228 228 >
229 229 > Should keep first two lines, remove third and last
230 230 > $ echo 'testing'
231 231 > test.ng (re) (true !)
232 232 > foo.ar (re) (false !)
233 233 > b.r (re) (true !)
234 234 > missing (?)
235 235 > awol (true !)
236 236 >
237 237 > The "missing" line should stay, even though awol is dropped
238 238 > $ echo 'testing'
239 239 > test.ng (re) (true !)
240 240 > foo.ar (?)
241 241 > awol
242 242 > missing (?)
243 243 > EOF
244 244 $ rt test-failure.t
245 245 running 1 tests using 1 parallel processes
246 246
247 247 --- $TESTTMP/test-failure.t
248 248 +++ $TESTTMP/test-failure.t.err
249 249 @@ -1,11 +1,9 @@
250 250 $ true
251 251 - should go away (true !)
252 252 $ true
253 253 should stay (false !)
254 254
255 255 Should remove first line, not second or third
256 256 $ echo 'testing'
257 257 - baz*foo (glob) (true !)
258 258 foobar*foo (glob) (false !)
259 259 te*ting (glob) (true !)
260 260
261 261 foo.ar (re) (false !)
262 262 missing (?)
263 263 @@ -13,13 +11,10 @@
264 264 $ echo 'testing'
265 265 test.ng (re) (true !)
266 266 foo.ar (re) (false !)
267 267 - b.r (re) (true !)
268 268 missing (?)
269 269 - awol (true !)
270 270
271 271 The "missing" line should stay, even though awol is dropped
272 272 $ echo 'testing'
273 273 test.ng (re) (true !)
274 274 foo.ar (?)
275 275 - awol
276 276 missing (?)
277 277
278 278 ERROR: test-failure.t output changed
279 279 !
280 280 Failed test-failure.t: output changed
281 281 # Ran 1 tests, 0 skipped, 1 failed.
282 282 python hash seed: * (glob)
283 283 [1]
284 284
285 285 basic failing test
286 286 $ cat > test-failure.t << EOF
287 287 > $ echo babar
288 288 > rataxes
289 289 > This is a noop statement so that
290 290 > this test is still more bytes than success.
291 291 > pad pad pad pad............................................................
292 292 > pad pad pad pad............................................................
293 293 > pad pad pad pad............................................................
294 294 > pad pad pad pad............................................................
295 295 > pad pad pad pad............................................................
296 296 > pad pad pad pad............................................................
297 297 > EOF
298 298
299 299 >>> fh = open('test-failure-unicode.t', 'wb')
300 300 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
301 301 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
302 302
303 303 $ rt
304 304 running 3 tests using 1 parallel processes
305 305
306 306 --- $TESTTMP/test-failure.t
307 307 +++ $TESTTMP/test-failure.t.err
308 308 @@ -1,5 +1,5 @@
309 309 $ echo babar
310 310 - rataxes
311 311 + babar
312 312 This is a noop statement so that
313 313 this test is still more bytes than success.
314 314 pad pad pad pad............................................................
315 315
316 316 ERROR: test-failure.t output changed
317 317 !.
318 318 --- $TESTTMP/test-failure-unicode.t
319 319 +++ $TESTTMP/test-failure-unicode.t.err
320 320 @@ -1,2 +1,2 @@
321 321 $ echo babar\xce\xb1 (esc)
322 322 - l\xce\xb5\xce\xb5t (esc)
323 323 + babar\xce\xb1 (esc)
324 324
325 325 ERROR: test-failure-unicode.t output changed
326 326 !
327 327 Failed test-failure-unicode.t: output changed
328 328 Failed test-failure.t: output changed
329 329 # Ran 3 tests, 0 skipped, 2 failed.
330 330 python hash seed: * (glob)
331 331 [1]
332 332
333 333 test --outputdir
334 334 $ mkdir output
335 335 $ rt --outputdir output
336 336 running 3 tests using 1 parallel processes
337 337
338 338 --- $TESTTMP/test-failure.t
339 339 +++ $TESTTMP/output/test-failure.t.err
340 340 @@ -1,5 +1,5 @@
341 341 $ echo babar
342 342 - rataxes
343 343 + babar
344 344 This is a noop statement so that
345 345 this test is still more bytes than success.
346 346 pad pad pad pad............................................................
347 347
348 348 ERROR: test-failure.t output changed
349 349 !.
350 350 --- $TESTTMP/test-failure-unicode.t
351 351 +++ $TESTTMP/output/test-failure-unicode.t.err
352 352 @@ -1,2 +1,2 @@
353 353 $ echo babar\xce\xb1 (esc)
354 354 - l\xce\xb5\xce\xb5t (esc)
355 355 + babar\xce\xb1 (esc)
356 356
357 357 ERROR: test-failure-unicode.t output changed
358 358 !
359 359 Failed test-failure-unicode.t: output changed
360 360 Failed test-failure.t: output changed
361 361 # Ran 3 tests, 0 skipped, 2 failed.
362 362 python hash seed: * (glob)
363 363 [1]
364 364 $ ls -a output
365 365 .
366 366 ..
367 367 .testtimes
368 368 test-failure-unicode.t.err
369 369 test-failure.t.err
370 370
371 371 test --xunit support
372 372 $ rt --xunit=xunit.xml
373 373 running 3 tests using 1 parallel processes
374 374
375 375 --- $TESTTMP/test-failure.t
376 376 +++ $TESTTMP/test-failure.t.err
377 377 @@ -1,5 +1,5 @@
378 378 $ echo babar
379 379 - rataxes
380 380 + babar
381 381 This is a noop statement so that
382 382 this test is still more bytes than success.
383 383 pad pad pad pad............................................................
384 384
385 385 ERROR: test-failure.t output changed
386 386 !.
387 387 --- $TESTTMP/test-failure-unicode.t
388 388 +++ $TESTTMP/test-failure-unicode.t.err
389 389 @@ -1,2 +1,2 @@
390 390 $ echo babar\xce\xb1 (esc)
391 391 - l\xce\xb5\xce\xb5t (esc)
392 392 + babar\xce\xb1 (esc)
393 393
394 394 ERROR: test-failure-unicode.t output changed
395 395 !
396 396 Failed test-failure-unicode.t: output changed
397 397 Failed test-failure.t: output changed
398 398 # Ran 3 tests, 0 skipped, 2 failed.
399 399 python hash seed: * (glob)
400 400 [1]
401 401 $ cat xunit.xml
402 402 <?xml version="1.0" encoding="utf-8"?>
403 403 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
404 404 <testcase name="test-success.t" time="*"/> (glob)
405 405 <testcase name="test-failure-unicode.t" time="*"> (glob)
406 406 <failure message="output changed" type="output-mismatch"><![CDATA[--- $TESTTMP/test-failure-unicode.t (py38 !)
407 407 <failure message="output changed" type="output-mismatch"> (no-py38 !)
408 408 <![CDATA[--- $TESTTMP/test-failure-unicode.t (no-py38 !)
409 409 +++ $TESTTMP/test-failure-unicode.t.err
410 410 @@ -1,2 +1,2 @@
411 411 $ echo babar\xce\xb1 (esc)
412 412 - l\xce\xb5\xce\xb5t (esc)
413 413 + babar\xce\xb1 (esc)
414 414 ]]></failure> (py38 !)
415 415 ]]> </failure> (no-py38 !)
416 416 </testcase>
417 417 <testcase name="test-failure.t" time="*"> (glob)
418 418 <failure message="output changed" type="output-mismatch"><![CDATA[--- $TESTTMP/test-failure.t (py38 !)
419 419 <failure message="output changed" type="output-mismatch"> (no-py38 !)
420 420 <![CDATA[--- $TESTTMP/test-failure.t (no-py38 !)
421 421 +++ $TESTTMP/test-failure.t.err
422 422 @@ -1,5 +1,5 @@
423 423 $ echo babar
424 424 - rataxes
425 425 + babar
426 426 This is a noop statement so that
427 427 this test is still more bytes than success.
428 428 pad pad pad pad............................................................
429 429 ]]></failure> (py38 !)
430 430 ]]> </failure> (no-py38 !)
431 431 </testcase>
432 432 </testsuite>
433 433
434 434 $ cat .testtimes
435 435 test-empty.t * (glob)
436 436 test-failure-globs.t * (glob)
437 437 test-failure-unicode.t * (glob)
438 438 test-failure.t * (glob)
439 439 test-success.t * (glob)
440 440
441 441 $ rt --list-tests
442 442 test-failure-unicode.t
443 443 test-failure.t
444 444 test-success.t
445 445
446 446 $ rt --list-tests --json
447 447 test-failure-unicode.t
448 448 test-failure.t
449 449 test-success.t
450 450 $ cat report.json
451 451 testreport ={
452 452 "test-failure-unicode.t": {
453 453 "result": "success"
454 454 },
455 455 "test-failure.t": {
456 456 "result": "success"
457 457 },
458 458 "test-success.t": {
459 459 "result": "success"
460 460 }
461 461 } (no-eol)
462 462
463 463 $ rt --list-tests --xunit=xunit.xml
464 464 test-failure-unicode.t
465 465 test-failure.t
466 466 test-success.t
467 467 $ cat xunit.xml
468 468 <?xml version="1.0" encoding="utf-8"?>
469 469 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
470 470 <testcase name="test-failure-unicode.t"/>
471 471 <testcase name="test-failure.t"/>
472 472 <testcase name="test-success.t"/>
473 473 </testsuite>
474 474
475 475 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
476 476 test-failure-unicode.t
477 477 test-failure.t
478 478 $ cat output/report.json
479 479 testreport ={
480 480 "test-failure-unicode.t": {
481 481 "result": "success"
482 482 },
483 483 "test-failure.t": {
484 484 "result": "success"
485 485 }
486 486 } (no-eol)
487 487 $ cat xunit.xml
488 488 <?xml version="1.0" encoding="utf-8"?>
489 489 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
490 490 <testcase name="test-failure-unicode.t"/>
491 491 <testcase name="test-failure.t"/>
492 492 </testsuite>
493 493
494 494 $ rm test-failure-unicode.t
495 495
496 496 test for --retest
497 497 ====================
498 498
499 499 $ rt --retest
500 500 running 1 tests using 1 parallel processes
501 501
502 502 --- $TESTTMP/test-failure.t
503 503 +++ $TESTTMP/test-failure.t.err
504 504 @@ -1,5 +1,5 @@
505 505 $ echo babar
506 506 - rataxes
507 507 + babar
508 508 This is a noop statement so that
509 509 this test is still more bytes than success.
510 510 pad pad pad pad............................................................
511 511
512 512 ERROR: test-failure.t output changed
513 513 !
514 514 Failed test-failure.t: output changed
515 515 # Ran 1 tests, 0 skipped, 1 failed.
516 516 python hash seed: * (glob)
517 517 [1]
518 518
519 519 --retest works with --outputdir
520 520 $ rm -r output
521 521 $ mkdir output
522 522 $ mv test-failure.t.err output
523 523 $ rt --retest --outputdir output
524 524 running 1 tests using 1 parallel processes
525 525
526 526 --- $TESTTMP/test-failure.t
527 527 +++ $TESTTMP/output/test-failure.t.err
528 528 @@ -1,5 +1,5 @@
529 529 $ echo babar
530 530 - rataxes
531 531 + babar
532 532 This is a noop statement so that
533 533 this test is still more bytes than success.
534 534 pad pad pad pad............................................................
535 535
536 536 ERROR: test-failure.t output changed
537 537 !
538 538 Failed test-failure.t: output changed
539 539 # Ran 1 tests, 0 skipped, 1 failed.
540 540 python hash seed: * (glob)
541 541 [1]
542 542
543 543 Selecting Tests To Run
544 544 ======================
545 545
546 546 successful
547 547
548 548 $ rt test-success.t
549 549 running 1 tests using 1 parallel processes
550 550 .
551 551 # Ran 1 tests, 0 skipped, 0 failed.
552 552
553 553 success w/ keyword
554 554 $ rt -k xyzzy
555 555 running 2 tests using 1 parallel processes
556 556 .
557 557 # Ran 2 tests, 1 skipped, 0 failed.
558 558
559 559 failed
560 560
561 561 $ rt test-failure.t
562 562 running 1 tests using 1 parallel processes
563 563
564 564 --- $TESTTMP/test-failure.t
565 565 +++ $TESTTMP/test-failure.t.err
566 566 @@ -1,5 +1,5 @@
567 567 $ echo babar
568 568 - rataxes
569 569 + babar
570 570 This is a noop statement so that
571 571 this test is still more bytes than success.
572 572 pad pad pad pad............................................................
573 573
574 574 ERROR: test-failure.t output changed
575 575 !
576 576 Failed test-failure.t: output changed
577 577 # Ran 1 tests, 0 skipped, 1 failed.
578 578 python hash seed: * (glob)
579 579 [1]
580 580
581 581 failure w/ keyword
582 582 $ rt -k rataxes
583 583 running 2 tests using 1 parallel processes
584 584
585 585 --- $TESTTMP/test-failure.t
586 586 +++ $TESTTMP/test-failure.t.err
587 587 @@ -1,5 +1,5 @@
588 588 $ echo babar
589 589 - rataxes
590 590 + babar
591 591 This is a noop statement so that
592 592 this test is still more bytes than success.
593 593 pad pad pad pad............................................................
594 594
595 595 ERROR: test-failure.t output changed
596 596 !
597 597 Failed test-failure.t: output changed
598 598 # Ran 2 tests, 1 skipped, 1 failed.
599 599 python hash seed: * (glob)
600 600 [1]
601 601
602 602 Verify that when a process fails to start we show a useful message
603 603 ==================================================================
604 604
605 605 $ cat > test-serve-fail.t <<EOF
606 606 > $ echo 'abort: child process failed to start blah'
607 607 > EOF
608 608 $ rt test-serve-fail.t
609 609 running 1 tests using 1 parallel processes
610 610
611 611 --- $TESTTMP/test-serve-fail.t
612 612 +++ $TESTTMP/test-serve-fail.t.err
613 613 @@ -1* +1,2 @@ (glob)
614 614 $ echo 'abort: child process failed to start blah'
615 615 + abort: child process failed to start blah
616 616
617 617 ERROR: test-serve-fail.t output changed
618 618 !
619 619 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
620 620 # Ran 1 tests, 0 skipped, 1 failed.
621 621 python hash seed: * (glob)
622 622 [1]
623 623 $ rm test-serve-fail.t
624 624
625 625 Verify that we can try other ports
626 626 ===================================
627 627
628 628 Extensions aren't inherited by the invoked run-tests.py. An extension
629 629 introducing a repository requirement could cause this to fail. So we force
630 630 HGRCPATH to get a clean environment.
631 631
632 632 $ HGRCPATH= hg init inuse
633 633 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
634 634 $ cat blocks.pid >> $DAEMON_PIDS
635 635 $ cat > test-serve-inuse.t <<EOF
636 636 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
637 637 > $ cat hg.pid >> \$DAEMON_PIDS
638 638 > EOF
639 639 $ rt test-serve-inuse.t
640 640 running 1 tests using 1 parallel processes
641 641 .
642 642 # Ran 1 tests, 0 skipped, 0 failed.
643 643 $ rm test-serve-inuse.t
644 644 $ killdaemons.py $DAEMON_PIDS
645 645
646 646 Running In Debug Mode
647 647 ======================
648 648
649 649 $ rt --debug 2>&1 | grep -v pwd
650 650 running 2 tests using 1 parallel processes
651 651 + echo *SALT* 0 0 (glob)
652 652 *SALT* 0 0 (glob)
653 653 + echo babar
654 654 babar
655 655 + echo *SALT* 10 0 (glob)
656 656 *SALT* 10 0 (glob)
657 657 *+ echo *SALT* 0 0 (glob)
658 658 *SALT* 0 0 (glob)
659 659 + echo babar
660 660 babar
661 661 + echo *SALT* 2 0 (glob)
662 662 *SALT* 2 0 (glob)
663 663 + echo xyzzy
664 664 xyzzy
665 665 + echo *SALT* 9 0 (glob)
666 666 *SALT* 9 0 (glob)
667 667 + printf *abc\ndef\nxyz\n* (glob)
668 668 abc
669 669 def
670 670 xyz
671 671 + echo *SALT* 15 0 (glob)
672 672 *SALT* 15 0 (glob)
673 673 + printf *zyx\nwvu\ntsr\n* (glob)
674 674 zyx
675 675 wvu
676 676 tsr
677 677 + echo *SALT* 22 0 (glob)
678 678 *SALT* 22 0 (glob)
679 679 .
680 680 # Ran 2 tests, 0 skipped, 0 failed.
681 681
682 682 Parallel runs
683 683 ==============
684 684
685 685 (duplicate the failing test to get predictable output)
686 686 $ cp test-failure.t test-failure-copy.t
687 687
688 688 $ rt --jobs 2 test-failure*.t -n
689 689 running 2 tests using 2 parallel processes
690 690 !!
691 691 Failed test-failure*.t: output changed (glob)
692 692 Failed test-failure*.t: output changed (glob)
693 693 # Ran 2 tests, 0 skipped, 2 failed.
694 694 python hash seed: * (glob)
695 695 [1]
696 696
697 697 failures in parallel with --first should only print one failure
698 698 $ rt --jobs 2 --first test-failure*.t
699 699 running 2 tests using 2 parallel processes
700 700
701 701 --- $TESTTMP/test-failure*.t (glob)
702 702 +++ $TESTTMP/test-failure*.t.err (glob)
703 703 @@ -1,5 +1,5 @@
704 704 $ echo babar
705 705 - rataxes
706 706 + babar
707 707 This is a noop statement so that
708 708 this test is still more bytes than success.
709 709 pad pad pad pad............................................................
710 710
711 711 Failed test-failure*.t: output changed (glob)
712 712 Failed test-failure*.t: output changed (glob)
713 713 # Ran 2 tests, 0 skipped, 2 failed.
714 714 python hash seed: * (glob)
715 715 [1]
716 716
717 717
718 718 (delete the duplicated test file)
719 719 $ rm test-failure-copy.t
720 720
721 721 multiple runs per test should be parallelized
722 722
723 723 $ rt --jobs 2 --runs-per-test 2 test-success.t
724 724 running 2 tests using 2 parallel processes
725 725 ..
726 726 # Ran 2 tests, 0 skipped, 0 failed.
727 727
728 728 Interactive run
729 729 ===============
730 730
731 731 (backup the failing test)
732 732 $ cp test-failure.t backup
733 733
734 734 Refuse the fix
735 735
736 736 $ echo 'n' | rt -i
737 737 running 2 tests using 1 parallel processes
738 738
739 739 --- $TESTTMP/test-failure.t
740 740 +++ $TESTTMP/test-failure.t.err
741 741 @@ -1,5 +1,5 @@
742 742 $ echo babar
743 743 - rataxes
744 744 + babar
745 745 This is a noop statement so that
746 746 this test is still more bytes than success.
747 747 pad pad pad pad............................................................
748 748 Accept this change? [y/N]
749 749 ERROR: test-failure.t output changed
750 750 !.
751 751 Failed test-failure.t: output changed
752 752 # Ran 2 tests, 0 skipped, 1 failed.
753 753 python hash seed: * (glob)
754 754 [1]
755 755
756 756 $ cat test-failure.t
757 757 $ echo babar
758 758 rataxes
759 759 This is a noop statement so that
760 760 this test is still more bytes than success.
761 761 pad pad pad pad............................................................
762 762 pad pad pad pad............................................................
763 763 pad pad pad pad............................................................
764 764 pad pad pad pad............................................................
765 765 pad pad pad pad............................................................
766 766 pad pad pad pad............................................................
767 767
768 768 Interactive with custom view
769 769
770 770 $ echo 'n' | rt -i --view echo
771 771 running 2 tests using 1 parallel processes
772 772 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
773 773 Accept this change? [y/N]* (glob)
774 774 ERROR: test-failure.t output changed
775 775 !.
776 776 Failed test-failure.t: output changed
777 777 # Ran 2 tests, 0 skipped, 1 failed.
778 778 python hash seed: * (glob)
779 779 [1]
780 780
781 781 View the fix
782 782
783 783 $ echo 'y' | rt --view echo
784 784 running 2 tests using 1 parallel processes
785 785 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
786 786
787 787 ERROR: test-failure.t output changed
788 788 !.
789 789 Failed test-failure.t: output changed
790 790 # Ran 2 tests, 0 skipped, 1 failed.
791 791 python hash seed: * (glob)
792 792 [1]
793 793
794 794 Accept the fix
795 795
796 796 $ cat >> test-failure.t <<EOF
797 797 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
798 798 > saved backup bundle to \$TESTTMP/foo.hg
799 799 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
800 800 > saved backup bundle to $TESTTMP\\foo.hg
801 801 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
802 802 > saved backup bundle to \$TESTTMP/*.hg (glob)
803 803 > EOF
804 804 $ echo 'y' | rt -i 2>&1
805 805 running 2 tests using 1 parallel processes
806 806
807 807 --- $TESTTMP/test-failure.t
808 808 +++ $TESTTMP/test-failure.t.err
809 809 @@ -1,5 +1,5 @@
810 810 $ echo babar
811 811 - rataxes
812 812 + babar
813 813 This is a noop statement so that
814 814 this test is still more bytes than success.
815 815 pad pad pad pad............................................................
816 816 @@ -11,6 +11,6 @@
817 817 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
818 818 saved backup bundle to $TESTTMP/foo.hg
819 819 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
820 820 - saved backup bundle to $TESTTMP\foo.hg
821 821 + saved backup bundle to $TESTTMP/foo.hg
822 822 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
823 823 saved backup bundle to $TESTTMP/*.hg (glob)
824 824 Accept this change? [y/N] ..
825 825 # Ran 2 tests, 0 skipped, 0 failed.
826 826
827 827 $ sed -e 's,(glob)$,&<,g' test-failure.t
828 828 $ echo babar
829 829 babar
830 830 This is a noop statement so that
831 831 this test is still more bytes than success.
832 832 pad pad pad pad............................................................
833 833 pad pad pad pad............................................................
834 834 pad pad pad pad............................................................
835 835 pad pad pad pad............................................................
836 836 pad pad pad pad............................................................
837 837 pad pad pad pad............................................................
838 838 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
839 839 saved backup bundle to $TESTTMP/foo.hg
840 840 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
841 841 saved backup bundle to $TESTTMP/foo.hg
842 842 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
843 843 saved backup bundle to $TESTTMP/*.hg (glob)<
844 844
845 845 $ rm test-failure.t
846 846
847 847 Race condition - test file was modified when test is running
848 848
849 849 $ TESTRACEDIR=`pwd`
850 850 $ export TESTRACEDIR
851 851 $ cat > test-race.t <<EOF
852 852 > $ echo 1
853 853 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
854 854 > EOF
855 855
856 856 $ rt -i test-race.t
857 857 running 1 tests using 1 parallel processes
858 858
859 859 --- $TESTTMP/test-race.t
860 860 +++ $TESTTMP/test-race.t.err
861 861 @@ -1,2 +1,3 @@
862 862 $ echo 1
863 863 + 1
864 864 $ echo "# a new line" >> $TESTTMP/test-race.t
865 865 Reference output has changed (run again to prompt changes)
866 866 ERROR: test-race.t output changed
867 867 !
868 868 Failed test-race.t: output changed
869 869 # Ran 1 tests, 0 skipped, 1 failed.
870 870 python hash seed: * (glob)
871 871 [1]
872 872
873 873 $ rm test-race.t
874 874
875 875 When "#testcases" is used in .t files
876 876
877 877 $ cat >> test-cases.t <<EOF
878 878 > #testcases a b
879 879 > #if a
880 880 > $ echo 1
881 881 > #endif
882 882 > #if b
883 883 > $ echo 2
884 884 > #endif
885 885 > EOF
886 886
887 887 $ cat <<EOF | rt -i test-cases.t 2>&1
888 888 > y
889 889 > y
890 890 > EOF
891 891 running 2 tests using 1 parallel processes
892 892
893 893 --- $TESTTMP/test-cases.t
894 894 +++ $TESTTMP/test-cases.t#a.err
895 895 @@ -1,6 +1,7 @@
896 896 #testcases a b
897 897 #if a
898 898 $ echo 1
899 899 + 1
900 900 #endif
901 901 #if b
902 902 $ echo 2
903 903 Accept this change? [y/N] .
904 904 --- $TESTTMP/test-cases.t
905 905 +++ $TESTTMP/test-cases.t#b.err
906 906 @@ -5,4 +5,5 @@
907 907 #endif
908 908 #if b
909 909 $ echo 2
910 910 + 2
911 911 #endif
912 912 Accept this change? [y/N] .
913 913 # Ran 2 tests, 0 skipped, 0 failed.
914 914
915 915 $ cat test-cases.t
916 916 #testcases a b
917 917 #if a
918 918 $ echo 1
919 919 1
920 920 #endif
921 921 #if b
922 922 $ echo 2
923 923 2
924 924 #endif
925 925
926 926 $ cat >> test-cases.t <<'EOF'
927 927 > #if a
928 928 > $ NAME=A
929 929 > #else
930 930 > $ NAME=B
931 931 > #endif
932 932 > $ echo $NAME
933 933 > A (a !)
934 934 > B (b !)
935 935 > EOF
936 936 $ rt test-cases.t
937 937 running 2 tests using 1 parallel processes
938 938 ..
939 939 # Ran 2 tests, 0 skipped, 0 failed.
940 940
941 941 When using multiple dimensions of "#testcases" in .t files
942 942
943 943 $ cat > test-cases.t <<'EOF'
944 944 > #testcases a b
945 945 > #testcases c d
946 946 > #if a d
947 947 > $ echo $TESTCASE
948 948 > a#d
949 949 > #endif
950 950 > #if b c
951 951 > $ echo yes
952 952 > no
953 953 > #endif
954 954 > EOF
955 955 $ rt test-cases.t
956 956 running 4 tests using 1 parallel processes
957 957 ..
958 958 --- $TESTTMP/test-cases.t
959 959 +++ $TESTTMP/test-cases.t#b#c.err
960 960 @@ -6,5 +6,5 @@
961 961 #endif
962 962 #if b c
963 963 $ echo yes
964 964 - no
965 965 + yes
966 966 #endif
967 967
968 968 ERROR: test-cases.t#b#c output changed
969 969 !.
970 970 Failed test-cases.t#b#c: output changed
971 971 # Ran 4 tests, 0 skipped, 1 failed.
972 972 python hash seed: * (glob)
973 973 [1]
974 974
975 975 $ rt --retest
976 976 running 1 tests using 1 parallel processes
977 977
978 978 --- $TESTTMP/test-cases.t
979 979 +++ $TESTTMP/test-cases.t#b#c.err
980 980 @@ -6,5 +6,5 @@
981 981 #endif
982 982 #if b c
983 983 $ echo yes
984 984 - no
985 985 + yes
986 986 #endif
987 987
988 988 ERROR: test-cases.t#b#c output changed
989 989 !
990 990 Failed test-cases.t#b#c: output changed
991 991 # Ran 1 tests, 0 skipped, 1 failed.
992 992 python hash seed: * (glob)
993 993 [1]
994 994 $ rm test-cases.t#b#c.err
995 995 $ rm test-cases.t
996 996
997 997 (reinstall)
998 998 $ mv backup test-failure.t
999 999
1000 1000 No Diff
1001 1001 ===============
1002 1002
1003 1003 $ rt --nodiff
1004 1004 running 2 tests using 1 parallel processes
1005 1005 !.
1006 1006 Failed test-failure.t: output changed
1007 1007 # Ran 2 tests, 0 skipped, 1 failed.
1008 1008 python hash seed: * (glob)
1009 1009 [1]
1010 1010
1011 1011 test --tmpdir support
1012 1012 $ rt --tmpdir=$TESTTMP/keep test-success.t
1013 1013 running 1 tests using 1 parallel processes
1014 1014
1015 1015 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
1016 1016 Keeping threadtmp dir: $TESTTMP/keep/child1
1017 1017 .
1018 1018 # Ran 1 tests, 0 skipped, 0 failed.
1019 1019
1020 1020 timeouts
1021 1021 ========
1022 1022 $ cat > test-timeout.t <<EOF
1023 1023 > $ sleep 2
1024 1024 > $ echo pass
1025 1025 > pass
1026 1026 > EOF
1027 1027 > echo '#require slow' > test-slow-timeout.t
1028 1028 > cat test-timeout.t >> test-slow-timeout.t
1029 1029 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
1030 1030 running 2 tests using 1 parallel processes
1031 1031 st
1032 1032 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
1033 1033 Failed test-timeout.t: timed out
1034 1034 # Ran 1 tests, 1 skipped, 1 failed.
1035 1035 python hash seed: * (glob)
1036 1036 [1]
1037 1037 $ rt --timeout=1 --slowtimeout=3 \
1038 1038 > test-timeout.t test-slow-timeout.t --allow-slow-tests
1039 1039 running 2 tests using 1 parallel processes
1040 1040 .t
1041 1041 Failed test-timeout.t: timed out
1042 1042 # Ran 2 tests, 0 skipped, 1 failed.
1043 1043 python hash seed: * (glob)
1044 1044 [1]
1045 1045 $ rm test-timeout.t test-slow-timeout.t
1046 1046
1047 1047 test for --time
1048 1048 ==================
1049 1049
1050 1050 $ rt test-success.t --time
1051 1051 running 1 tests using 1 parallel processes
1052 1052 .
1053 1053 # Ran 1 tests, 0 skipped, 0 failed.
1054 1054 # Producing time report
1055 1055 start end cuser csys real Test
1056 1056 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1057 1057
1058 1058 test for --time with --job enabled
1059 1059 ====================================
1060 1060
1061 1061 $ rt test-success.t --time --jobs 2
1062 1062 running 1 tests using 1 parallel processes
1063 1063 .
1064 1064 # Ran 1 tests, 0 skipped, 0 failed.
1065 1065 # Producing time report
1066 1066 start end cuser csys real Test
1067 1067 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1068 1068
1069 1069 Skips
1070 1070 ================
1071 1071 $ cat > test-skip.t <<EOF
1072 1072 > $ echo xyzzy
1073 1073 > #if true
1074 1074 > #require false
1075 1075 > #end
1076 1076 > EOF
1077 1077 $ cat > test-noskip.t <<EOF
1078 1078 > #if false
1079 1079 > #require false
1080 1080 > #endif
1081 1081 > EOF
1082 1082 $ rt --nodiff
1083 1083 running 4 tests using 1 parallel processes
1084 1084 !.s.
1085 1085 Skipped test-skip.t: missing feature: nail clipper
1086 1086 Failed test-failure.t: output changed
1087 1087 # Ran 3 tests, 1 skipped, 1 failed.
1088 1088 python hash seed: * (glob)
1089 1089 [1]
1090 1090
1091 1091 $ rm test-noskip.t
1092 1092 $ rt --keyword xyzzy
1093 1093 running 3 tests using 1 parallel processes
1094 1094 .s
1095 1095 Skipped test-skip.t: missing feature: nail clipper
1096 1096 # Ran 2 tests, 2 skipped, 0 failed.
1097 1097
1098 1098 Skips with xml
1099 1099 $ rt --keyword xyzzy \
1100 1100 > --xunit=xunit.xml
1101 1101 running 3 tests using 1 parallel processes
1102 1102 .s
1103 1103 Skipped test-skip.t: missing feature: nail clipper
1104 1104 # Ran 2 tests, 2 skipped, 0 failed.
1105 1105 $ cat xunit.xml
1106 1106 <?xml version="1.0" encoding="utf-8"?>
1107 1107 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
1108 1108 <testcase name="test-success.t" time="*"/> (glob)
1109 1109 <testcase name="test-skip.t">
1110 1110 <skipped><![CDATA[missing feature: nail clipper]]></skipped> (py38 !)
1111 1111 <skipped> (no-py38 !)
1112 1112 <![CDATA[missing feature: nail clipper]]> </skipped> (no-py38 !)
1113 1113 </testcase>
1114 1114 </testsuite>
1115 1115
1116 1116 Missing skips or blacklisted skips don't count as executed:
1117 1117 $ mkdir tests
1118 1118 $ echo tests/test-failure.t > blacklist
1119 1119 $ cp test-failure.t tests
1120 1120 $ rt --blacklist=blacklist --json\
1121 1121 > tests/test-failure.t tests/test-bogus.t
1122 1122 running 2 tests using 1 parallel processes
1123 1123 ss
1124 1124 Skipped test-bogus.t: Doesn't exist
1125 1125 Skipped test-failure.t: blacklisted
1126 1126 # Ran 0 tests, 2 skipped, 0 failed.
1127 1127 $ cat tests/report.json
1128 1128 testreport ={
1129 1129 "test-bogus.t": {
1130 1130 "result": "skip"
1131 1131 },
1132 1132 "test-failure.t": {
1133 1133 "result": "skip"
1134 1134 }
1135 1135 } (no-eol)
1136 1136 $ rm -r tests
1137 1137 $ echo test-failure.t > blacklist
1138 1138
1139 1139 Whitelist trumps blacklist
1140 1140 $ echo test-failure.t > whitelist
1141 1141 $ rt --blacklist=blacklist --whitelist=whitelist --json\
1142 1142 > test-failure.t test-bogus.t
1143 1143 running 2 tests using 1 parallel processes
1144 1144 s
1145 1145 --- $TESTTMP/test-failure.t
1146 1146 +++ $TESTTMP/test-failure.t.err
1147 1147 @@ -1,5 +1,5 @@
1148 1148 $ echo babar
1149 1149 - rataxes
1150 1150 + babar
1151 1151 This is a noop statement so that
1152 1152 this test is still more bytes than success.
1153 1153 pad pad pad pad............................................................
1154 1154
1155 1155 ERROR: test-failure.t output changed
1156 1156 !
1157 1157 Skipped test-bogus.t: Doesn't exist
1158 1158 Failed test-failure.t: output changed
1159 1159 # Ran 1 tests, 1 skipped, 1 failed.
1160 1160 python hash seed: * (glob)
1161 1161 [1]
1162 1162
1163 1163 Ensure that --test-list causes only the tests listed in that file to
1164 1164 be executed.
1165 1165 $ echo test-success.t >> onlytest
1166 1166 $ rt --test-list=onlytest
1167 1167 running 1 tests using 1 parallel processes
1168 1168 .
1169 1169 # Ran 1 tests, 0 skipped, 0 failed.
1170 1170 $ echo test-bogus.t >> anothertest
1171 1171 $ rt --test-list=onlytest --test-list=anothertest
1172 1172 running 2 tests using 1 parallel processes
1173 1173 s.
1174 1174 Skipped test-bogus.t: Doesn't exist
1175 1175 # Ran 1 tests, 1 skipped, 0 failed.
1176 1176 $ rm onlytest anothertest
1177 1177
1178 1178 test for --json
1179 1179 ==================
1180 1180
1181 1181 $ rt --json
1182 1182 running 3 tests using 1 parallel processes
1183 1183
1184 1184 --- $TESTTMP/test-failure.t
1185 1185 +++ $TESTTMP/test-failure.t.err
1186 1186 @@ -1,5 +1,5 @@
1187 1187 $ echo babar
1188 1188 - rataxes
1189 1189 + babar
1190 1190 This is a noop statement so that
1191 1191 this test is still more bytes than success.
1192 1192 pad pad pad pad............................................................
1193 1193
1194 1194 ERROR: test-failure.t output changed
1195 1195 !.s
1196 1196 Skipped test-skip.t: missing feature: nail clipper
1197 1197 Failed test-failure.t: output changed
1198 1198 # Ran 2 tests, 1 skipped, 1 failed.
1199 1199 python hash seed: * (glob)
1200 1200 [1]
1201 1201
1202 1202 $ cat report.json
1203 1203 testreport ={
1204 1204 "test-failure.t": [\{] (re)
1205 1205 "csys": "\s*\d+\.\d{3,4}", ? (re)
1206 1206 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1207 1207 "diff": "---.+\+\+\+.+", ? (re)
1208 1208 "end": "\s*\d+\.\d{3,4}", ? (re)
1209 1209 "result": "failure", ? (re)
1210 1210 "start": "\s*\d+\.\d{3,4}", ? (re)
1211 1211 "time": "\s*\d+\.\d{3,4}" (re)
1212 1212 }, ? (re)
1213 1213 "test-skip.t": {
1214 1214 "csys": "\s*\d+\.\d{3,4}", ? (re)
1215 1215 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1216 1216 "diff": "", ? (re)
1217 1217 "end": "\s*\d+\.\d{3,4}", ? (re)
1218 1218 "result": "skip", ? (re)
1219 1219 "start": "\s*\d+\.\d{3,4}", ? (re)
1220 1220 "time": "\s*\d+\.\d{3,4}" (re)
1221 1221 }, ? (re)
1222 1222 "test-success.t": [\{] (re)
1223 1223 "csys": "\s*\d+\.\d{3,4}", ? (re)
1224 1224 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1225 1225 "diff": "", ? (re)
1226 1226 "end": "\s*\d+\.\d{3,4}", ? (re)
1227 1227 "result": "success", ? (re)
1228 1228 "start": "\s*\d+\.\d{3,4}", ? (re)
1229 1229 "time": "\s*\d+\.\d{3,4}" (re)
1230 1230 }
1231 1231 } (no-eol)
1232 1232 --json with --outputdir
1233 1233
1234 1234 $ rm report.json
1235 1235 $ rm -r output
1236 1236 $ mkdir output
1237 1237 $ rt --json --outputdir output
1238 1238 running 3 tests using 1 parallel processes
1239 1239
1240 1240 --- $TESTTMP/test-failure.t
1241 1241 +++ $TESTTMP/output/test-failure.t.err
1242 1242 @@ -1,5 +1,5 @@
1243 1243 $ echo babar
1244 1244 - rataxes
1245 1245 + babar
1246 1246 This is a noop statement so that
1247 1247 this test is still more bytes than success.
1248 1248 pad pad pad pad............................................................
1249 1249
1250 1250 ERROR: test-failure.t output changed
1251 1251 !.s
1252 1252 Skipped test-skip.t: missing feature: nail clipper
1253 1253 Failed test-failure.t: output changed
1254 1254 # Ran 2 tests, 1 skipped, 1 failed.
1255 1255 python hash seed: * (glob)
1256 1256 [1]
1257 1257 $ f report.json
1258 1258 report.json: file not found
1259 1259 $ cat output/report.json
1260 1260 testreport ={
1261 1261 "test-failure.t": [\{] (re)
1262 1262 "csys": "\s*\d+\.\d{3,4}", ? (re)
1263 1263 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1264 1264 "diff": "---.+\+\+\+.+", ? (re)
1265 1265 "end": "\s*\d+\.\d{3,4}", ? (re)
1266 1266 "result": "failure", ? (re)
1267 1267 "start": "\s*\d+\.\d{3,4}", ? (re)
1268 1268 "time": "\s*\d+\.\d{3,4}" (re)
1269 1269 }, ? (re)
1270 1270 "test-skip.t": {
1271 1271 "csys": "\s*\d+\.\d{3,4}", ? (re)
1272 1272 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1273 1273 "diff": "", ? (re)
1274 1274 "end": "\s*\d+\.\d{3,4}", ? (re)
1275 1275 "result": "skip", ? (re)
1276 1276 "start": "\s*\d+\.\d{3,4}", ? (re)
1277 1277 "time": "\s*\d+\.\d{3,4}" (re)
1278 1278 }, ? (re)
1279 1279 "test-success.t": [\{] (re)
1280 1280 "csys": "\s*\d+\.\d{3,4}", ? (re)
1281 1281 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1282 1282 "diff": "", ? (re)
1283 1283 "end": "\s*\d+\.\d{3,4}", ? (re)
1284 1284 "result": "success", ? (re)
1285 1285 "start": "\s*\d+\.\d{3,4}", ? (re)
1286 1286 "time": "\s*\d+\.\d{3,4}" (re)
1287 1287 }
1288 1288 } (no-eol)
1289 1289 $ ls -a output
1290 1290 .
1291 1291 ..
1292 1292 .testtimes
1293 1293 report.json
1294 1294 test-failure.t.err
1295 1295
1296 1296 Test that failed test accepted through interactive are properly reported:
1297 1297
1298 1298 $ cp test-failure.t backup
1299 1299 $ echo y | rt --json -i
1300 1300 running 3 tests using 1 parallel processes
1301 1301
1302 1302 --- $TESTTMP/test-failure.t
1303 1303 +++ $TESTTMP/test-failure.t.err
1304 1304 @@ -1,5 +1,5 @@
1305 1305 $ echo babar
1306 1306 - rataxes
1307 1307 + babar
1308 1308 This is a noop statement so that
1309 1309 this test is still more bytes than success.
1310 1310 pad pad pad pad............................................................
1311 1311 Accept this change? [y/N] ..s
1312 1312 Skipped test-skip.t: missing feature: nail clipper
1313 1313 # Ran 2 tests, 1 skipped, 0 failed.
1314 1314
1315 1315 $ cat report.json
1316 1316 testreport ={
1317 1317 "test-failure.t": [\{] (re)
1318 1318 "csys": "\s*\d+\.\d{3,4}", ? (re)
1319 1319 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1320 1320 "diff": "", ? (re)
1321 1321 "end": "\s*\d+\.\d{3,4}", ? (re)
1322 1322 "result": "success", ? (re)
1323 1323 "start": "\s*\d+\.\d{3,4}", ? (re)
1324 1324 "time": "\s*\d+\.\d{3,4}" (re)
1325 1325 }, ? (re)
1326 1326 "test-skip.t": {
1327 1327 "csys": "\s*\d+\.\d{3,4}", ? (re)
1328 1328 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1329 1329 "diff": "", ? (re)
1330 1330 "end": "\s*\d+\.\d{3,4}", ? (re)
1331 1331 "result": "skip", ? (re)
1332 1332 "start": "\s*\d+\.\d{3,4}", ? (re)
1333 1333 "time": "\s*\d+\.\d{3,4}" (re)
1334 1334 }, ? (re)
1335 1335 "test-success.t": [\{] (re)
1336 1336 "csys": "\s*\d+\.\d{3,4}", ? (re)
1337 1337 "cuser": "\s*\d+\.\d{3,4}", ? (re)
1338 1338 "diff": "", ? (re)
1339 1339 "end": "\s*\d+\.\d{3,4}", ? (re)
1340 1340 "result": "success", ? (re)
1341 1341 "start": "\s*\d+\.\d{3,4}", ? (re)
1342 1342 "time": "\s*\d+\.\d{3,4}" (re)
1343 1343 }
1344 1344 } (no-eol)
1345 1345 $ mv backup test-failure.t
1346 1346
1347 1347 backslash on end of line with glob matching is handled properly
1348 1348
1349 1349 $ cat > test-glob-backslash.t << EOF
1350 1350 > $ echo 'foo bar \\'
1351 1351 > foo * \ (glob)
1352 1352 > EOF
1353 1353
1354 1354 $ rt test-glob-backslash.t
1355 1355 running 1 tests using 1 parallel processes
1356 1356 .
1357 1357 # Ran 1 tests, 0 skipped, 0 failed.
1358 1358
1359 1359 $ rm -f test-glob-backslash.t
1360 1360
1361 1361 Test globbing of local IP addresses
1362 1362 $ echo 172.16.18.1
1363 1363 $LOCALIP (glob)
1364 1364 $ echo dead:beef::1
1365 1365 $LOCALIP (glob)
1366 1366
1367 1367 Add support for external test formatter
1368 1368 =======================================
1369 1369
1370 1370 $ CUSTOM_TEST_RESULT=basic_test_result "$PYTHON" $TESTDIR/run-tests.py --with-hg=$HGTEST_REAL_HG -j1 "$@" test-success.t test-failure.t
1371 1371 running 2 tests using 1 parallel processes
1372 1372
1373 1373 # Ran 2 tests, 0 skipped, 0 failed.
1374 1374 ON_START! <__main__.TestSuite tests=[<__main__.TTest testMethod=test-failure.t>, <__main__.TTest testMethod=test-success.t>]>
1375 1375 FAILURE! test-failure.t output changed
1376 1376 SUCCESS! test-success.t
1377 1377 ON_END!
1378 1378
1379 1379 Test reusability for third party tools
1380 1380 ======================================
1381 1381
1382 1382 $ THISTESTDIR="$TESTDIR"
1383 1383 $ export THISTESTDIR
1384 1384 $ THISTESTTMP="$TESTTMP"
1385 1385 $ export THISTESTTMP
1386 1386
1387 1387 #if windows
1388 1388
1389 1389 $ NEWTESTDIR="$THISTESTTMP"\\anothertests
1390 1390
1391 1391 #else
1392 1392
1393 1393 $ NEWTESTDIR="$THISTESTTMP"/anothertests
1394 1394
1395 1395 #endif
1396 1396
1397 1397 $ export NEWTESTDIR
1398 1398
1399 1399 $ echo creating some new test in: $NEWTESTDIR
1400 1400 creating some new test in: $TESTTMP\anothertests (windows !)
1401 1401 creating some new test in: $TESTTMP/anothertests (no-windows !)
1402 1402 $ mkdir "$NEWTESTDIR"
1403 1403 $ cd "$NEWTESTDIR"
1404 1404
1405 1405 test that `run-tests.py` can execute hghave, even if it runs not in
1406 1406 Mercurial source tree.
1407 1407
1408 1408 $ cat > test-hghave.t <<EOF
1409 1409 > #require true
1410 1410 > $ echo foo
1411 1411 > foo
1412 1412 > EOF
1413 1413 $ rt test-hghave.t
1414 1414 running 1 tests using 1 parallel processes
1415 1415 .
1416 1416 # Ran 1 tests, 0 skipped, 0 failed.
1417 1417
1418 1418 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1419 1419 running is placed.
1420 1420
1421 1421
1422 1422 $ cat > test-runtestdir.t <<EOF
1423 1423 > # \$THISTESTDIR, in which test-run-tests.t (this test file) is placed
1424 1424 > # \$THISTESTTMP, in which test-run-tests.t (this test file) is placed
1425 1425 > # \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1426 1426 > # \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1427 1427 >
1428 1428 > $ test "\$TESTDIR" = "\$NEWTESTDIR"
1429 1429 > If this prints a path, that means RUNTESTDIR didn't equal
1430 1430 > THISTESTDIR as it should have.
1431 1431 > $ test "\$RUNTESTDIR" = "\$THISTESTDIR" || echo "\$RUNTESTDIR"
1432 1432 > This should print the start of check-code. If this passes but the
1433 1433 > previous check failed, that means we found a copy of check-code at whatever
1434 1434 > RUNTESTSDIR ended up containing, even though it doesn't match THISTESTDIR.
1435 1435 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python3@#!USRBINENVPY@'
1436 1436 > #!USRBINENVPY
1437 1437 > #
1438 1438 > # check-code - a style and portability checker for Mercurial
1439 1439 > EOF
1440 1440 $ rt test-runtestdir.t
1441 1441 running 1 tests using 1 parallel processes
1442 1442 .
1443 1443 # Ran 1 tests, 0 skipped, 0 failed.
1444 1444
1445 1445 #if execbit
1446 1446
1447 1447 test that TESTDIR is referred in PATH
1448 1448
1449 1449 $ cat > custom-command.sh <<EOF
1450 1450 > #!/bin/sh
1451 1451 > echo "hello world"
1452 1452 > EOF
1453 1453 $ chmod +x custom-command.sh
1454 1454 $ cat > test-testdir-path.t <<EOF
1455 1455 > $ custom-command.sh
1456 1456 > hello world
1457 1457 > EOF
1458 1458 $ rt test-testdir-path.t
1459 1459 running 1 tests using 1 parallel processes
1460 1460 .
1461 1461 # Ran 1 tests, 0 skipped, 0 failed.
1462 1462
1463 1463 #endif
1464 1464
1465 1465 test support for --allow-slow-tests
1466 1466 $ cat > test-very-slow-test.t <<EOF
1467 1467 > #require slow
1468 1468 > $ echo pass
1469 1469 > pass
1470 1470 > EOF
1471 1471 $ rt test-very-slow-test.t
1472 1472 running 1 tests using 1 parallel processes
1473 1473 s
1474 1474 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1475 1475 # Ran 0 tests, 1 skipped, 0 failed.
1476 1476 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1477 1477 running 1 tests using 1 parallel processes
1478 1478 .
1479 1479 # Ran 1 tests, 0 skipped, 0 failed.
1480 1480
1481 1481 support for running a test outside the current directory
1482 1482 $ mkdir nonlocal
1483 1483 $ cat > nonlocal/test-is-not-here.t << EOF
1484 1484 > $ echo pass
1485 1485 > pass
1486 1486 > EOF
1487 1487 $ rt nonlocal/test-is-not-here.t
1488 1488 running 1 tests using 1 parallel processes
1489 1489 .
1490 1490 # Ran 1 tests, 0 skipped, 0 failed.
1491 1491
1492 1492 support for automatically discovering test if arg is a folder
1493 1493 $ mkdir tmp && cd tmp
1494 1494
1495 1495 $ cat > test-uno.t << EOF
1496 1496 > $ echo line
1497 1497 > line
1498 1498 > EOF
1499 1499
1500 1500 $ cp test-uno.t test-dos.t
1501 1501 $ cd ..
1502 1502 $ cp -R tmp tmpp
1503 1503 $ cp tmp/test-uno.t test-solo.t
1504 1504
1505 1505 $ rt tmp/ test-solo.t tmpp
1506 1506 running 5 tests using 1 parallel processes
1507 1507 .....
1508 1508 # Ran 5 tests, 0 skipped, 0 failed.
1509 1509 $ rm -rf tmp tmpp
1510 1510
1511 1511 support for running run-tests.py from another directory
1512 1512 $ mkdir tmp && cd tmp
1513 1513
1514 1514 $ cat > useful-file.sh << EOF
1515 1515 > important command
1516 1516 > EOF
1517 1517
1518 1518 $ cat > test-folder.t << EOF
1519 1519 > $ cat \$TESTDIR/useful-file.sh
1520 1520 > important command
1521 1521 > EOF
1522 1522
1523 1523 $ cat > test-folder-fail.t << EOF
1524 1524 > $ cat \$TESTDIR/useful-file.sh
1525 1525 > important commando
1526 1526 > EOF
1527 1527
1528 1528 $ cd ..
1529 1529 $ rt tmp/test-*.t
1530 1530 running 2 tests using 1 parallel processes
1531 1531
1532 1532 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1533 1533 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1534 1534 @@ -1,2 +1,2 @@
1535 1535 $ cat $TESTDIR/useful-file.sh
1536 1536 - important commando
1537 1537 + important command
1538 1538
1539 1539 ERROR: test-folder-fail.t output changed
1540 1540 !.
1541 1541 Failed test-folder-fail.t: output changed
1542 1542 # Ran 2 tests, 0 skipped, 1 failed.
1543 1543 python hash seed: * (glob)
1544 1544 [1]
1545 1545
1546 1546 support for bisecting failed tests automatically
1547 1547 $ hg init bisect
1548 1548 $ cd bisect
1549 1549 $ cat >> test-bisect.t <<EOF
1550 1550 > $ echo pass
1551 1551 > pass
1552 1552 > EOF
1553 1553 $ hg add test-bisect.t
1554 1554 $ hg ci -m 'good'
1555 1555 $ cat >> test-bisect.t <<EOF
1556 1556 > $ echo pass
1557 1557 > fail
1558 1558 > EOF
1559 1559 $ hg ci -m 'bad'
1560 1560 $ rt --known-good-rev=0 test-bisect.t
1561 1561 running 1 tests using 1 parallel processes
1562 1562
1563 1563 --- $TESTTMP/anothertests/bisect/test-bisect.t
1564 1564 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1565 1565 @@ -1,4 +1,4 @@
1566 1566 $ echo pass
1567 1567 pass
1568 1568 $ echo pass
1569 1569 - fail
1570 1570 + pass
1571 1571
1572 1572 ERROR: test-bisect.t output changed
1573 1573 !
1574 1574 Failed test-bisect.t: output changed
1575 1575 test-bisect.t broken by 72cbf122d116 (bad)
1576 1576 # Ran 1 tests, 0 skipped, 1 failed.
1577 1577 python hash seed: * (glob)
1578 1578 [1]
1579 1579
1580 1580 $ cd ..
1581 1581
1582 1582 support bisecting a separate repo
1583 1583
1584 1584 $ hg init bisect-dependent
1585 1585 $ cd bisect-dependent
1586 1586 $ cat > test-bisect-dependent.t <<EOF
1587 1587 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1588 1588 > pass
1589 1589 > EOF
1590 1590 $ hg commit -Am dependent test-bisect-dependent.t
1591 1591
1592 1592 $ rt --known-good-rev=0 test-bisect-dependent.t
1593 1593 running 1 tests using 1 parallel processes
1594 1594
1595 1595 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1596 1596 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1597 1597 @@ -1,2 +1,2 @@
1598 1598 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1599 1599 - pass
1600 1600 + fail
1601 1601
1602 1602 ERROR: test-bisect-dependent.t output changed
1603 1603 !
1604 1604 Failed test-bisect-dependent.t: output changed
1605 1605 Failed to identify failure point for test-bisect-dependent.t
1606 1606 # Ran 1 tests, 0 skipped, 1 failed.
1607 1607 python hash seed: * (glob)
1608 1608 [1]
1609 1609
1610 1610 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1611 1611 usage: run-tests.py [options] [tests]
1612 1612 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1613 1613 [2]
1614 1614
1615 1615 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1616 1616 running 1 tests using 1 parallel processes
1617 1617
1618 1618 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1619 1619 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1620 1620 @@ -1,2 +1,2 @@
1621 1621 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1622 1622 - pass
1623 1623 + fail
1624 1624
1625 1625 ERROR: test-bisect-dependent.t output changed
1626 1626 !
1627 1627 Failed test-bisect-dependent.t: output changed
1628 1628 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1629 1629 # Ran 1 tests, 0 skipped, 1 failed.
1630 1630 python hash seed: * (glob)
1631 1631 [1]
1632 1632
1633 1633 $ cd ..
1634 1634
1635 1635 Test a broken #if statement doesn't break run-tests threading.
1636 1636 ==============================================================
1637 1637 $ mkdir broken
1638 1638 $ cd broken
1639 1639 $ cat > test-broken.t <<EOF
1640 1640 > true
1641 1641 > #if notarealhghavefeature
1642 1642 > $ false
1643 1643 > #endif
1644 1644 > EOF
1645 1645 $ for f in 1 2 3 4 ; do
1646 1646 > cat > test-works-$f.t <<EOF
1647 1647 > This is test case $f
1648 1648 > $ sleep 1
1649 1649 > EOF
1650 1650 > done
1651 1651 $ rt -j 2
1652 1652 running 5 tests using 2 parallel processes
1653 1653 ....
1654 1654 # Ran 5 tests, 0 skipped, 0 failed.
1655 1655 skipped: unknown feature: notarealhghavefeature
1656 1656
1657 1657 $ cd ..
1658 1658 $ rm -rf broken
1659 1659
1660 1660 Test cases in .t files
1661 1661 ======================
1662 1662 $ mkdir cases
1663 1663 $ cd cases
1664 1664 $ cat > test-cases-abc.t <<'EOF'
1665 1665 > #testcases A B C
1666 1666 > $ V=B
1667 1667 > #if A
1668 1668 > $ V=A
1669 1669 > #endif
1670 1670 > #if C
1671 1671 > $ V=C
1672 1672 > #endif
1673 1673 > $ echo $V | sed 's/A/C/'
1674 1674 > C
1675 1675 > #if C
1676 1676 > $ [ $V = C ]
1677 1677 > #endif
1678 1678 > #if A
1679 1679 > $ [ $V = C ]
1680 1680 > [1]
1681 1681 > #endif
1682 1682 > #if no-C
1683 1683 > $ [ $V = C ]
1684 1684 > [1]
1685 1685 > #endif
1686 1686 > $ [ $V = D ]
1687 1687 > [1]
1688 1688 > EOF
1689 1689 $ rt
1690 1690 running 3 tests using 1 parallel processes
1691 1691 .
1692 1692 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1693 1693 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1694 1694 @@ -7,7 +7,7 @@
1695 1695 $ V=C
1696 1696 #endif
1697 1697 $ echo $V | sed 's/A/C/'
1698 1698 - C
1699 1699 + B
1700 1700 #if C
1701 1701 $ [ $V = C ]
1702 1702 #endif
1703 1703
1704 1704 ERROR: test-cases-abc.t#B output changed
1705 1705 !.
1706 1706 Failed test-cases-abc.t#B: output changed
1707 1707 # Ran 3 tests, 0 skipped, 1 failed.
1708 1708 python hash seed: * (glob)
1709 1709 [1]
1710 1710
1711 1711 --restart works
1712 1712
1713 1713 $ rt --restart
1714 1714 running 2 tests using 1 parallel processes
1715 1715
1716 1716 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1717 1717 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1718 1718 @@ -7,7 +7,7 @@
1719 1719 $ V=C
1720 1720 #endif
1721 1721 $ echo $V | sed 's/A/C/'
1722 1722 - C
1723 1723 + B
1724 1724 #if C
1725 1725 $ [ $V = C ]
1726 1726 #endif
1727 1727
1728 1728 ERROR: test-cases-abc.t#B output changed
1729 1729 !.
1730 1730 Failed test-cases-abc.t#B: output changed
1731 1731 # Ran 2 tests, 0 skipped, 1 failed.
1732 1732 python hash seed: * (glob)
1733 1733 [1]
1734 1734
1735 1735 --restart works with outputdir
1736 1736
1737 1737 $ mkdir output
1738 1738 $ mv test-cases-abc.t#B.err output
1739 1739 $ rt --restart --outputdir output
1740 1740 running 2 tests using 1 parallel processes
1741 1741
1742 1742 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1743 1743 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t#B.err
1744 1744 @@ -7,7 +7,7 @@
1745 1745 $ V=C
1746 1746 #endif
1747 1747 $ echo $V | sed 's/A/C/'
1748 1748 - C
1749 1749 + B
1750 1750 #if C
1751 1751 $ [ $V = C ]
1752 1752 #endif
1753 1753
1754 1754 ERROR: test-cases-abc.t#B output changed
1755 1755 !.
1756 1756 Failed test-cases-abc.t#B: output changed
1757 1757 # Ran 2 tests, 0 skipped, 1 failed.
1758 1758 python hash seed: * (glob)
1759 1759 [1]
1760 1760
1761 1761 Test TESTCASE variable
1762 1762
1763 1763 $ cat > test-cases-ab.t <<'EOF'
1764 1764 > $ dostuff() {
1765 1765 > > echo "In case $TESTCASE"
1766 1766 > > }
1767 1767 > #testcases A B
1768 1768 > #if A
1769 1769 > $ dostuff
1770 1770 > In case A
1771 1771 > #endif
1772 1772 > #if B
1773 1773 > $ dostuff
1774 1774 > In case B
1775 1775 > #endif
1776 1776 > EOF
1777 1777 $ rt test-cases-ab.t
1778 1778 running 2 tests using 1 parallel processes
1779 1779 ..
1780 1780 # Ran 2 tests, 0 skipped, 0 failed.
1781 1781
1782 1782 Support running a specific test case
1783 1783
1784 1784 $ rt "test-cases-abc.t#B"
1785 1785 running 1 tests using 1 parallel processes
1786 1786
1787 1787 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1788 1788 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1789 1789 @@ -7,7 +7,7 @@
1790 1790 $ V=C
1791 1791 #endif
1792 1792 $ echo $V | sed 's/A/C/'
1793 1793 - C
1794 1794 + B
1795 1795 #if C
1796 1796 $ [ $V = C ]
1797 1797 #endif
1798 1798
1799 1799 ERROR: test-cases-abc.t#B output changed
1800 1800 !
1801 1801 Failed test-cases-abc.t#B: output changed
1802 1802 # Ran 1 tests, 0 skipped, 1 failed.
1803 1803 python hash seed: * (glob)
1804 1804 [1]
1805 1805
1806 1806 Support running multiple test cases in the same file
1807 1807
1808 1808 $ rt test-cases-abc.t#B test-cases-abc.t#C
1809 1809 running 2 tests using 1 parallel processes
1810 1810
1811 1811 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1812 1812 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1813 1813 @@ -7,7 +7,7 @@
1814 1814 $ V=C
1815 1815 #endif
1816 1816 $ echo $V | sed 's/A/C/'
1817 1817 - C
1818 1818 + B
1819 1819 #if C
1820 1820 $ [ $V = C ]
1821 1821 #endif
1822 1822
1823 1823 ERROR: test-cases-abc.t#B output changed
1824 1824 !.
1825 1825 Failed test-cases-abc.t#B: output changed
1826 1826 # Ran 2 tests, 0 skipped, 1 failed.
1827 1827 python hash seed: * (glob)
1828 1828 [1]
1829 1829
1830 1830 Support ignoring invalid test cases
1831 1831
1832 1832 $ rt test-cases-abc.t#B test-cases-abc.t#D
1833 1833 running 1 tests using 1 parallel processes
1834 1834
1835 1835 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1836 1836 +++ $TESTTMP/anothertests/cases/test-cases-abc.t#B.err
1837 1837 @@ -7,7 +7,7 @@
1838 1838 $ V=C
1839 1839 #endif
1840 1840 $ echo $V | sed 's/A/C/'
1841 1841 - C
1842 1842 + B
1843 1843 #if C
1844 1844 $ [ $V = C ]
1845 1845 #endif
1846 1846
1847 1847 ERROR: test-cases-abc.t#B output changed
1848 1848 !
1849 1849 Failed test-cases-abc.t#B: output changed
1850 1850 # Ran 1 tests, 0 skipped, 1 failed.
1851 1851 python hash seed: * (glob)
1852 1852 [1]
1853 1853
1854 1854 Support running complex test cases names
1855 1855
1856 1856 $ cat > test-cases-advanced-cases.t <<'EOF'
1857 1857 > #testcases simple case-with-dashes casewith_-.chars
1858 1858 > $ echo $TESTCASE
1859 1859 > simple
1860 1860 > EOF
1861 1861
1862 1862 $ cat test-cases-advanced-cases.t
1863 1863 #testcases simple case-with-dashes casewith_-.chars
1864 1864 $ echo $TESTCASE
1865 1865 simple
1866 1866
1867 1867 $ rt test-cases-advanced-cases.t
1868 1868 running 3 tests using 1 parallel processes
1869 1869
1870 1870 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1871 1871 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#case-with-dashes.err
1872 1872 @@ -1,3 +1,3 @@
1873 1873 #testcases simple case-with-dashes casewith_-.chars
1874 1874 $ echo $TESTCASE
1875 1875 - simple
1876 1876 + case-with-dashes
1877 1877
1878 1878 ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
1879 1879 !
1880 1880 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1881 1881 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#casewith_-.chars.err
1882 1882 @@ -1,3 +1,3 @@
1883 1883 #testcases simple case-with-dashes casewith_-.chars
1884 1884 $ echo $TESTCASE
1885 1885 - simple
1886 1886 + casewith_-.chars
1887 1887
1888 1888 ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed
1889 1889 !.
1890 1890 Failed test-cases-advanced-cases.t#case-with-dashes: output changed
1891 1891 Failed test-cases-advanced-cases.t#casewith_-.chars: output changed
1892 1892 # Ran 3 tests, 0 skipped, 2 failed.
1893 1893 python hash seed: * (glob)
1894 1894 [1]
1895 1895
1896 1896 $ rt "test-cases-advanced-cases.t#case-with-dashes"
1897 1897 running 1 tests using 1 parallel processes
1898 1898
1899 1899 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1900 1900 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#case-with-dashes.err
1901 1901 @@ -1,3 +1,3 @@
1902 1902 #testcases simple case-with-dashes casewith_-.chars
1903 1903 $ echo $TESTCASE
1904 1904 - simple
1905 1905 + case-with-dashes
1906 1906
1907 1907 ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
1908 1908 !
1909 1909 Failed test-cases-advanced-cases.t#case-with-dashes: output changed
1910 1910 # Ran 1 tests, 0 skipped, 1 failed.
1911 1911 python hash seed: * (glob)
1912 1912 [1]
1913 1913
1914 1914 $ rt "test-cases-advanced-cases.t#casewith_-.chars"
1915 1915 running 1 tests using 1 parallel processes
1916 1916
1917 1917 --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
1918 1918 +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t#casewith_-.chars.err
1919 1919 @@ -1,3 +1,3 @@
1920 1920 #testcases simple case-with-dashes casewith_-.chars
1921 1921 $ echo $TESTCASE
1922 1922 - simple
1923 1923 + casewith_-.chars
1924 1924
1925 1925 ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed
1926 1926 !
1927 1927 Failed test-cases-advanced-cases.t#casewith_-.chars: output changed
1928 1928 # Ran 1 tests, 0 skipped, 1 failed.
1929 1929 python hash seed: * (glob)
1930 1930 [1]
1931 1931
1932 1932 Test automatic pattern replacement
1933 1933 ==================================
1934 1934
1935 1935 $ cat << EOF >> common-pattern.py
1936 1936 > substitutions = [
1937 1937 > (br'foo-(.*)\\b',
1938 1938 > br'\$XXX=\\1\$'),
1939 1939 > (br'bar\\n',
1940 1940 > br'\$YYY$\\n'),
1941 1941 > ]
1942 1942 > EOF
1943 1943
1944 1944 $ cat << EOF >> test-substitution.t
1945 1945 > $ echo foo-12
1946 1946 > \$XXX=12$
1947 1947 > $ echo foo-42
1948 1948 > \$XXX=42$
1949 1949 > $ echo bar prior
1950 1950 > bar prior
1951 1951 > $ echo lastbar
1952 1952 > last\$YYY$
1953 1953 > $ echo foo-bar foo-baz
1954 1954 > EOF
1955 1955
1956 1956 $ rt test-substitution.t
1957 1957 running 1 tests using 1 parallel processes
1958 1958
1959 1959 --- $TESTTMP/anothertests/cases/test-substitution.t
1960 1960 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1961 1961 @@ -7,3 +7,4 @@
1962 1962 $ echo lastbar
1963 1963 last$YYY$
1964 1964 $ echo foo-bar foo-baz
1965 1965 + $XXX=bar foo-baz$
1966 1966
1967 1967 ERROR: test-substitution.t output changed
1968 1968 !
1969 1969 Failed test-substitution.t: output changed
1970 1970 # Ran 1 tests, 0 skipped, 1 failed.
1971 1971 python hash seed: * (glob)
1972 1972 [1]
1973 1973
1974 1974 --extra-config-opt works
1975 1975
1976 1976 $ cat << EOF >> test-config-opt.t
1977 1977 > $ hg init test-config-opt
1978 1978 > $ hg -R test-config-opt purge
1979 1979 > $ echo "HGTESTEXTRAEXTENSIONS: \$HGTESTEXTRAEXTENSIONS"
1980 1980 > HGTESTEXTRAEXTENSIONS: purge
1981 1981 > EOF
1982 1982
1983 1983 $ rt --extra-config-opt extensions.purge= \
1984 1984 > --extra-config-opt not.an.extension=True test-config-opt.t
1985 1985 running 1 tests using 1 parallel processes
1986 1986 .
1987 1987 # Ran 1 tests, 0 skipped, 0 failed.
1988 1988
1989 1989 Test conditional output matching
1990 1990 ================================
1991 1991
1992 1992 $ cat << EOF >> test-conditional-matching.t
1993 1993 > #testcases foo bar
1994 1994 > $ echo richtig
1995 1995 > richtig (true !)
1996 1996 > $ echo falsch
1997 1997 > falsch (false !)
1998 1998 > #if foo
1999 1999 > $ echo arthur
2000 2000 > arthur (bar !)
2001 2001 > #endif
2002 2002 > $ echo celeste
2003 2003 > celeste (foo !)
2004 2004 > $ echo zephir
2005 2005 > zephir (bar !)
2006 2006 > EOF
2007 2007
2008 2008 $ rt test-conditional-matching.t
2009 2009 running 2 tests using 1 parallel processes
2010 2010
2011 2011 --- $TESTTMP/anothertests/cases/test-conditional-matching.t
2012 2012 +++ $TESTTMP/anothertests/cases/test-conditional-matching.t#bar.err
2013 2013 @@ -3,11 +3,13 @@
2014 2014 richtig (true !)
2015 2015 $ echo falsch
2016 2016 falsch (false !)
2017 2017 + falsch
2018 2018 #if foo
2019 2019 $ echo arthur
2020 2020 arthur \(bar !\) (re)
2021 2021 #endif
2022 2022 $ echo celeste
2023 2023 celeste \(foo !\) (re)
2024 2024 + celeste
2025 2025 $ echo zephir
2026 2026 zephir \(bar !\) (re)
2027 2027
2028 2028 ERROR: test-conditional-matching.t#bar output changed
2029 2029 !
2030 2030 --- $TESTTMP/anothertests/cases/test-conditional-matching.t
2031 2031 +++ $TESTTMP/anothertests/cases/test-conditional-matching.t#foo.err
2032 2032 @@ -3,11 +3,14 @@
2033 2033 richtig (true !)
2034 2034 $ echo falsch
2035 2035 falsch (false !)
2036 2036 + falsch
2037 2037 #if foo
2038 2038 $ echo arthur
2039 2039 arthur \(bar !\) (re)
2040 2040 + arthur
2041 2041 #endif
2042 2042 $ echo celeste
2043 2043 celeste \(foo !\) (re)
2044 2044 $ echo zephir
2045 2045 zephir \(bar !\) (re)
2046 2046 + zephir
2047 2047
2048 2048 ERROR: test-conditional-matching.t#foo output changed
2049 2049 !
2050 2050 Failed test-conditional-matching.t#bar: output changed
2051 2051 Failed test-conditional-matching.t#foo: output changed
2052 2052 # Ran 2 tests, 0 skipped, 2 failed.
2053 2053 python hash seed: * (glob)
2054 2054 [1]
2055 2055
2056 2056 Test that a proper "python" has been set up
2057 2057 ===========================================
2058 2058
2059 2059 (with a small check-code work around)
2060 2060 $ printf "#!/usr/bi" > test-py3.tmp
2061 2061 $ printf "n/en" >> test-py3.tmp
2062 2062 $ cat << EOF >> test-py3.tmp
2063 2063 > v python3
2064 2064 > import sys
2065 2065 > print('.'.join(str(x) for x in sys.version_info))
2066 2066 > EOF
2067 2067 $ mv test-py3.tmp test-py3.py
2068 2068 $ chmod +x test-py3.py
2069 2069
2070 2070 (with a small check-code work around)
2071 2071 $ printf "#!/usr/bi" > test-py.tmp
2072 2072 $ printf "n/en" >> test-py.tmp
2073 2073 $ cat << EOF >> test-py.tmp
2074 2074 > v python
2075 2075 > import sys
2076 2076 > print('.'.join(str(x) for x in sys.version_info))
2077 2077 > EOF
2078 2078 $ mv test-py.tmp test-py.py
2079 2079 $ chmod +x test-py.py
2080 2080
2081 2081 $ ./test-py3.py
2082 2082 3.* (glob)
2083 2083 $ ./test-py.py
2084 2084 2.* (glob) (no-py3 !)
2085 2085 3.* (glob) (py3 !)
General Comments 0
You need to be logged in to leave comments. Login now