]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/sstatetests: Fix race issue
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 30 Mar 2024 18:08:15 +0000 (18:08 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 31 Mar 2024 05:56:57 +0000 (06:56 +0100)
Under some load conditions, the result event can come back before the
command complete event. If that happens, the code would hang
indefinitely.

Rework the code to wait for both events and avoid the hang.

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

index e2f509c3e83c628c048915aa0e8cad6c2e80269f..86d6cd7464ff0f4f04144f4a957b16c02e2e3140 100644 (file)
@@ -772,15 +772,16 @@ addtask tmptask2 before do_tmptask1
 
             def find_siginfo(pn, taskname, sigs=None):
                 result = None
+                command_complete = False
                 tinfoil.set_event_mask(["bb.event.FindSigInfoResult",
                                 "bb.command.CommandCompleted"])
                 ret = tinfoil.run_command("findSigInfo", pn, taskname, sigs)
                 if ret:
-                    while True:
+                    while result is None or not command_complete:
                         event = tinfoil.wait_event(1)
                         if event:
                             if isinstance(event, bb.command.CommandCompleted):
-                                break
+                                command_complete = True
                             elif isinstance(event, bb.event.FindSigInfoResult):
                                 result = event.result
                 return result