comparison tests/run-tests.py @ 24983:277bc9b0b4bd

run-tests: when building json, get time data in the same order as elsewhere The json code was changing the order of the time tuple for unclear reasons. We now use the same order as everywhere else.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 07 May 2015 23:16:57 -0700
parents 5c15f7e0f52b
children 5195322b9f80
comparison
equal deleted inserted replaced
24982:5c15f7e0f52b 24983:277bc9b0b4bd
1530 fp = open(jsonpath, 'w') 1530 fp = open(jsonpath, 'w')
1531 try: 1531 try:
1532 timesd = {} 1532 timesd = {}
1533 for tdata in result.times: 1533 for tdata in result.times:
1534 test = tdata[0] 1534 test = tdata[0]
1535 real, cuser, csys = tdata[3], tdata[1], tdata[2] 1535 timesd[test] = tdata[1:]
1536 timesd[test] = (real, cuser, csys)
1537 1536
1538 outcome = {} 1537 outcome = {}
1539 groups = [('success', ((tc, None) for tc in result.successes)), 1538 groups = [('success', ((tc, None) for tc in result.successes)),
1540 ('failure', result.failures), 1539 ('failure', result.failures),
1541 ('skip', result.skipped)] 1540 ('skip', result.skipped)]
1542 for res, testcases in groups: 1541 for res, testcases in groups:
1543 for tc, __ in testcases: 1542 for tc, __ in testcases:
1544 testresult = {'result': res, 1543 testresult = {'result': res,
1545 'time': ('%0.3f' % timesd[tc.name][0]), 1544 'time': ('%0.3f' % timesd[tc.name][2]),
1546 'cuser': ('%0.3f' % timesd[tc.name][1]), 1545 'cuser': ('%0.3f' % timesd[tc.name][0]),
1547 'csys': ('%0.3f' % timesd[tc.name][2])} 1546 'csys': ('%0.3f' % timesd[tc.name][1])}
1548 outcome[tc.name] = testresult 1547 outcome[tc.name] = testresult
1549 1548
1550 jsonout = json.dumps(outcome, sort_keys=True, indent=4) 1549 jsonout = json.dumps(outcome, sort_keys=True, indent=4)
1551 fp.writelines(("testreport =", jsonout)) 1550 fp.writelines(("testreport =", jsonout))
1552 finally: 1551 finally: