D1960: testrunner: make reading of test times work with #testcases

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Feb 1 17:19:23 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1960

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2014,8 +2014,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



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list