twister: coverage: Fix LCOV full path prefixes

In some cases genhtml incorrectly built reports from LCOV
coverage data using full path for some of the source files
and relative paths for other files.
This fix adds `--prefix` parameter to shorten paths explicitly
relative to the ZEPHYR_BASE directory.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
This commit is contained in:
Dmitrii Golovanov 2023-12-15 16:01:32 +01:00 committed by Maureen Helm
parent a1042c4079
commit 947c9dc1b4

View file

@ -224,6 +224,7 @@ class Lcov(CoverageTool):
# The --ignore-errors source option is added to avoid it exiting due to
# samples/application_development/external_lib/
cmd = ["genhtml", "--legend", "--branch-coverage",
"--prefix", self.base_dir,
"-output-directory",
os.path.join(outdir, "coverage")] + files
cmd = cmd + ignore_errors