scripts: coverage: gcovr to ignore negative counters

Apply a workaround for an issue introduced with bc8b7dd
for code coverage collection at qemu_x86 when gcov data
was broken because of optimized out memcpy() in write_u64()
static inline function, so gcovr parser fails with
"gcovr.gcov_parser.NegativeHits: Got negative hit value
in gcov line 'branch  1 taken -1'".

Add gcovr command line option to ignore such errors (since v.6.0):
"--gcov-ignore-parse-errors=negative_hits.warn_once_per_file"

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
This commit is contained in:
Dmitrii Golovanov 2023-10-26 07:42:28 +02:00 committed by Anas Nashif
parent 6b87eedee0
commit 97fab83716
2 changed files with 6 additions and 6 deletions

View File

@ -221,11 +221,11 @@ class Gcovr(CoverageTool):
excludes = Gcovr._interleave_list("-e", self.ignores)
# We want to remove tests/* and tests/ztest/test/* but save tests/ztest
cmd = ["gcovr", "-r", self.base_dir, "--gcov-executable",
str(self.gcov_tool), "-e", "tests/*"] + excludes + ["--json",
"-o",
coveragefile,
outdir]
cmd = ["gcovr", "-r", self.base_dir,
"--gcov-ignore-parse-errors=negative_hits.warn_once_per_file",
"--gcov-executable", str(self.gcov_tool),
"-e", "tests/*"]
cmd += excludes + ["--json", "-o", coveragefile, outdir]
cmd_str = " ".join(cmd)
logger.debug(f"Running {cmd_str}...")
subprocess.call(cmd, stdout=coveragelog)

View File

@ -10,7 +10,7 @@ colorama
ply>=3.10
# used for code coverage
gcovr>=4.2
gcovr>=6.0
coverage
# used for west-command testing