]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/selftest/multiprocesslauch: Fix test race
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 6 Jul 2021 11:06:24 +0000 (12:06 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 7 Jul 2021 10:38:57 +0000 (11:38 +0100)
Having two possible failures in multiprocesslauch creates a race where one failure
may occur and stop processes being lanuched meaning the second failure may not
be seen. Rather than having periodic races appearing on the autobuilder, only
have one failure, making the test much more deterministic.

[YOCTO #13054]

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

index a7214beb4c0d4eb25a85ad94d3a5455f80f363e3..bbf67bf9c9b32a949d70075be7b61c82f78ef463 100644 (file)
@@ -64,7 +64,7 @@ class TestMultiprocessLaunch(TestCase):
         import bb
 
         def testfunction(item, d):
-            if item == "2" or item == "1":
+            if item == "2":
                 raise KeyError("Invalid number %s" % item)
             return "Found %s" % item
 
@@ -99,5 +99,4 @@ class TestMultiprocessLaunch(TestCase):
         # Assert the function prints exceptions
         with captured_output() as (out, err):
             self.assertRaises(bb.BBHandledException, multiprocess_launch, testfunction, ["1", "2", "3", "4", "5", "6"], d, extraargs=(d,))
-        self.assertIn("KeyError: 'Invalid number 1'", out.getvalue())
         self.assertIn("KeyError: 'Invalid number 2'", out.getvalue())