[test] Import v8.gni to googletest and fix its visibility

This CL ensures googletest is built with the build configuration used
for other components of V8. This works around the issue that googletest
is compiled with hidden visibility, even in configurations that compile
with default visibility, such as when v8_enable_backtrace is provided.

Bug: chromium:1191946
Change-Id: I70fa3ce0a668a71a091607c22d2dda67e496fec4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2850700
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74189}
This commit is contained in:
Maya Lekova 2021-04-26 15:49:19 +02:00 committed by Commit Bot
parent a8ba725f98
commit 7f9d7f0e40
2 changed files with 21 additions and 1 deletions

2
DEPS
View File

@ -193,7 +193,7 @@ deps = {
'condition': 'checkout_fuchsia',
},
'third_party/googletest/src':
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '07f4869221012b16b7f9ee685d94856e1fc9f361',
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + 'f16d43cd38e9f2e41357dba8445f9d3a32d4e83d',
'third_party/google_benchmark/src': {
'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + '7f27afe83b82f3a98baf58ef595814b9d42a5b2b',
},

View File

@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../gni/v8.gni")
config("gtest_config") {
visibility = [ ":*" ] # gmock also shares this config.
@ -92,6 +94,15 @@ source_set("gtest") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
# V8-only workaround for http://crbug.com/chromium/1191946. Ensures that
# googletest is compiled with the same visibility such as the rest of V8, see
# https://source.chromium.org/chromium/chromium/src/+/master:v8/gni/v8.gni
if ((is_posix || is_fuchsia) &&
(v8_enable_backtrace || v8_monolithic || v8_expose_symbols)) {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
deps = []
if (is_fuchsia) {
@ -142,6 +153,15 @@ source_set("gmock") {
"src/googlemock/src/gmock.cc",
]
# V8-only workaround for http://crbug.com/chromium/1191946. Ensures that
# googletest is compiled with the same visibility such as the rest of V8, see
# https://source.chromium.org/chromium/chromium/src/+/master:v8/gni/v8.gni
if ((is_posix || is_fuchsia) &&
(v8_enable_backtrace || v8_monolithic || v8_expose_symbols)) {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
public_configs = [
":gmock_config",
":gtest_config",