run-tests: stop storing start/stop times in a dict by test name
authorAugie Fackler <augie@google.com>
Fri, 13 Mar 2015 12:50:53 -0400
changeset 24331 d3bdd8c7174f
parent 24330 799bc18e14d1
child 24332 9612b96730d7
run-tests: stop storing start/stop times in a dict by test name This resolves the last breakage in run-tests that prevented me from running a single test many times in several threads in parallel. This will be useful for testing potential fixes to flaky tests.
tests/run-tests.py
--- a/tests/run-tests.py	Fri Mar 13 12:47:16 2015 -0400
+++ b/tests/run-tests.py	Fri Mar 13 12:50:53 2015 -0400
@@ -1142,8 +1142,6 @@
         self.warned = []
 
         self.times = []
-        self._started = {}
-        self._stopped = {}
         # Data stored for the benefit of generating xunit reports.
         self.successes = []
         self.faildata = {}
@@ -1265,21 +1263,18 @@
         # child's processes along with real elapsed time taken by a process.
         # This module has one limitation. It can only work for Linux user
         # and not for Windows.
-        self._started[test.name] = os.times()
+        test.started = os.times()
 
     def stopTest(self, test, interrupted=False):
         super(TestResult, self).stopTest(test)
 
-        self._stopped[test.name] = os.times()
+        test.stopped = os.times()
 
-        starttime = self._started[test.name]
-        endtime = self._stopped[test.name]
+        starttime = test.started
+        endtime = test.stopped
         self.times.append((test.name, endtime[2] - starttime[2],
                     endtime[3] - starttime[3], endtime[4] - starttime[4]))
 
-        del self._started[test.name]
-        del self._stopped[test.name]
-
         if interrupted:
             iolock.acquire()
             self.stream.writeln('INTERRUPTED: %s (after %d seconds)' % (