diff tests/run-tests.py @ 22486:f166e08ece3b

run-tests: added 'cuser', 'csys' time info in report.json file This patch adds up a 'cuser' and 'csys'(cputime) info in report.json file which generated when --json is enabled while testing. Now the new format of report.json file is as below. testreport ={ "test-success.t": { "csys": "1.041", "cuser": "1.041", "result": "success", "time": "2.041" } "test-failure.t": { "csys": "1.041", "cuser": "1.041", "result": "failure", "time": "4.430" } "test-skip.t": { "csys": "1.041", "cuser": "1.041", "result": "skip", "time": "3.754" } }
author anuraggoel <anurag.dsps@gmail.com>
date Fri, 19 Sep 2014 07:23:10 +0530
parents c42e69268f5b
children 9a20f53e436f
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Sep 19 14:51:58 2014 -0500
+++ b/tests/run-tests.py	Fri Sep 19 07:23:10 2014 +0530
@@ -1437,22 +1437,28 @@
             try:
                 timesd = {}
                 for test, cuser, csys, real in result.times:
-                    timesd[test] = real
+                    timesd[test] = (real, cuser, csys)
 
                 outcome = {}
                 for tc in result.successes:
                     testresult = {'result': 'success',
-                                  'time': ('%0.3f' % timesd[tc.name])}
+                                  'time': ('%0.3f' % timesd[tc.name][0]),
+                                  'cuser': ('%0.3f' % timesd[tc.name][1]),
+                                  'csys': ('%0.3f' % timesd[tc.name][2])}
                     outcome[tc.name] = testresult
 
                 for tc, err in sorted(result.faildata.iteritems()):
                     testresult = {'result': 'failure',
-                                  'time': ('%0.3f' % timesd[tc])}
+                                  'time': ('%0.3f' % timesd[tc][0]),
+                                  'cuser': ('%0.3f' % timesd[tc][1]),
+                                  'csys': ('%0.3f' % timesd[tc][2])}
                     outcome[tc] = testresult
 
                 for tc, reason in result.skipped:
                     testresult = {'result': 'skip',
-                                  'time': ('%0.3f' % timesd[tc.name])}
+                                  'time': ('%0.3f' % timesd[tc.name][0]),
+                                  'cuser': ('%0.3f' % timesd[tc.name][1]),
+                                  'csys': ('%0.3f' % timesd[tc.name][2])}
                     outcome[tc.name] = testresult
 
                 jsonout = json.dumps(outcome, sort_keys=True, indent=4)