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 <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2024-07-01 15:02:32 +10:00 committed by Anas Nashif
parent 53bd9ead64
commit af0cbb19c0

View file

@ -428,5 +428,8 @@ def run_coverage(testplan, options):
# Ignore branch coverage on LOG_* and LOG_HEXDUMP_* macros
# Branch misses are due to the implementation of Z_LOG2 and cannot be avoided
coverage_tool.add_ignore_branch_pattern(r"^\s*LOG_(?:HEXDUMP_)?(?:DBG|INF|WRN|ERR)\(.*")
# Ignore branch coverage on __ASSERT* macros
# Covering the failing case is not desirable as it will immediately terminate the test.
coverage_tool.add_ignore_branch_pattern(r"^\s*__ASSERT(?:_EVAL|_NO_MSG|_POST_ACTION)?\(.*")
coverage_completed = coverage_tool.generate(options.outdir)
return coverage_completed