[llvm] 565cbc2 - [gn build] Use build-machine-independent paths in coverage information
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 5 07:47:55 PDT 2021
Author: Nico Weber
Date: 2021-11-05T10:47:49-04:00
New Revision: 565cbc2ca2a0d687eb0e21b187f5277a33c833b3
URL: https://github.com/llvm/llvm-project/commit/565cbc2ca2a0d687eb0e21b187f5277a33c833b3
DIFF: https://github.com/llvm/llvm-project/commit/565cbc2ca2a0d687eb0e21b187f5277a33c833b3.diff
LOG: [gn build] Use build-machine-independent paths in coverage information
This is possible after D106314 / 8773822c578a.
Makes the required prepare-code-coverage-artifact.py invocation a bit longer,
but that seems like a good tradeoff.
Differential Revision: https://reviews.llvm.org/D113282
Added:
Modified:
llvm/utils/gn/build/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index 03f6d8e74fe34..e705fe81652e2 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -7,7 +7,8 @@ import("//llvm/utils/gn/build/toolchain/target_flags.gni")
declare_args() {
# Whether to build everything with coverage information.
# After building with this, run tests and then run
- # llvm/utils/prepare-code-coverage-artifact.py \
+ # llvm/utils/prepare-code-coverage-artifact.py \
+ # --compilation-dir=out/gn \
# .../llvm-profdata .../llvm-cov out/gn/profiles/ report/ \
# out/gn/bin/llvm-undname ...
# to generate a HTML report for the binaries passed in the last line.
@@ -226,6 +227,10 @@ config("compiler_defaults") {
cflags += [
"-fcoverage-mapping",
+ # For build determinism. Using this requires passing --compilation-dir to
+ # llvm/utils/prepare-code-coverage-artifact.py.
+ "-fcoverage-compilation-dir=.",
+
# Using an absolute path here is lame, but it's used at test execution
# time to generate the profiles, and lit doesn't specify a fixed folder
# for test execution -- so this is the only way to get all profiles into
@@ -234,14 +239,6 @@ config("compiler_defaults") {
"-fprofile-instr-generate=" +
rebase_path("$root_build_dir/profiles/%4m.profraw"),
]
- if (use_goma) {
- # goma has a bug where it writes the server-side absolute path.
- # Work around that.
- # FIXME: Instead, set this to `.` for deterministic builds and pass
- # the build dir to prepare-code-coverage-artifact.py instead.
- cflags += [ "-fcoverage-compilation-dir=" + rebase_path(root_build_dir) ]
- }
-
if (host_os != "win") {
ldflags += [ "-fprofile-instr-generate" ]
}
More information about the llvm-commits
mailing list