Debian Codegraph @

tests/test-run-tests.t

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