##// END OF EJS Templates
run-tests: move abort global to TestRunner
Gregory Szorc -
r21361:0fdf9250 default
parent child Browse files
Show More
@@ -649,7 +649,8 b' class PythonTest(Test):'
649 649 vlog("# Running", cmd)
650 650 if os.name == 'nt':
651 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 656 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
@@ -681,7 +682,8 b' class TTest(Test):'
681 682 cmd = '%s "%s"' % (self._options.shell, fname)
682 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 687 # Do not merge output if skipped. Return hghave message instead.
686 688 # Similarly, with --debug, output is None.
687 689 if exitcode == SKIPPED_STATUS or output is None:
@@ -929,7 +931,7 b' class TTest(Test):'
929 931 return False
930 932
931 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 935 """Run command in a sub-process, capturing the output (stdout and stderr).
934 936 Return a tuple (exitcode, output). output is None in debug mode."""
935 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 969 if ret:
968 970 killdaemons(env['DAEMON_PIDS'])
969 971
970 if abort:
972 if abort[0]:
971 973 raise KeyboardInterrupt()
972 974
973 975 for s, r in replacements:
@@ -992,14 +994,12 b' def _gethgpath():'
992 994 return _hgpath
993 995
994 996 iolock = threading.Lock()
995 abort = False
996 997
997 998 def scheduletests(runner, tests):
998 999 jobs = runner.options.jobs
999 1000 done = queue.Queue()
1000 1001 running = 0
1001 1002 count = 0
1002 global abort
1003 1003
1004 1004 def job(test, count):
1005 1005 try:
@@ -1032,7 +1032,7 b' def scheduletests(runner, tests):'
1032 1032 running += 1
1033 1033 count += 1
1034 1034 except KeyboardInterrupt:
1035 abort = True
1035 runner.abort[0] = True
1036 1036
1037 1037 class TestRunner(object):
1038 1038 """Holds context for executing tests.
@@ -1062,6 +1062,7 b' class TestRunner(object):'
1062 1062 's': [],
1063 1063 'i': [],
1064 1064 }
1065 self.abort = [False]
1065 1066 self._createdfiles = []
1066 1067
1067 1068 def runtests(self, tests):
General Comments 0
You need to be logged in to leave comments. Login now