Mercurial > hg
changeset 27686:df142b77b4c2
run-tests: add 'diff' entry in json report
This patch adds to the json report the "diff" between expected and observed
result. This diff can be useful for automatically filing bug report on failing
tests.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Tue, 05 Jan 2016 13:33:09 -0800 |
parents | 9fbae70faf65 |
children | 4cea1b918b21 |
files | tests/run-tests.py tests/test-run-tests.t |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Tue Dec 01 13:08:05 2015 -0500 +++ b/tests/run-tests.py Tue Jan 05 13:33:09 2016 -0800 @@ -1731,7 +1731,9 @@ '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])} + 'end': ('%0.3f' % timesd[tc.name][4]), + 'diff': result.faildata.get(tc.name, ''), + } outcome[tc.name] = tres jsonout = json.dumps(outcome, sort_keys=True, indent=4) fp.writelines(("testreport =", jsonout))
--- a/tests/test-run-tests.t Tue Dec 01 13:08:05 2015 -0500 +++ b/tests/test-run-tests.t Tue Jan 05 13:33:09 2016 -0800 @@ -530,6 +530,7 @@ "test-failure.t": [\{] (re) "csys": "\s*[\d\.]{4,5}", ? (re) "cuser": "\s*[\d\.]{4,5}", ? (re) + "diff": "---.+\+\+\+.+", ? (re) "end": "\s*[\d\.]{4,5}", ? (re) "result": "failure", ? (re) "start": "\s*[\d\.]{4,5}", ? (re) @@ -538,6 +539,7 @@ "test-skip.t": { "csys": "\s*[\d\.]{4,5}", ? (re) "cuser": "\s*[\d\.]{4,5}", ? (re) + "diff": "", ? (re) "end": "\s*[\d\.]{4,5}", ? (re) "result": "skip", ? (re) "start": "\s*[\d\.]{4,5}", ? (re) @@ -546,6 +548,7 @@ "test-success.t": [\{] (re) "csys": "\s*[\d\.]{4,5}", ? (re) "cuser": "\s*[\d\.]{4,5}", ? (re) + "diff": "", ? (re) "end": "\s*[\d\.]{4,5}", ? (re) "result": "success", ? (re) "start": "\s*[\d\.]{4,5}", ? (re) @@ -575,6 +578,7 @@ "test-failure.t": [\{] (re) "csys": "\s*[\d\.]{4,5}", ? (re) "cuser": "\s*[\d\.]{4,5}", ? (re) + "diff": "", ? (re) "end": "\s*[\d\.]{4,5}", ? (re) "result": "success", ? (re) "start": "\s*[\d\.]{4,5}", ? (re) @@ -583,6 +587,7 @@ "test-skip.t": { "csys": "\s*[\d\.]{4,5}", ? (re) "cuser": "\s*[\d\.]{4,5}", ? (re) + "diff": "", ? (re) "end": "\s*[\d\.]{4,5}", ? (re) "result": "skip", ? (re) "start": "\s*[\d\.]{4,5}", ? (re) @@ -591,6 +596,7 @@ "test-success.t": [\{] (re) "csys": "\s*[\d\.]{4,5}", ? (re) "cuser": "\s*[\d\.]{4,5}", ? (re) + "diff": "", ? (re) "end": "\s*[\d\.]{4,5}", ? (re) "result": "success", ? (re) "start": "\s*[\d\.]{4,5}", ? (re)