Comments
Patch
@@ -552,21 +552,20 @@ class Test(object):
self.threadtmp = os.path.join(HGTMP, 'child%d' % count)
os.mkdir(self.threadtmp)
self._testtmp = os.path.join(self.threadtmp, os.path.basename(path))
os.mkdir(self._testtmp)
self._setreplacements(count)
- def run(self):
+ def run(self, result):
env = self._getenv()
createhgrc(env['HGRCPATH'], self._options)
- result = TestResult()
starttime = time.time()
def updateduration():
result.duration = time.time() - starttime
try:
ret, out = self._run(self._replacements, env)
updateduration()
@@ -576,18 +575,16 @@ class Test(object):
updateduration()
result.interrupted = True
except Exception, e:
updateduration()
result.exception = e
killdaemons(env['DAEMON_PIDS'])
- return result
-
def _run(self, replacements, env):
raise NotImplemented('Subclasses must implement Test.run()')
def _setreplacements(self, count):
port = self._options.port + count * 3
r = [
(r':%s\b' % port, ':$HGPORT'),
(r':%s\b' % (port + 1), ':$HGPORT1'),
@@ -1045,17 +1042,18 @@ def runone(options, test, count):
return skip("unknown test type")
vlog("# Test", test)
if os.path.exists(err):
os.remove(err) # Remove any previous output files
t = runner(testpath, options, count)
- res = t.run()
+ res = TestResult()
+ t.run(res)
if res.interrupted:
log('INTERRUPTED: %s (after %d seconds)' % (test, res.duration))
raise KeyboardInterrupt()
if res.exception:
return fail('Exception during execution: %s' % res.exception, 255)