comparison tests/run-tests.py @ 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 b502138f5faa
children 50e621fe0362
comparison
equal deleted inserted replaced
27685:9fbae70faf65 27686:df142b77b4c2
1729 tres = {'result': res, 1729 tres = {'result': res,
1730 'time': ('%0.3f' % timesd[tc.name][2]), 1730 'time': ('%0.3f' % timesd[tc.name][2]),
1731 'cuser': ('%0.3f' % timesd[tc.name][0]), 1731 'cuser': ('%0.3f' % timesd[tc.name][0]),
1732 'csys': ('%0.3f' % timesd[tc.name][1]), 1732 'csys': ('%0.3f' % timesd[tc.name][1]),
1733 'start': ('%0.3f' % timesd[tc.name][3]), 1733 'start': ('%0.3f' % timesd[tc.name][3]),
1734 'end': ('%0.3f' % timesd[tc.name][4])} 1734 'end': ('%0.3f' % timesd[tc.name][4]),
1735 'diff': result.faildata.get(tc.name, ''),
1736 }
1735 outcome[tc.name] = tres 1737 outcome[tc.name] = tres
1736 jsonout = json.dumps(outcome, sort_keys=True, indent=4) 1738 jsonout = json.dumps(outcome, sort_keys=True, indent=4)
1737 fp.writelines(("testreport =", jsonout)) 1739 fp.writelines(("testreport =", jsonout))
1738 finally: 1740 finally:
1739 fp.close() 1741 fp.close()