]> code.ossystems Code Review - openembedded-core.git/commitdiff
resulttool/report: Ensure test suites with no results show up on the report
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 27 Feb 2019 17:05:29 +0000 (17:05 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Mar 2019 23:12:07 +0000 (23:12 +0000)
ptest suites with no results don't show up on the reports even though we have
a duration for them. Fix this so the fact they report no tests is visible.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/resulttool/report.py

index 5ffe262f89be1bcad802bf1dc76dcdbfb5c370e5..ff1b32c7706bb649770f5d6d756ca271fdec1863 100644 (file)
@@ -30,6 +30,14 @@ class ResultsTextReport(object):
 
     def handle_ptest_result(self, k, status, result):
         if k == 'ptestresult.sections':
+            # Ensure tests without any test results still show up on the report
+            for suite in result['ptestresult.sections']:
+                if suite not in self.ptests:
+                    self.ptests[suite] = {'passed': 0, 'failed': 0, 'skipped': 0, 'duration' : '-', 'failed_testcases': []}
+                if 'duration' in result['ptestresult.sections'][suite]:
+                    self.ptests[suite]['duration'] = result['ptestresult.sections'][suite]['duration']
+                if 'timeout' in result['ptestresult.sections'][suite]:
+                    self.ptests[suite]['duration'] += " T"
             return
         try:
             _, suite, test = k.split(".", 2)
@@ -48,11 +56,6 @@ class ResultsTextReport(object):
         for tk in self.result_types:
             if status in self.result_types[tk]:
                 self.ptests[suite][tk] += 1
-        if 'ptestresult.sections' in result and suite in result['ptestresult.sections']:
-            if 'duration' in result['ptestresult.sections'][suite]:
-                self.ptests[suite]['duration'] = result['ptestresult.sections'][suite]['duration']
-            if 'timeout' in result['ptestresult.sections'][suite]:
-                self.ptests[suite]['duration'] += " T"
 
     def get_aggregated_test_result(self, logger, testresult):
         test_count_report = {'passed': 0, 'failed': 0, 'skipped': 0, 'failed_testcases': []}