run-tests: stop explicit expansion of time data
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 07 May 2015 20:45:51 -0700
changeset 24982 5c15f7e0f52b
parent 24981 012b79d549d8
child 24983 277bc9b0b4bd
run-tests: stop explicit expansion of time data We are about to record more complex time-related data, which will require repeated changes of every loop touching times data. That will also extend such lines to a point where things become too long. Instead, we iterate on each entry and expand values in the loops. We keep intermediate variables in most cases to preserve readability. The loop producing json data does a strange inversion for no obvious reason. We preserved that for now and will fix it in another changeset.
tests/run-tests.py
--- a/tests/run-tests.py	Fri May 08 10:51:18 2015 -0700
+++ b/tests/run-tests.py	Thu May 07 20:45:51 2015 -0700
@@ -1494,8 +1494,7 @@
         if self._runner.options.xunit:
             xuf = open(self._runner.options.xunit, 'wb')
             try:
-                timesd = dict(
-                    (test, real) for test, cuser, csys, real in result.times)
+                timesd = dict((t[0], t[3]) for t in result.times)
                 doc = minidom.Document()
                 s = doc.createElement('testsuite')
                 s.setAttribute('name', 'run-tests')
@@ -1531,7 +1530,9 @@
             fp = open(jsonpath, 'w')
             try:
                 timesd = {}
-                for test, cuser, csys, real in result.times:
+                for tdata in result.times:
+                    test = tdata[0]
+                    real, cuser, csys = tdata[3], tdata[1], tdata[2]
                     timesd[test] = (real, cuser, csys)
 
                 outcome = {}
@@ -1573,7 +1574,9 @@
         cols = '%7.3f %7.3f %7.3f   %s'
         self.stream.writeln('%-7s %-7s %-7s   %s' % ('cuser', 'csys', 'real',
                     'Test'))
-        for test, cuser, csys, real in times:
+        for tdata in times:
+            test = tdata[0]
+            cuser, csys, real = tdata[1:4]
             self.stream.writeln(cols % (cuser, csys, real, test))
 
 class TestRunner(object):