twister: Implement coverage file merging for lcov
Instead of capturing the coverage data twice with --coverage-per-instance, just merge the lcov files in the aggregation report. Signed-off-by: Jeremy Bettis <jbettis@google.com>
This commit is contained in:
parent
6c7d518300
commit
b544e0a2b3
1 changed files with 18 additions and 1 deletions
|
@ -279,6 +279,23 @@ class Lcov(CoverageTool):
|
|||
coveragefile = os.path.join(outdir, "coverage.info")
|
||||
ztestfile = os.path.join(outdir, "ztest.info")
|
||||
|
||||
if build_dirs:
|
||||
files = []
|
||||
for dir_ in build_dirs:
|
||||
files_ = [fname for fname in
|
||||
[os.path.join(dir_, "coverage.info"),
|
||||
os.path.join(dir_, "ztest.info")]
|
||||
if os.path.exists(fname)]
|
||||
if not files_:
|
||||
logger.debug("Coverage merge no files in: %s", dir_)
|
||||
continue
|
||||
files += files_
|
||||
logger.debug("Coverage merge %d reports in %s", len(files), outdir)
|
||||
cmd = ["--output-file", coveragefile]
|
||||
for filename in files:
|
||||
cmd.append("--add-tracefile")
|
||||
cmd.append(filename)
|
||||
else:
|
||||
cmd = ["--capture", "--directory", outdir, "--output-file", coveragefile]
|
||||
self.run_lcov(cmd, coveragelog)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue