From 2acb49212ef8d06cf2a0c84a696f8b4b1b2334c1 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Thu, 30 Apr 2020 14:30:33 +0200 Subject: 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. (From OE-Core rev: 866c652c850d9e23300218fcbe0b9e4b3ade2ebf) Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie (cherry picked from commit 8fc19639f47b959a141dae231395bbababa644e1) Signed-off-by: Steve Sakoman Signed-off-by: Richard Purdie --- meta/lib/oeqa/core/runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py index 1284295c34..00b7d0bb12 100644 --- a/meta/lib/oeqa/core/runner.py +++ b/meta/lib/oeqa/core/runner.py @@ -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 -- cgit v1.2.3-54-g00ecf