提交 #1
This commit is contained in:
38
build/config/coverage/BUILD.gn
Executable file
38
build/config/coverage/BUILD.gn
Executable file
@@ -0,0 +1,38 @@
|
||||
# Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/coverage/coverage.gni")
|
||||
|
||||
config("default_coverage") {
|
||||
if (use_clang_coverage) {
|
||||
cflags = [
|
||||
"--coverage",
|
||||
|
||||
# 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",
|
||||
]
|
||||
|
||||
ldflags = []
|
||||
if (!is_win) {
|
||||
ldflags = [ "--coverage" ]
|
||||
cflags += [ "-fno-use-cxa-atexit" ]
|
||||
} else {
|
||||
# Windows directly calls link.exe instead of the compiler driver when
|
||||
# linking. Hence, pass the runtime libraries instead of
|
||||
# -fsanitize=address.
|
||||
if (target_cpu == "x64") {
|
||||
ldflags += [ "clang_rt.profile-x86_64.lib" ]
|
||||
} else if (target_cpu == "x86") {
|
||||
ldflags += [ "clang_rt.profile-i386.lib" ]
|
||||
} else {
|
||||
assert(false,
|
||||
"use_clang_coverage=true not supported yet for this target_cpu")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
build/config/coverage/coverage.gni
Executable file
13
build/config/coverage/coverage.gni
Executable file
@@ -0,0 +1,13 @@
|
||||
# Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/toolchain/toolchain.gni")
|
||||
|
||||
declare_args() {
|
||||
# Enable Clang's Source-based Code Coverage.
|
||||
use_clang_coverage = false
|
||||
}
|
||||
|
||||
assert(!use_clang_coverage || is_clang,
|
||||
"Clang Source-based Code Coverage requires clang.")
|
||||
Reference in New Issue
Block a user