changeset 21505:3a1881dbf860

run-tests: pass abort into Test.__init__
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 22 Apr 2014 10:12:19 -0700
parents 888a5dfe1569
children bfe2616a2b0e
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Tue Apr 22 10:05:32 2014 -0700
+++ b/tests/run-tests.py	Tue Apr 22 10:12:19 2014 -0700
@@ -338,7 +338,7 @@
     # Status code reserved for skipped tests (used by hghave).
     SKIPPED_STATUS = 80
 
-    def __init__(self, runner, path, count, tmpdir):
+    def __init__(self, runner, path, count, tmpdir, abort):
         """Create a test from parameters.
 
         runner is a TestRunner instance.
@@ -348,6 +348,9 @@
         count is an identifier used to denote this test instance.
 
         tmpdir is the main temporary directory to use for this test.
+
+        abort is a flag that turns to True if test execution should be aborted.
+        It is consulted periodically during the execution of tests.
         """
 
         self._path = path
@@ -359,6 +362,7 @@
         self._options = runner.options
         self._count = count
         self._threadtmp = tmpdir
+        self._abort = abort
         self._daemonpids = []
 
         self._finished = None
@@ -684,7 +688,7 @@
         vlog("# Running", cmd)
         if os.name == 'nt':
             replacements.append((r'\r\n', '\n'))
-        return run(cmd, self._testtmp, replacements, env, self._runner.abort,
+        return run(cmd, self._testtmp, replacements, env, self._abort,
                    debug=self._options.debug, timeout=self._options.timeout)
 
 class TTest(Test):
@@ -720,7 +724,7 @@
         vlog("# Running", cmd)
 
         exitcode, output = run(cmd, self._testtmp, replacements, env,
-                               self._runner.abort, debug=self._options.debug,
+                               self._abort, debug=self._options.debug,
                                timeout=self._options.timeout)
         # Do not merge output if skipped. Return hghave message instead.
         # Similarly, with --debug, output is None.
@@ -1471,7 +1475,7 @@
         refpath = os.path.join(self.testdir, test)
         tmpdir = os.path.join(self.hgtmp, 'child%d' % count)
 
-        return testcls(self, refpath, count, tmpdir)
+        return testcls(self, refpath, count, tmpdir, self.abort)
 
     def _cleanup(self):
         """Clean up state from this test invocation."""