Skip to content

Commit

Permalink
Switch coverage to clang, ensure out dir for config exists
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin committed Feb 7, 2025
1 parent 678832f commit 43f94d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,16 @@ config("fuzzing_default") {
}

config("coverage") {
cflags = [ "--coverage" ]
if (is_clang) {
cflags = [
# CLANG builds use the clang-specific coverage, so that versions of lcov/gcov
# do not have to match and `llvm-cov export -format=lcov` can be used
"-fprofile-instr-generate",
"-fcoverage-mapping",
]
} else {
cflags = [ "--coverage" ]
}
ldflags = cflags
}

Expand Down
4 changes: 3 additions & 1 deletion scripts/tests/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def _get_variants(coverage: Optional[bool]):
else:
config["OPTIONS"]["coverage"] = "false"

if not os.path.exists("./out"):
os.mkdir("./out")
with open(config_path, "w") as f:
config.write(f)

Expand Down Expand Up @@ -517,7 +519,7 @@ def as_runner(path):
return _maybe_with_runner(os.path.basename(path), path, runner)

# create an env file
with open("out/test_env.yaml", "wt") as f:
with open("./out/test_env.yaml", "wt") as f:
for target in _get_targets(coverage):
run_path = as_runner(f"out/{target.target}/{target.binary}")
f.write(f"{target.key}: {run_path}\n")
Expand Down

0 comments on commit 43f94d6

Please sign in to comment.