Show More
@@ -443,25 +443,25 b' class Timeout(Exception):' | |||
|
443 | 443 | def alarmed(signum, frame): |
|
444 | 444 | raise Timeout |
|
445 | 445 | |
|
446 | def pytest(test, options): | |
|
446 | def pytest(test, options, replacements): | |
|
447 | 447 | py3kswitch = options.py3k_warnings and ' -3' or '' |
|
448 | 448 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test) |
|
449 | 449 | vlog("# Running", cmd) |
|
450 | return run(cmd, options) | |
|
450 | return run(cmd, options, replacements) | |
|
451 | 451 | |
|
452 | def shtest(test, options): | |
|
452 | def shtest(test, options, replacements): | |
|
453 | 453 | cmd = '"%s"' % test |
|
454 | 454 | vlog("# Running", cmd) |
|
455 | return run(cmd, options) | |
|
455 | return run(cmd, options, replacements) | |
|
456 | 456 | |
|
457 | def battest(test, options): | |
|
457 | def battest(test, options, replacements): | |
|
458 | 458 | # To reliably get the error code from batch files on WinXP, |
|
459 | 459 | # the "cmd /c call" prefix is needed. Grrr |
|
460 | 460 | cmd = 'cmd /c call "%s"' % testpath |
|
461 | 461 | vlog("# Running", cmd) |
|
462 | return run(cmd, options) | |
|
462 | return run(cmd, options, replacements) | |
|
463 | 463 | |
|
464 | def tsttest(test, options): | |
|
464 | def tsttest(test, options, replacements): | |
|
465 | 465 | t = open(test) |
|
466 | 466 | out = [] |
|
467 | 467 | script = [] |
@@ -500,7 +500,7 b' def tsttest(test, options):' | |||
|
500 | 500 | |
|
501 | 501 | cmd = '/bin/sh "%s"' % name |
|
502 | 502 | vlog("# Running", cmd) |
|
503 | exitcode, output = run(cmd, options) | |
|
503 | exitcode, output = run(cmd, options, replacements) | |
|
504 | 504 | # do not merge output if skipped, return hghave message instead |
|
505 | 505 | if exitcode == SKIPPED_STATUS: |
|
506 | 506 | return exitcode, output |
@@ -565,7 +565,7 b' def tsttest(test, options):' | |||
|
565 | 565 | |
|
566 | 566 | return exitcode, postout |
|
567 | 567 | |
|
568 | def run(cmd, options): | |
|
568 | def run(cmd, options, replacements): | |
|
569 | 569 | """Run command in a sub-process, capturing the output (stdout and stderr). |
|
570 | 570 | Return a tuple (exitcode, output). output is None in debug mode.""" |
|
571 | 571 | # TODO: Use subprocess.Popen if we're running on Python 2.4 |
@@ -608,6 +608,8 b' def run(cmd, options):' | |||
|
608 | 608 | cleanup() |
|
609 | 609 | raise |
|
610 | 610 | |
|
611 | for s, r in replacements: | |
|
612 | output = output.replace(s, r) | |
|
611 | 613 | return ret, splitnewlines(output) |
|
612 | 614 | |
|
613 | 615 | def runone(options, test, skips, fails): |
@@ -682,14 +684,14 b' def runone(options, test, skips, fails):' | |||
|
682 | 684 | runner = shtest |
|
683 | 685 | |
|
684 | 686 | # Make a tmp subdirectory to work in |
|
685 |
t |
|
|
686 |
os.mkdir(tmp |
|
|
687 |
os.chdir(tmp |
|
|
687 | testtmp = os.environ["TESTTMP"] = os.path.join(HGTMP, test) | |
|
688 | os.mkdir(testtmp) | |
|
689 | os.chdir(testtmp) | |
|
688 | 690 | |
|
689 | 691 | if options.timeout > 0: |
|
690 | 692 | signal.alarm(options.timeout) |
|
691 | 693 | |
|
692 | ret, out = runner(testpath, options) | |
|
694 | ret, out = runner(testpath, options, [(testtmp, '$TESTTMP')]) | |
|
693 | 695 | vlog("# Ret was:", ret) |
|
694 | 696 | |
|
695 | 697 | if options.timeout > 0: |
@@ -755,7 +757,7 b' def runone(options, test, skips, fails):' | |||
|
755 | 757 | |
|
756 | 758 | os.chdir(TESTDIR) |
|
757 | 759 | if not options.keep_tmpdir: |
|
758 |
shutil.rmtree(tmp |
|
|
760 | shutil.rmtree(testtmp, True) | |
|
759 | 761 | if skipped: |
|
760 | 762 | return None |
|
761 | 763 | return ret == 0 |
General Comments 0
You need to be logged in to leave comments.
Login now