Show More
@@ -649,7 +649,8 b' class PythonTest(Test):' | |||||
649 | vlog("# Running", cmd) |
|
649 | vlog("# Running", cmd) | |
650 | if os.name == 'nt': |
|
650 | if os.name == 'nt': | |
651 | replacements.append((r'\r\n', '\n')) |
|
651 | replacements.append((r'\r\n', '\n')) | |
652 |
return run(cmd, testtmp, self._options, replacements, env |
|
652 | return run(cmd, testtmp, self._options, replacements, env, | |
|
653 | self._runner.abort) | |||
653 |
|
654 | |||
654 |
|
655 | |||
655 | needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search |
|
656 | needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search | |
@@ -681,7 +682,8 b' class TTest(Test):' | |||||
681 | cmd = '%s "%s"' % (self._options.shell, fname) |
|
682 | cmd = '%s "%s"' % (self._options.shell, fname) | |
682 | vlog("# Running", cmd) |
|
683 | vlog("# Running", cmd) | |
683 |
|
684 | |||
684 |
exitcode, output = run(cmd, testtmp, self._options, replacements, env |
|
685 | exitcode, output = run(cmd, testtmp, self._options, replacements, env, | |
|
686 | self._runner.abort) | |||
685 | # Do not merge output if skipped. Return hghave message instead. |
|
687 | # Do not merge output if skipped. Return hghave message instead. | |
686 | # Similarly, with --debug, output is None. |
|
688 | # Similarly, with --debug, output is None. | |
687 | if exitcode == SKIPPED_STATUS or output is None: |
|
689 | if exitcode == SKIPPED_STATUS or output is None: | |
@@ -929,7 +931,7 b' class TTest(Test):' | |||||
929 | return False |
|
931 | return False | |
930 |
|
932 | |||
931 | wifexited = getattr(os, "WIFEXITED", lambda x: False) |
|
933 | wifexited = getattr(os, "WIFEXITED", lambda x: False) | |
932 | def run(cmd, wd, options, replacements, env): |
|
934 | def run(cmd, wd, options, replacements, env, abort): | |
933 | """Run command in a sub-process, capturing the output (stdout and stderr). |
|
935 | """Run command in a sub-process, capturing the output (stdout and stderr). | |
934 | Return a tuple (exitcode, output). output is None in debug mode.""" |
|
936 | Return a tuple (exitcode, output). output is None in debug mode.""" | |
935 | # TODO: Use subprocess.Popen if we're running on Python 2.4 |
|
937 | # TODO: Use subprocess.Popen if we're running on Python 2.4 | |
@@ -967,7 +969,7 b' def run(cmd, wd, options, replacements, ' | |||||
967 | if ret: |
|
969 | if ret: | |
968 | killdaemons(env['DAEMON_PIDS']) |
|
970 | killdaemons(env['DAEMON_PIDS']) | |
969 |
|
971 | |||
970 | if abort: |
|
972 | if abort[0]: | |
971 | raise KeyboardInterrupt() |
|
973 | raise KeyboardInterrupt() | |
972 |
|
974 | |||
973 | for s, r in replacements: |
|
975 | for s, r in replacements: | |
@@ -992,14 +994,12 b' def _gethgpath():' | |||||
992 | return _hgpath |
|
994 | return _hgpath | |
993 |
|
995 | |||
994 | iolock = threading.Lock() |
|
996 | iolock = threading.Lock() | |
995 | abort = False |
|
|||
996 |
|
997 | |||
997 | def scheduletests(runner, tests): |
|
998 | def scheduletests(runner, tests): | |
998 | jobs = runner.options.jobs |
|
999 | jobs = runner.options.jobs | |
999 | done = queue.Queue() |
|
1000 | done = queue.Queue() | |
1000 | running = 0 |
|
1001 | running = 0 | |
1001 | count = 0 |
|
1002 | count = 0 | |
1002 | global abort |
|
|||
1003 |
|
1003 | |||
1004 | def job(test, count): |
|
1004 | def job(test, count): | |
1005 | try: |
|
1005 | try: | |
@@ -1032,7 +1032,7 b' def scheduletests(runner, tests):' | |||||
1032 | running += 1 |
|
1032 | running += 1 | |
1033 | count += 1 |
|
1033 | count += 1 | |
1034 | except KeyboardInterrupt: |
|
1034 | except KeyboardInterrupt: | |
1035 | abort = True |
|
1035 | runner.abort[0] = True | |
1036 |
|
1036 | |||
1037 | class TestRunner(object): |
|
1037 | class TestRunner(object): | |
1038 | """Holds context for executing tests. |
|
1038 | """Holds context for executing tests. | |
@@ -1062,6 +1062,7 b' class TestRunner(object):' | |||||
1062 | 's': [], |
|
1062 | 's': [], | |
1063 | 'i': [], |
|
1063 | 'i': [], | |
1064 | } |
|
1064 | } | |
|
1065 | self.abort = [False] | |||
1065 | self._createdfiles = [] |
|
1066 | self._createdfiles = [] | |
1066 |
|
1067 | |||
1067 | def runtests(self, tests): |
|
1068 | def runtests(self, tests): |
General Comments 0
You need to be logged in to leave comments.
Login now