From 248b66dfe3b96ebecb9efb3da69d246e2c317f8a Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Tue, 16 Apr 2024 17:34:33 +0800 Subject: [PATCH] twister: handler: optimize handler testsuite check in many platforms, before the debuger flash, the former testsuite many already executed, so we will see some old testsuite name. and we should not compare them directly, instead if we compare in reversed order them we can avoid such mis-judge. Signed-off-by: Hake Huang --- scripts/pylib/twister/twisterlib/handlers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index 5ef10906b4e..b8007849eb5 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -113,10 +113,12 @@ class Handler: return if not detected_suite_names: self._missing_suite_name(expected_suite_names, handler_time) - for detected_suite_name in detected_suite_names: - if detected_suite_name not in expected_suite_names: + return + # compare the expect and detect from end one by one without order + _d_suite = detected_suite_names[-len(expected_suite_names):] + if set(_d_suite) != set(expected_suite_names): + if not set(_d_suite).issubset(set(expected_suite_names)): self._missing_suite_name(expected_suite_names, handler_time) - break def _missing_suite_name(self, expected_suite_names, handler_time): """