From 91dc04d5d0ad58d37c0172ac224087de5aebb32d Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 17 Jun 2025 06:05:13 -0400 Subject: [PATCH] twister: adapt ctest results for twister When we have skips in ctest, the overall result should not be marked as a SKIP unless all tests have been skipped. If we have passing tests, mark the test as PASS. Any failures/errors obviously will fail the tests. Also pass the skip reason from ctest to twister to give a hint about what is going on in case of skips. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/harness.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index 5b58b0fdb42..4e74fb9743c 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -1132,7 +1132,7 @@ class Ctest(Harness): elif suite.errors and suite.errors > 0: self.status = TwisterStatus.ERROR self.instance.reason = 'Error during ctest execution' - elif suite.skipped and suite.skipped > 0: + elif suite.skipped == suite.tests: self.status = TwisterStatus.SKIP else: self.status = TwisterStatus.PASS @@ -1149,6 +1149,8 @@ class Ctest(Harness): tc.output = case.system_out elif any(isinstance(r, junit.Skipped) for r in case.result): tc.status = TwisterStatus.SKIP + tc.reason = next((r.message for r in case.result \ + if isinstance(r, junit.Skipped)), 'Ctest skip') else: tc.status = TwisterStatus.PASS