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 <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2025-06-17 06:05:13 -04:00 committed by Benjamin Cabé
commit 91dc04d5d0

View file

@ -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