testrunner: make reading of test times work with #testcases
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 31 Jan 2018 23:12:45 -0800
changeset 35854 568917059243
parent 35853 2f7ab4fb7711
child 35855 69d7fcd91696
testrunner: make reading of test times work with #testcases Due to a bug that will be fixed in the next patch, we never actually read back .testcases, so we didn't notice that it could not be parsed successfully when there are #testcases tests. The parsing failed on lines like "test-amend-subrepo.t (case obsstore-off) 32.420" because we used a simple string.split() call and expected all parts but the first to be floating point numbers (and "(case" isn't, for example). Fix by using a regex instead. Differential Revision: https://phab.mercurial-scm.org/D1960
tests/run-tests.py
--- a/tests/run-tests.py	Wed Jan 31 11:04:16 2018 -0800
+++ b/tests/run-tests.py	Wed Jan 31 23:12:45 2018 -0800
@@ -2019,8 +2019,9 @@
     try:
         with open(os.path.join(outputdir, b'.testtimes-')) as fp:
             for line in fp:
-                ts = line.split()
-                times.append((ts[0], [float(t) for t in ts[1:]]))
+                m = re.match('(.*?) ([0-9. ]+)', line)
+                times.append((m.group(1),
+                              [float(t) for t in m.group(2).split()]))
     except IOError as err:
         if err.errno != errno.ENOENT:
             raise