]> code.ossystems Code Review - openembedded-core.git/commitdiff
testresults.json: add duration of the tests as well
authorAlexander Kanavin <alex.kanavin@gmail.com>
Thu, 30 Apr 2020 12:30:33 +0000 (14:30 +0200)
committerSteve Sakoman <steve@sakoman.com>
Fri, 22 May 2020 16:34:00 +0000 (06:34 -1000)
This is printed by testimage, but isn't actually saved.
It's a useful metric for tracking execution times.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 8fc19639f47b959a141dae231395bbababa644e1)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/lib/oeqa/core/runner.py

index 1284295c345ae65e042bab0966b6599cc20281b4..00b7d0bb12e85d6f33c4a6f3fbe53c269cf681c3 100644 (file)
@@ -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