changeset 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 efedda4aed49
children e40bb83d0989
files tests/run-tests.py tests/test-run-tests.t
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
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)
--- a/tests/test-run-tests.t	Fri Sep 19 14:51:58 2014 -0500
+++ b/tests/test-run-tests.t	Fri Sep 19 07:23:10 2014 +0530
@@ -394,14 +394,20 @@
   $ cat report.json
   testreport ={
       "test-failure.t": [\{] (re)
+          "csys": "\s*[\d\.]{5}",  (re)
+          "cuser": "\s*[\d\.]{5}",  (re)
           "result": "failure", 
           "time": "\s*[\d\.]{5}" (re)
       }, 
       "test-skip.t": {
+          "csys": "\s*[\d\.]{5}",  (re)
+          "cuser": "\s*[\d\.]{5}",  (re)
           "result": "skip", 
           "time": "\s*[\d\.]{5}" (re)
       }, 
       "test-success.t": [\{] (re)
+          "csys": "\s*[\d\.]{5}",  (re)
+          "cuser": "\s*[\d\.]{5}",  (re)
           "result": "success", 
           "time": "\s*[\d\.]{5}" (re)
       }