[build] Switch sanitizer coverage bot to gn

This adds GN configs for using sanitizer coverage and refactors gcov
configs. Now, both coverage kinds are behind the same gn argument
v8_code_coverage.

This also switches the bot to GN.

Bug: chromium:645890,v8:5502
Change-Id: I3af606e0cad109dd790a121d0d92e53cf4e38f9a
Reviewed-on: https://chromium-review.googlesource.com/549360
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46254}
This commit is contained in:
Michael Achenbach 2017-06-27 13:49:13 +02:00 committed by Commit Bot
parent bb786d61b4
commit 095132d67a
4 changed files with 36 additions and 30 deletions

View File

@ -21,9 +21,6 @@ declare_args() {
# Print to stdout on Android.
v8_android_log_stdout = false
# Set flags for tracking code coverage with gcov. Requires is_clang=false.
v8_code_coverage = false
# Sets -DV8_ENABLE_FUTURE.
v8_enable_future = false
@ -513,23 +510,15 @@ config("toolchain") {
# Configs for code coverage with gcov. Separate configs for cflags and ldflags
# to selectively influde cflags in non-test targets only.
config("v8_code_coverage_cflags") {
# Make sure we're using gcc toolchain.
if (v8_code_coverage) {
assert(!is_clang)
cflags = [
"-fprofile-arcs",
"-ftest-coverage",
]
}
config("v8_gcov_coverage_cflags") {
cflags = [
"-fprofile-arcs",
"-ftest-coverage",
]
}
config("v8_code_coverage_ldflags") {
# Make sure we're using gcc toolchain.
if (v8_code_coverage) {
assert(!is_clang)
ldflags = [ "-fprofile-arcs" ]
}
config("v8_gcov_coverage_ldflags") {
ldflags = [ "-fprofile-arcs" ]
}
###############################################################################

View File

@ -56,6 +56,11 @@ template("v8_isolate_run") {
}
# Translate gn to gyp variables.
if (v8_code_coverage) {
coverage = "1"
} else {
coverage = "0"
}
if (is_asan) {
asan = "1"
} else {
@ -157,9 +162,9 @@ template("v8_isolate_run") {
"--config-variable",
"tsan=$tsan",
"--config-variable",
"coverage=0",
"coverage=$coverage",
"--config-variable",
"sanitizer_coverage=0",
"sanitizer_coverage=$sanitizer_coverage_flags",
"--config-variable",
"component=$component",
"--config-variable",

View File

@ -7,6 +7,10 @@ import("//build/config/v8_target_cpu.gni")
import("//build/split_static_library.gni")
declare_args() {
# Set flags for tracking code coverage. Uses gcov with gcc and sanitizer
# coverage with clang.
v8_code_coverage = false
# Includes files needed for correctness fuzzing.
v8_correctness_fuzzer = false
@ -68,7 +72,6 @@ v8_remove_configs = []
v8_add_configs = [
v8_path_prefix + ":features",
v8_path_prefix + ":toolchain",
v8_path_prefix + ":v8_code_coverage_ldflags",
]
if (is_debug && !v8_optimized_debug) {
@ -86,6 +89,13 @@ if (is_debug && !v8_optimized_debug) {
}
}
if (v8_code_coverage && !is_clang) {
v8_add_configs += [
v8_path_prefix + ":v8_gcov_coverage_cflags",
v8_path_prefix + ":v8_gcov_coverage_ldflags",
]
}
if (is_posix && v8_enable_backtrace) {
v8_remove_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
v8_add_configs += [ "//build/config/gcc:symbol_visibility_default" ]
@ -106,7 +116,6 @@ template("v8_source_set") {
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
configs += [ v8_path_prefix + ":v8_code_coverage_cflags" ]
}
}
@ -116,7 +125,6 @@ template("v8_header_set") {
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
configs += [ v8_path_prefix + ":v8_code_coverage_cflags" ]
}
}
@ -138,10 +146,15 @@ template("v8_executable") {
# For enabling ASLR.
ldflags = [ "-pie" ]
}
if (!defined(testonly) || !testonly) {
if (defined(testonly) && testonly && v8_code_coverage) {
# Only add code coverage cflags for non-test files for performance
# reasons.
configs += [ v8_path_prefix + ":v8_code_coverage_cflags" ]
if (is_clang) {
configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
configs += [ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
} else {
configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ]
}
}
}
}
@ -152,6 +165,5 @@ template("v8_component") {
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
configs += [ v8_path_prefix + ":v8_code_coverage_cflags" ]
}
}

View File

@ -195,7 +195,7 @@
'v8_linux64_asan_rel_ng': 'gn_release_x64_asan_minimal_symbols',
'v8_linux64_msan_rel': 'gn_release_simulate_arm64_msan_minimal_symbols',
'v8_linux64_sanitizer_coverage_rel':
'gyp_release_x64_asan_minimal_symbols_coverage',
'gn_release_x64_asan_minimal_symbols_coverage',
'v8_linux64_tsan_rel': 'gn_release_x64_tsan_minimal_symbols',
'v8_linux64_tsan_concurrent_marking_rel_ng':
'gn_release_x64_tsan_concurrent_marking_minimal_symbols',
@ -368,6 +368,9 @@
'gn_release_x64_asan_minimal_symbols': [
'gn', 'release_bot', 'x64', 'asan', 'lsan', 'minimal_symbols',
'swarming'],
'gn_release_x64_asan_minimal_symbols_coverage': [
'gn', 'release_bot', 'x64', 'asan', 'bb', 'coverage', 'lsan',
'minimal_symbols', 'swarming'],
'gn_release_x64_asan_no_lsan': [
'gn', 'release_bot', 'x64', 'asan', 'swarming'],
'gn_release_x64_asan_symbolized_edge_verify_heap': [
@ -496,9 +499,6 @@
# Gyp release configs for x64.
'gyp_release_x64': [
'gyp', 'release_bot', 'x64', 'swarming'],
'gyp_release_x64_asan_minimal_symbols_coverage': [
'gyp', 'release_bot', 'x64', 'asan', 'bb', 'coverage', 'lsan',
'minimal_symbols', 'swarming'],
'gyp_release_x64_gcc_coverage': [
'gyp', 'release_bot', 'x64', 'coverage', 'gcc'],