Debian Codegraph @

tests/test-run-tests.t

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