Skip to contentSkip to conversation

testresults.json: add duration of the tests as well

PATCH New Alexander Kanavin 1 participant 1 message Apr 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testresults.json: add duration of the tests as well

This is printed by testimage, but isn't actually saved. It's a useful metric for tracking execution times.

---
 meta/lib/oeqa/core/runner.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/lib/oeqa/core/runner.py +5 -1
index 1284295c34..00b7d0bb12 100644
@@ -182,8 +182,10 @@ class OETestResult(_TestResult):
             (status, log) = self._getTestResultDetails(case)
 
             t = ""
+            duration = 0
             if case.id() in self.starttime and case.id() in self.endtime:
-                t = " (" + "{0:.2f}".format(self.endtime[case.id()] - self.starttime[case.id()]) + "s)"
+                duration = self.endtime[case.id()] - self.starttime[case.id()]
+                t = " (" + "{0:.2f}".format(duration) + "s)"
 
             if status not in logs:
                 logs[status] = []
@@ -191,6 +193,8 @@ class OETestResult(_TestResult):
             report = {'status': status}
             if log:
                 report['log'] = log
+            if duration:
+                report['duration'] = duration
             if dump_streams and case.id() in self.logged_output:
                 (stdout, stderr) = self.logged_output[case.id()]
                 report['stdout'] = stdout
Signature · 1 line
2.26.1