From d40767ac831cb3e20b43a87a47e772026f6d19f6 Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Fri, 9 Nov 2018 00:36:20 -0800 Subject: testsdk: fix skipped testcase output "UNKNOWN" status while multiprocess execution Usually skipped testcase output "SKIPPED" [snip serial execution] |RESULTS - buildgalculator.GalculatorTest.test_galculator - Testcase -1: SKIPPED (0.01s) |RESULTS - python.PythonTest.test_python3 - Testcase -1: SKIPPED (0.01s) [snip serial execution] But if enable multiprocess execution, skipped testcase output "UNKNOWN" status [snip enable multiprocess execution] |RESULTS - buildgalculator.GalculatorTest.test_galculator - Testcase -1: UNKNOWN |RESULTS - python.PythonTest.test_python3 - Testcase -1: UNKNOWN [snip enable multiprocess execution] Here is my investigation: There is a class pairs TestProtocolClient and TestProtocolServer provided by python3-subunit. The TestProtocolClient generates a subunit stream of TestResult from a test run, and TestProtocolServer parses the stream of subunit TestResult. The class ProtocolTestCase is a unittest.TestCase adapter and it uses TestProtocolServer to parse the stream of subunit TestResult. In Yocto testsdk, it forks multiple processes to execute testcases and use TestProtocolClient to generate TestResult stream; and then it creates multiple threads to use ProtocolTestCase to parse stream of subunit TestResult through pipe; finally it passes multiple ProtocolTestCase as TestCase instance to main process and output status result. The problem point is TestProtocolServer parses `skip:' directive after reading a `test:' directive. Without `test:' directive, `skip:' directive will be ignored. All above requires SkipTest should be raised inside a test method rather than setUpClass method. Throwing SkipTest inside setUp works correctly (From OE-Core rev: 4828a88556d59e4d06933164c2ebeb9361b7450e) Signed-off-by: Hongxu Jia Signed-off-by: Richard Purdie --- meta/lib/oeqa/sdk/cases/perl.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'meta/lib/oeqa/sdk/cases/perl.py') diff --git a/meta/lib/oeqa/sdk/cases/perl.py b/meta/lib/oeqa/sdk/cases/perl.py index ff50b46800..e1d2bc159a 100644 --- a/meta/lib/oeqa/sdk/cases/perl.py +++ b/meta/lib/oeqa/sdk/cases/perl.py @@ -2,8 +2,7 @@ import unittest from oeqa.sdk.case import OESDKTestCase class PerlTest(OESDKTestCase): - @classmethod - def setUpClass(self): + def setUp(self): if not (self.tc.hasHostPackage("nativesdk-perl") or self.tc.hasHostPackage("perl-native")): raise unittest.SkipTest("No perl package in the SDK") -- cgit v1.2.3-54-g00ecf