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

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 5:19 p.m.
Message ID <differential-rev-PHID-DREV-a4fmrvzp4l2ts3lxyd4x-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27103/
State Superseded
Headers show

Comments

phabricator - Feb. 1, 2018, 5:19 p.m.
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




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 1, 2018, 5:21 p.m.
martinvonz added a comment.


  I wrote this patch before https://phab.mercurial-scm.org/D1959, but perhaps I should rebase it on top of that and reuse the same regex for matching the test case?

REPOSITORY
  rHG Mercurial

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

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

Patch

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