Show More
@@ -183,7 +183,7 b' def check_required_tools():' | |||
|
183 | 183 | else: |
|
184 | 184 | print "WARNING: Did not find prerequisite tool: "+p |
|
185 | 185 | |
|
186 | def cleanup_exit(): | |
|
186 | def cleanup_exit(options): | |
|
187 | 187 | if not options.keep_tmpdir: |
|
188 | 188 | if verbose: |
|
189 | 189 | print "# Cleaning up HGTMP", HGTMP |
@@ -206,7 +206,7 b' def use_correct_python():' | |||
|
206 | 206 | shutil.copyfile(sys.executable, my_python) |
|
207 | 207 | shutil.copymode(sys.executable, my_python) |
|
208 | 208 | |
|
209 | def install_hg(): | |
|
209 | def install_hg(options): | |
|
210 | 210 | global python |
|
211 | 211 | vlog("# Performing temporary installation of HG") |
|
212 | 212 | installerrs = os.path.join("tests", "install.err") |
@@ -281,7 +281,7 b' def _hgpath():' | |||
|
281 | 281 | hgpath.close() |
|
282 | 282 | return path |
|
283 | 283 | |
|
284 | def output_coverage(): | |
|
284 | def output_coverage(options): | |
|
285 | 285 | vlog("# Producing coverage report") |
|
286 | 286 | omit = [BINDIR, TESTDIR, PYTHONDIR] |
|
287 | 287 | if not options.cover_stdlib: |
@@ -339,7 +339,7 b' def run(cmd):' | |||
|
339 | 339 | % options.timeout) |
|
340 | 340 | return ret, splitnewlines(output) |
|
341 | 341 | |
|
342 | def run_one(test, skips, fails): | |
|
342 | def run_one(options, test, skips, fails): | |
|
343 | 343 | '''tristate output: |
|
344 | 344 | None -> skipped |
|
345 | 345 | True -> passed |
@@ -496,7 +496,7 b' def run_one(test, skips, fails):' | |||
|
496 | 496 | return None |
|
497 | 497 | return ret == 0 |
|
498 | 498 | |
|
499 | def run_children(tests): | |
|
499 | def run_children(options, expecthg, tests): | |
|
500 | 500 | if not options.with_hg: |
|
501 | 501 | install_hg() |
|
502 | 502 | if hgpkg != expecthg: |
@@ -561,14 +561,14 b' def run_children(tests):' | |||
|
561 | 561 | tested, skipped, failed) |
|
562 | 562 | sys.exit(failures != 0) |
|
563 | 563 | |
|
564 | def run_tests(tests): | |
|
564 | def run_tests(options, expecthg, tests): | |
|
565 | 565 | global DAEMON_PIDS, HGRCPATH |
|
566 | 566 | DAEMON_PIDS = os.environ["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids') |
|
567 | 567 | HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc') |
|
568 | 568 | |
|
569 | 569 | try: |
|
570 | 570 | if not options.with_hg: |
|
571 | install_hg() | |
|
571 | install_hg(options) | |
|
572 | 572 | |
|
573 | 573 | if hgpkg != expecthg: |
|
574 | 574 | print '# Testing unexpected mercurial: %s' % hgpkg |
@@ -602,7 +602,7 b' def run_tests(tests):' | |||
|
602 | 602 | if options.retest and not os.path.exists(test + ".err"): |
|
603 | 603 | skipped += 1 |
|
604 | 604 | continue |
|
605 | ret = run_one(test, skips, fails) | |
|
605 | ret = run_one(options, test, skips, fails) | |
|
606 | 606 | if ret is None: |
|
607 | 607 | skipped += 1 |
|
608 | 608 | elif not ret: |
@@ -639,7 +639,7 b' def run_tests(tests):' | |||
|
639 | 639 | tested, skipped, failed) |
|
640 | 640 | |
|
641 | 641 | if coverage: |
|
642 | output_coverage() | |
|
642 | output_coverage(options) | |
|
643 | 643 | except KeyboardInterrupt: |
|
644 | 644 | failed = True |
|
645 | 645 | print "\ninterrupted!" |
@@ -647,6 +647,7 b' def run_tests(tests):' | |||
|
647 | 647 | if failed: |
|
648 | 648 | sys.exit(1) |
|
649 | 649 | |
|
650 | def main(): | |
|
650 | 651 | (options, args) = parse_args() |
|
651 | 652 | if not options.child: |
|
652 | 653 | os.umask(022) |
@@ -660,6 +661,7 b" os.environ['TZ'] = 'GMT'" | |||
|
660 | 661 | os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>" |
|
661 | 662 | os.environ['CDPATH'] = '' |
|
662 | 663 | |
|
664 | global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE | |
|
663 | 665 | TESTDIR = os.environ["TESTDIR"] = os.getcwd() |
|
664 | 666 | HGTMP = os.environ['HGTMP'] = os.path.realpath(tempfile.mkdtemp('', 'hgtests.', |
|
665 | 667 | options.tmpdir)) |
@@ -702,8 +704,10 b' vlog("# Using HGTMP", HGTMP)' | |||
|
702 | 704 | |
|
703 | 705 | try: |
|
704 | 706 | if len(tests) > 1 and options.jobs > 1: |
|
705 | run_children(tests) | |
|
707 | run_children(options, expecthg, tests) | |
|
706 | 708 | else: |
|
707 | run_tests(tests) | |
|
709 | run_tests(options, expecthg, tests) | |
|
708 | 710 | finally: |
|
709 | cleanup_exit() | |
|
711 | cleanup_exit(options) | |
|
712 | ||
|
713 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now