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