]> code.ossystems Code Review - openembedded-core.git/commitdiff
resulttool/report: Handle missing metadata sections more cleanly
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 27 Feb 2019 16:51:56 +0000 (16:51 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Mar 2019 23:12:07 +0000 (23:12 +0000)
Currently some older results files cause the code to give tracebacks.
Handle these missing sections more cleanly.

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

index 2f5ea308e21624689269da107a45d1725f406712..5ffe262f89be1bcad802bf1dc76dcdbfb5c370e5 100644 (file)
@@ -31,9 +31,12 @@ class ResultsTextReport(object):
     def handle_ptest_result(self, k, status, result):
         if k == 'ptestresult.sections':
             return
-        _, suite, test = k.split(".", 2)
+        try:
+            _, suite, test = k.split(".", 2)
+        except ValueError:
+            return
         # Handle 'glib-2.0'
-        if suite not in result['ptestresult.sections']:
+        if 'ptestresult.sections' in result and suite not in result['ptestresult.sections']:
             try:
                 _, suite, suite1, test = k.split(".", 3)
                 if suite + "." + suite1 in result['ptestresult.sections']:
@@ -45,7 +48,7 @@ class ResultsTextReport(object):
         for tk in self.result_types:
             if status in self.result_types[tk]:
                 self.ptests[suite][tk] += 1
-        if suite in result['ptestresult.sections']:
+        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]: