Lines Matching +full:- +full:- +full:coverage
3 # Copyright (c) 2018-2022 Intel Corporation
4 # SPDX-License-Identifier: Apache-2.0
27 """ Base class for every supported coverage tool
42 logger.error(f"Unsupported coverage tool specified: {tool}")
45 logger.debug(f"Select {tool} as the coverage tool...")
63 # Loop until the coverage data is found.
72 hex_dump = sp[1][:-1]
100 # Iteratively call gcov-tool (not gcov) to merge the files
101 merge_tool = self.gcov_tool + '-tool'
102 for d1, d2 in zip(dirs[:-1], dirs[1:], strict=False):
103 cmd = [merge_tool, 'merge', d1, d2, '--output', d2]
107 with open(f'{dirs[-1]}/tmp.gcda', 'rb') as fp:
108 return fp.read(-1).hex()
114 # if kobject_hash is given for coverage gcovr fails
117 filename = (filename[:-4]) + "gcno"
152 with open(os.path.join(outdir, "coverage.log"), "a") as coveragelog:
157 os.path.join(outdir, "coverage", "index.html")
160 os.path.join(outdir, "coverage.info")
163 os.path.join(outdir, "coverage", "coverage.xml")
166 os.path.join(outdir, "coverage", "coverage.csv")
169 os.path.join(outdir, "coverage", "coverage.txt")
172 os.path.join(outdir, "coverage", "coverage.coveralls.json")
175 os.path.join(outdir, "coverage", "coverage.sonarqube.xml")
182 logger.debug(f"All coverage data processed: {coverage_completed}")
199 ['lcov', '--version'],
228 # The --ignore-errors source option is added for genhtml as well as
232 "--ignore-errors", "inconsistent,inconsistent",
233 "--ignore-errors", "negative,negative",
234 "--ignore-errors", "unused,unused",
235 "--ignore-errors", "empty,empty",
236 "--ignore-errors", "mismatch,mismatch",
247 # Default: --parallel=0 will autodetect appropriate parallelism
248 parallel = ["--parallel", "0"]
253 parallel = ["--parallel", str(self.jobs)]
259 "lcov", "--gcov-tool", self.gcov_tool,
260 "--rc", branch_coverage,
265 coveragefile = os.path.join(outdir, "coverage.info")
268 cmd = ["--capture", "--directory", outdir, "--output-file", coveragefile]
272 cmd = ["--extract", coveragefile,
274 "--output-file", ztestfile]
278 cmd = ["--remove", ztestfile,
280 "--output-file", ztestfile]
288 cmd = ["--remove", coveragefile, i, "--output-file", coveragefile]
294 cmd = ["genhtml", "--legend", "--branch-coverage",
295 "--prefix", self.base_dir,
296 "-output-directory", os.path.join(outdir, "coverage")] + files
312 ['gcovr', '--version'],
347 coveragefile = os.path.join(outdir, "coverage.json")
350 excludes = Gcovr._interleave_list("-e", self.ignores)
354 excludes += ["--exclude-branches-by-pattern", merged_regex]
356 # Different ifdef-ed implementations of the same function should not be
357 # in conflict treated by GCOVR as separate objects for coverage statistics.
358 mode_options = ["--merge-mode-functions=separate"]
361 cmd = ["gcovr", "-r", self.base_dir,
362 "--gcov-ignore-parse-errors=negative_hits.warn_once_per_file",
363 "--gcov-executable", self.gcov_tool,
364 "-e", "tests/*"]
365 cmd += excludes + mode_options + ["--json", "-o", coveragefile, outdir]
370 subprocess.call(["gcovr", "-r", self.base_dir, "--gcov-executable",
371 self.gcov_tool, "-f", "tests/ztest", "-e",
372 "tests/ztest/test/*", "--json", "-o", ztestfile,
380 subdir = os.path.join(outdir, "coverage")
383 tracefiles = self._interleave_list("--add-tracefile", files)
385 # Convert command line argument (comma-separated list) to gcovr flags
387 "html": ["--html", os.path.join(subdir, "index.html"), "--html-details"],
388 "xml": ["--xml", os.path.join(subdir, "coverage.xml"), "--xml-pretty"],
389 "csv": ["--csv", os.path.join(subdir, "coverage.csv")],
390 "txt": ["--txt", os.path.join(subdir, "coverage.txt")],
391 "coveralls": ["--coveralls", os.path.join(subdir, "coverage.coveralls.json"),
392 "--coveralls-pretty"],
393 "sonarqube": ["--sonarqube", os.path.join(subdir, "coverage.sonarqube.xml")]
400 ["gcovr", "-r", self.base_dir] \
417 "x86_64-zephyr-elf/bin/x86_64-zephyr-elf-gcov")
422 llvm_cov = shutil.which("llvm-cov", path=llvm_path)
436 "Can't find a suitable gcov tool. Use --gcov-tool or set ZEPHYR_SDK_INSTALL_DIR."
442 logger.info("Generating coverage files...")
453 # Ignore branch coverage on LOG_* and LOG_HEXDUMP_* macros
456 # Ignore branch coverage on __ASSERT* macros