Patchwork [3,of,4,runs-per-test-flag] run-tests: stop storing start/stop times in a dict by test name

login
register
mail settings
Submitter Augie Fackler
Date March 13, 2015, 7:25 p.m.
Message ID <ed7aba51d12b17a655fc.1426274712@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/8063/
State Accepted
Commit d3bdd8c7174f02e8e700c792d635ef39c5ad2d7d
Headers show

Comments

Augie Fackler - March 13, 2015, 7:25 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1426265453 14400
#      Fri Mar 13 12:50:53 2015 -0400
# Node ID ed7aba51d12b17a655fc5cb57909e427c3079de2
# Parent  3c7d06b719c5abfd508ca4d609a9a8c64fafaed8
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.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1142,8 +1142,6 @@  class TestResult(unittest._TextTestResul
         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 @@  class TestResult(unittest._TextTestResul
         # 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)' % (