Show More
@@ -441,6 +441,24 b' class Timeout(Exception):' | |||
|
441 | 441 | def alarmed(signum, frame): |
|
442 | 442 | raise Timeout |
|
443 | 443 | |
|
444 | def pytest(test, options): | |
|
445 | py3kswitch = options.py3k_warnings and ' -3' or '' | |
|
446 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test) | |
|
447 | vlog("# Running", cmd) | |
|
448 | return run(cmd, options) | |
|
449 | ||
|
450 | def shtest(test, options): | |
|
451 | cmd = '"%s"' % test | |
|
452 | vlog("# Running", cmd) | |
|
453 | return run(cmd, options) | |
|
454 | ||
|
455 | def battest(test, options): | |
|
456 | # To reliably get the error code from batch files on WinXP, | |
|
457 | # the "cmd /c call" prefix is needed. Grrr | |
|
458 | cmd = 'cmd /c call "%s"' % testpath | |
|
459 | vlog("# Running", cmd) | |
|
460 | return run(cmd, options) | |
|
461 | ||
|
444 | 462 | def run(cmd, options): |
|
445 | 463 | """Run command in a sub-process, capturing the output (stdout and stderr). |
|
446 | 464 | Return a tuple (exitcode, output). output is None in debug mode.""" |
@@ -537,15 +555,12 b' def runone(options, test, skips, fails):' | |||
|
537 | 555 | lctest = test.lower() |
|
538 | 556 | |
|
539 | 557 | if lctest.endswith('.py') or firstline == '#!/usr/bin/env python': |
|
540 | py3kswitch = options.py3k_warnings and ' -3' or '' | |
|
541 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, testpath) | |
|
558 | runner = pytest | |
|
542 | 559 | elif lctest.endswith('.bat'): |
|
543 | 560 | # do not run batch scripts on non-windows |
|
544 | 561 | if os.name != 'nt': |
|
545 | 562 | return skip("batch script") |
|
546 | # To reliably get the error code from batch files on WinXP, | |
|
547 | # the "cmd /c call" prefix is needed. Grrr | |
|
548 | cmd = 'cmd /c call "%s"' % testpath | |
|
563 | runner = battest | |
|
549 | 564 | else: |
|
550 | 565 | # do not run shell scripts on windows |
|
551 | 566 | if os.name == 'nt': |
@@ -555,7 +570,7 b' def runone(options, test, skips, fails):' | |||
|
555 | 570 | return fail("does not exist") |
|
556 | 571 | elif not os.access(testpath, os.X_OK): |
|
557 | 572 | return skip("not executable") |
|
558 | cmd = '"%s"' % testpath | |
|
573 | runner = shtest | |
|
559 | 574 | |
|
560 | 575 | # Make a tmp subdirectory to work in |
|
561 | 576 | tmpd = os.path.join(HGTMP, test) |
@@ -565,8 +580,7 b' def runone(options, test, skips, fails):' | |||
|
565 | 580 | if options.timeout > 0: |
|
566 | 581 | signal.alarm(options.timeout) |
|
567 | 582 | |
|
568 | vlog("# Running", cmd) | |
|
569 | ret, out = run(cmd, options) | |
|
583 | ret, out = runner(testpath, options) | |
|
570 | 584 | vlog("# Ret was:", ret) |
|
571 | 585 | |
|
572 | 586 | if options.timeout > 0: |
General Comments 0
You need to be logged in to leave comments.
Login now