twister: Collect test names in lcov
When using --coverage-per-instance, collect the test names in lcov, and add --show-details to the html report to display those test names. Signed-off-by: Jeremy Bettis <jbettis@google.com>
This commit is contained in:
parent
b544e0a2b3
commit
1385f02979
1 changed files with 8 additions and 1 deletions
|
@ -297,6 +297,10 @@ class Lcov(CoverageTool):
|
|||
cmd.append(filename)
|
||||
else:
|
||||
cmd = ["--capture", "--directory", outdir, "--output-file", coveragefile]
|
||||
if self.coverage_per_instance and len(self.instances) == 1:
|
||||
invalid_chars = re.compile(r"[^A-Za-z0-9_]")
|
||||
cmd.append("--test-name")
|
||||
cmd.append(invalid_chars.sub("_", next(iter(self.instances))))
|
||||
self.run_lcov(cmd, coveragelog)
|
||||
|
||||
# We want to remove tests/* and tests/ztest/test/* but save tests/ztest
|
||||
|
@ -325,7 +329,10 @@ class Lcov(CoverageTool):
|
|||
|
||||
cmd = ["genhtml", "--legend", "--branch-coverage",
|
||||
"--prefix", self.base_dir,
|
||||
"-output-directory", os.path.join(outdir, "coverage")] + files
|
||||
"-output-directory", os.path.join(outdir, "coverage")]
|
||||
if self.coverage_per_instance:
|
||||
cmd.append("--show-details")
|
||||
cmd += files
|
||||
ret = self.run_command(cmd, coveragelog)
|
||||
|
||||
# TODO: Add LCOV summary coverage report.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue