comparison tests/run-tests.py @ 35854:568917059243

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
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 31 Jan 2018 23:12:45 -0800
parents 8a7140ec4c89
children 69d7fcd91696
comparison
equal deleted inserted replaced
35853:2f7ab4fb7711 35854:568917059243
2017 def loadtimes(outputdir): 2017 def loadtimes(outputdir):
2018 times = [] 2018 times = []
2019 try: 2019 try:
2020 with open(os.path.join(outputdir, b'.testtimes-')) as fp: 2020 with open(os.path.join(outputdir, b'.testtimes-')) as fp:
2021 for line in fp: 2021 for line in fp:
2022 ts = line.split() 2022 m = re.match('(.*?) ([0-9. ]+)', line)
2023 times.append((ts[0], [float(t) for t in ts[1:]])) 2023 times.append((m.group(1),
2024 [float(t) for t in m.group(2).split()]))
2024 except IOError as err: 2025 except IOError as err:
2025 if err.errno != errno.ENOENT: 2026 if err.errno != errno.ENOENT:
2026 raise 2027 raise
2027 return times 2028 return times
2028 2029