]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/runtime/ptest: Make returning no test results a failure
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 28 Apr 2023 16:51:00 +0000 (17:51 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 3 May 2023 06:33:15 +0000 (07:33 +0100)
Ensure that even if a ptests results section is empty, the log parser adds that
empty section. Then ensure that empty sections trigger warnings.

This means if a ptest suddently stops returning any results, we notice and see
warnings about it. This has gone unnoticed on the autobuilder far too many times
so is very much worth highlighting as a regression. We shouldn't have empty ptests.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/runtime/cases/ptest.py
meta/lib/oeqa/utils/logparser.py

index 3ef902218878d314dc0f8241ff233b1c31b1dc68..23a71ea064cff54468b0bd130bb21775a724d844 100644 (file)
@@ -83,12 +83,15 @@ class PtestRunnerTest(OERuntimeTestCase):
 
         extras['ptestresult.sections'] = sections
 
+        zerolength = []
         trans = str.maketrans("()", "__")
         for section in results:
             for test in results[section]:
                 result = results[section][test]
                 testname = "ptestresult." + (section or "No-section") + "." + "_".join(test.translate(trans).split())
                 extras[testname] = {'status': result}
+            if not results[section]:
+                zerolength.append(section)
 
         failed_tests = {}
 
@@ -107,7 +110,10 @@ class PtestRunnerTest(OERuntimeTestCase):
             failmsg = "ERROR: Processes were killed by the OOM Killer:\n%s\n" % output
 
         if failed_tests:
-            failmsg = failmsg + "Failed ptests:\n%s" % pprint.pformat(failed_tests)
+            failmsg = failmsg + "\nFailed ptests:\n%s\n" % pprint.pformat(failed_tests)
+
+        if zerolength:
+            failmsg = failmsg + "\nptests which had no test results:\n%s" % pprint.pformat(zerolength)
 
         if failmsg:
             self.logger.warning("There were failing ptests.")
index 7cb79a8402aab4ca028b5e14c1b83f63b84ea34e..60df754b36f3554fa013a7a5b067da80564a1bfc 100644 (file)
@@ -44,6 +44,8 @@ class PtestParser(object):
                 result = section_regex['begin'].search(line)
                 if result:
                     current_section['name'] = result.group(1)
+                    if current_section['name'] not in self.results:
+                        self.results[current_section['name']] = {}
                     continue
 
                 result = section_regex['end'].search(line)
@@ -75,8 +77,6 @@ class PtestParser(object):
                 for t in test_regex:
                     result = test_regex[t].search(line)
                     if result:
-                        if current_section['name'] not in self.results:
-                            self.results[current_section['name']] = {}
                         self.results[current_section['name']][result.group(1).strip()] = t
 
         # Python performance for repeatedly joining long strings is poor, do it all at once at the end.