Skip to content

Commit a045eae

Browse files
smfebekartben
authored andcommitted
fix: twister: quit-on-failure
use public queue methods to clear queue on failure -s Felix Behnke felixbeiderarbeit@gmail.com Signed-off-by: Felix Behnke <felixbeiderarbeit@gmail.com>
1 parent 013f6f4 commit a045eae

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

scripts/pylib/twister/twisterlib/runner.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,9 +2003,11 @@ def pipeline_mgr(self, pipeline, done_queue, lock, results):
20032003
pb.process(pipeline, done_queue, task, lock, results)
20042004
if self.env.options.quit_on_failure and \
20052005
pb.instance.status in [TwisterStatus.FAIL, TwisterStatus.ERROR]:
2006-
with pipeline.mutex:
2007-
pipeline.queue.clear()
2008-
break
2006+
try:
2007+
while True:
2008+
pipeline.get_nowait()
2009+
except queue.Empty:
2010+
pass
20092011

20102012
return True
20112013
else:
@@ -2021,9 +2023,11 @@ def pipeline_mgr(self, pipeline, done_queue, lock, results):
20212023
pb.process(pipeline, done_queue, task, lock, results)
20222024
if self.env.options.quit_on_failure and \
20232025
pb.instance.status in [TwisterStatus.FAIL, TwisterStatus.ERROR]:
2024-
with pipeline.mutex:
2025-
pipeline.queue.clear()
2026-
break
2026+
try:
2027+
while True:
2028+
pipeline.get_nowait()
2029+
except queue.Empty:
2030+
pass
20272031
return True
20282032
except Exception as e:
20292033
logger.error(f"General exception: {e}\n{traceback.format_exc()}")

0 commit comments

Comments
 (0)