Mercurial > public > mercurial-scm > hg-stable
diff tests/run-tests.py @ 27927:0de4dfc9af0c stable
run-tests: fix crash when --json and --blacklist are both used (issue5050)
This patch fixes a crash when both --json and --blacklist were given as
arguments of run-tests.py. Now, instead of crashing, we add an entry for
blacklisted tests in the json output to show that the tests were skipped.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Tue, 19 Jan 2016 08:22:27 -0800 |
parents | 4c6053a6b17d |
children | a6833e464b07 |
line wrap: on
line diff
--- a/tests/run-tests.py Thu Jan 21 12:37:12 2016 -0800 +++ b/tests/run-tests.py Tue Jan 19 08:22:27 2016 -0800 @@ -1727,14 +1727,20 @@ ('skip', result.skipped)] for res, testcases in groups: for tc, __ in testcases: - tres = {'result': res, - 'time': ('%0.3f' % timesd[tc.name][2]), - 'cuser': ('%0.3f' % timesd[tc.name][0]), - 'csys': ('%0.3f' % timesd[tc.name][1]), - 'start': ('%0.3f' % timesd[tc.name][3]), - 'end': ('%0.3f' % timesd[tc.name][4]), - 'diff': result.faildata.get(tc.name, ''), - } + if tc.name in timesd: + tres = {'result': res, + 'time': ('%0.3f' % timesd[tc.name][2]), + 'cuser': ('%0.3f' % timesd[tc.name][0]), + 'csys': ('%0.3f' % timesd[tc.name][1]), + 'start': ('%0.3f' % timesd[tc.name][3]), + 'end': ('%0.3f' % timesd[tc.name][4]), + 'diff': result.faildata.get(tc.name, + ''), + } + else: + # blacklisted test + tres = {'result': res} + outcome[tc.name] = tres jsonout = json.dumps(outcome, sort_keys=True, indent=4) fp.writelines(("testreport =", jsonout))