Skip to content

Commit af0cbb1

Browse files
JordanYatesnashif
authored andcommitted
scripts: twisterlib: coverage: ignore __ASSERT branches
Disable branch coverage for the `__ASSERT` family of macros. Covering all of the assertion branches by definition means triggering the assertion, which can be either challenging or impossible to exercise, and in either case results in the immediate termination of the test. Signed-off-by: Jordan Yates <[email protected]>
1 parent 53bd9ea commit af0cbb1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/pylib/twister/twisterlib/coverage.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,5 +428,8 @@ def run_coverage(testplan, options):
428428
# Ignore branch coverage on LOG_* and LOG_HEXDUMP_* macros
429429
# Branch misses are due to the implementation of Z_LOG2 and cannot be avoided
430430
coverage_tool.add_ignore_branch_pattern(r"^\s*LOG_(?:HEXDUMP_)?(?:DBG|INF|WRN|ERR)\(.*")
431+
# Ignore branch coverage on __ASSERT* macros
432+
# Covering the failing case is not desirable as it will immediately terminate the test.
433+
coverage_tool.add_ignore_branch_pattern(r"^\s*__ASSERT(?:_EVAL|_NO_MSG|_POST_ACTION)?\(.*")
431434
coverage_completed = coverage_tool.generate(options.outdir)
432435
return coverage_completed

0 commit comments

Comments
 (0)