in cbmc_viewer/coveraget.py [0:0]
def merge_coverage_data(coverage_list):
"""Merge sets of coverage data"""
coverage = {}
for coverage_data in coverage_list:
if not coverage_data:
logging.info("Found coverage data missing: %s", coverage_data)
continue
# file name -> function data
for filename, function_data in coverage_data.items():
# The source locations produced by srcloct have paths
# relative to the source root for all files under the
# root, and have absolute paths for all other files.
if filename.startswith('/'):
logging.info("Restricting coverage to files under the source "
"root: skipping %s", filename)
continue
coverage[filename] = coverage.get(filename, {})
# function -> line data
for func, line_data in function_data.items():
coverage[filename][func] = coverage[filename].get(func, {})
# line -> coverage status
for line, status in line_data.items():
cov = coverage[filename][func].get(line)
cov = Status.new(status).combine(cov)
coverage[filename][func][line] = cov
try:
coverage and RAW_COVERAGE_DATA(coverage)
except voluptuous.Error as error:
raise UserWarning("Error merging coverage data: {}".format(error)) from error
return coverage