Revert "Use the wrapper script in all coverage builds."
This reverts commit 78d6b9950b4bd9462c226b2cc2ac1f74ad84ad6a. Reason for revert: This broke the coverage builds, see e.g. https://ci.chromium.org/p/chromium/builders/ci/ToTLinuxCoverage/6258 which fails with: "/bin/sh: 1: ../../build/toolchain/clang_code_coverage_wrapper.py--target-os=linux: not found" I guess there's a missing space before --target-os. Could this have been found in testing? Original change's description: > Use the wrapper script in all coverage builds. > > Previously the wrapper script would only be used for coverage builds > that required selective instrumentation of specific files. Now it > will also be used for any coverage builds. > > Since the script's job is to remove flags from files that shouldn't > have them the default_coverage config now adds to cflags even in a > CQ build. > > Bug: 918215 > Change-Id: I012c5732d46bf5cff9eaf8f50615739bb781cc29 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1496002 > Commit-Queue: Sajjad Mirza <sajjadm@google.com> > Reviewed-by: Dirk Pranke <dpranke@chromium.org> > Reviewed-by: Max Moroz <mmoroz@chromium.org> > Reviewed-by: Yuke Liao <liaoyuke@chromium.org> > Cr-Commit-Position: refs/heads/master@{#638321} TBR=stgao@chromium.org,dpranke@chromium.org,robertocn@chromium.org,mmoroz@chromium.org,liaoyuke@chromium.org,sajjadm@google.com Change-Id: I8a945239dadc84d5e1c55a94ee84e34f413e54d5 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 918215 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508457 Reviewed-by: Hans Wennborg <hans@chromium.org> Commit-Queue: Hans Wennborg <hans@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#638561} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: a3a48425d72da578ca09184e89ef898b405550c5
This commit is contained in:
Родитель
95311bc1d1
Коммит
765920bd73
|
@ -25,20 +25,25 @@ config("default_coverage") {
|
|||
}
|
||||
}
|
||||
|
||||
cflags = [
|
||||
"-fprofile-instr-generate",
|
||||
"-fcoverage-mapping",
|
||||
# Coverage flags are only on by default when instrument all source files.
|
||||
# Otherwise, coverage flags are dynamically passed to the compile command
|
||||
# via the //build/toolchain/clang_code_coverage_wrapper.py script.
|
||||
if (coverage_instrumentation_input_file == "") {
|
||||
cflags = [
|
||||
"-fprofile-instr-generate",
|
||||
"-fcoverage-mapping",
|
||||
|
||||
# Following experimental flags removes unused header functions from the
|
||||
# coverage mapping data embedded in the test binaries, and the reduction
|
||||
# of binary size enables building Chrome's large unit test targets on
|
||||
# MacOS. Please refer to crbug.com/796290 for more details.
|
||||
"-mllvm",
|
||||
"-limited-coverage-experimental=true",
|
||||
]
|
||||
# Following experimental flags removes unused header functions from the
|
||||
# coverage mapping data embedded in the test binaries, and the reduction
|
||||
# of binary size enables building Chrome's large unit test targets on
|
||||
# MacOS. Please refer to crbug.com/796290 for more details.
|
||||
"-mllvm",
|
||||
"-limited-coverage-experimental=true",
|
||||
]
|
||||
|
||||
if (!is_win) {
|
||||
cflags += [ "-fno-use-cxa-atexit" ]
|
||||
if (!is_win) {
|
||||
cflags += [ "-fno-use-cxa-atexit" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,48 +194,25 @@ template("gcc_toolchain") {
|
|||
compiler_prefix = "${analyzer_wrapper} " + compiler_prefix
|
||||
}
|
||||
|
||||
# A specific toolchain may wish to avoid coverage instrumentation, so we
|
||||
# allow the global "use_clang_coverage" arg to be overridden.
|
||||
if (defined(toolchain_args.use_clang_coverage)) {
|
||||
toolchain_use_clang_coverage = toolchain_args.use_clang_coverage
|
||||
if (defined(toolchain_args.coverage_instrumentation_input_file)) {
|
||||
toolchain_coverage_instrumentation_input_file =
|
||||
toolchain_args.coverage_instrumentation_input_file
|
||||
} else {
|
||||
toolchain_use_clang_coverage = use_clang_coverage
|
||||
toolchain_coverage_instrumentation_input_file =
|
||||
coverage_instrumentation_input_file
|
||||
}
|
||||
|
||||
# For a coverage build, we use the wrapper script globally so that it can
|
||||
# remove coverage cflags from files that should not have them.
|
||||
if (toolchain_use_clang_coverage) {
|
||||
_use_clang_coverage_wrapper =
|
||||
toolchain_coverage_instrumentation_input_file != ""
|
||||
if (_use_clang_coverage_wrapper) {
|
||||
assert(!use_clang_static_analyzer,
|
||||
"Clang static analyzer wrapper and Clang code coverage wrapper " +
|
||||
"cannot be used together.")
|
||||
|
||||
# "coverage_instrumentation_input_file" is set in args.gn, but it can be
|
||||
# overridden by a toolchain config.
|
||||
if (defined(toolchain_args.coverage_instrumentation_input_file)) {
|
||||
toolchain_coverage_instrumentation_input_file =
|
||||
toolchain_args.coverage_instrumentation_input_file
|
||||
} else {
|
||||
toolchain_coverage_instrumentation_input_file =
|
||||
coverage_instrumentation_input_file
|
||||
}
|
||||
|
||||
_coverage_wrapper =
|
||||
rebase_path("//build/toolchain/clang_code_coverage_wrapper.py",
|
||||
root_build_dir) + " --files-to-instrument=" +
|
||||
rebase_path(toolchain_coverage_instrumentation_input_file,
|
||||
root_build_dir)
|
||||
|
||||
# The wrapper needs to know what OS we target because it uses that to
|
||||
# select a list of files that should not be instrumented.
|
||||
_coverage_wrapper = _coverage_wrapper + "--target-os=" + target_os
|
||||
|
||||
# We want to instrument everything if there is no input file set.
|
||||
# If there is a file we need to give it to the wrapper script so it can
|
||||
# instrument only those files.
|
||||
if (toolchain_coverage_instrumentation_input_file != "") {
|
||||
_coverage_wrapper =
|
||||
_coverage_wrapper + " --files-to-instrument=" +
|
||||
rebase_path(toolchain_coverage_instrumentation_input_file,
|
||||
root_build_dir)
|
||||
}
|
||||
compiler_prefix = "${_coverage_wrapper} " + compiler_prefix
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче