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