]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/core/runner: add helper to know about expected failures
authorAlexis Lothoré <alexis.lothore@bootlin.com>
Fri, 9 Jun 2023 06:47:59 +0000 (08:47 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 17 Jun 2023 10:46:45 +0000 (11:46 +0100)
Testing framework currently uses the unittest.expectedFailure decorator for
tests that can have intermittent failures (see PTEST_EXPECT_FAILURE = "1")
in core-image-ptest.bb. While it allows upper layers to run tests without
failing on "fragile" tests, it prevents those from knowing more about those
failing tests since they are not accounting as failures (for example we
could want to retrieve some logs about failed tests to improve them, and
eventually to drop expectFailure decorator)

Add a helper to allow upper layers to know about those failures which won't
make global testing session

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/core/runner.py

index d50690ab37f8a32d144dfc8318919acd6cbd4651..5077eb8e3e32a6579e6d8f0754c3f9cef31d8d8f 100644 (file)
@@ -229,6 +229,10 @@ class OETestResult(_TestResult):
         # Override as we unexpected successes aren't failures for us
         return (len(self.failures) == len(self.errors) == 0)
 
+    def hasAnyFailingTest(self):
+        # Account for expected failures
+        return not self.wasSuccessful() or len(self.expectedFailures)
+
 class OEListTestsResult(object):
     def wasSuccessful(self):
         return True