mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-27 07:14:10 +08:00
gn: Build gtest and gmock tests
Bug: crashpad:79 Change-Id: Iea78fcb6a758f57d2b550b214b947ca5aabad036 Reviewed-on: https://chromium-review.googlesource.com/827732 Commit-Queue: Mark Mentovai <mark@chromium.org> Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
parent
8742051c60
commit
3650d56570
@ -62,7 +62,7 @@ if (is_win) {
|
||||
"//third_party/mini_chromium/mini_chromium/build:gcc_like_toolchain")
|
||||
}
|
||||
|
||||
_default_configs = [
|
||||
default_configs = [
|
||||
"//third_party/mini_chromium/mini_chromium/build:default",
|
||||
"//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors",
|
||||
|
||||
@ -72,23 +72,23 @@ _default_configs = [
|
||||
]
|
||||
|
||||
set_defaults("source_set") {
|
||||
configs = _default_configs
|
||||
configs = default_configs
|
||||
}
|
||||
|
||||
set_defaults("static_library") {
|
||||
configs = _default_configs
|
||||
configs = default_configs
|
||||
}
|
||||
|
||||
set_defaults("executable") {
|
||||
configs = _default_configs
|
||||
configs = default_configs
|
||||
}
|
||||
|
||||
set_defaults("loadable_module") {
|
||||
configs = _default_configs
|
||||
configs = default_configs
|
||||
}
|
||||
|
||||
set_defaults("shared_library") {
|
||||
configs = _default_configs
|
||||
configs = default_configs
|
||||
}
|
||||
|
||||
# These are set to constant values for Chromium build file compatibility. This
|
||||
|
@ -15,6 +15,7 @@
|
||||
# This is a forwarding target to match the location that Chromium uses.
|
||||
|
||||
group("gmock") {
|
||||
testonly = true
|
||||
public_configs = [ "//third_party/gtest:gmock_public_config" ]
|
||||
public_deps = [
|
||||
"//third_party/gtest:gmock",
|
||||
|
@ -15,6 +15,7 @@
|
||||
# This is a forwarding target to match the location that Chromium uses.
|
||||
|
||||
group("gtest") {
|
||||
testonly = true
|
||||
public_configs = [ "//third_party/gtest:gtest_public_config" ]
|
||||
public_deps = [
|
||||
"//third_party/gtest:gtest",
|
||||
|
@ -14,9 +14,11 @@
|
||||
|
||||
template("test") {
|
||||
executable(target_name) {
|
||||
deps = []
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
testonly = true
|
||||
forward_variables_from(invoker, "*")
|
||||
}
|
||||
}
|
||||
|
||||
set_defaults("test") {
|
||||
configs = default_configs
|
||||
}
|
||||
|
230
third_party/gtest/BUILD.gn
vendored
230
third_party/gtest/BUILD.gn
vendored
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//testing/test.gni")
|
||||
|
||||
config("gtest_private_config") {
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [ "gtest/googletest" ]
|
||||
@ -23,6 +25,7 @@ config("gtest_public_config") {
|
||||
}
|
||||
|
||||
static_library("gtest") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"gtest/googletest/include/gtest/gtest-death-test.h",
|
||||
"gtest/googletest/include/gtest/gtest-message.h",
|
||||
@ -59,9 +62,155 @@ static_library("gtest") {
|
||||
"gtest/googletest/src/gtest.cc",
|
||||
]
|
||||
sources -= [ "gtest/googletest/src/gtest-all.cc" ]
|
||||
public_configs = [ ":gtest_public_config" ]
|
||||
configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ]
|
||||
configs += [ ":gtest_private_config" ]
|
||||
public_configs = [ ":gtest_public_config" ]
|
||||
}
|
||||
|
||||
static_library("gtest_main") {
|
||||
# Tests outside of this file should use ../../test:gtest_main instead.
|
||||
visibility = [ ":*" ]
|
||||
|
||||
testonly = true
|
||||
sources = [
|
||||
"gtest/googletest/src/gtest_main.cc",
|
||||
]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_all_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest-death-test_test.cc",
|
||||
"gtest/googletest/test/gtest-filepath_test.cc",
|
||||
"gtest/googletest/test/gtest-linked_ptr_test.cc",
|
||||
"gtest/googletest/test/gtest-message_test.cc",
|
||||
"gtest/googletest/test/gtest-options_test.cc",
|
||||
"gtest/googletest/test/gtest-port_test.cc",
|
||||
"gtest/googletest/test/gtest-printers_test.cc",
|
||||
"gtest/googletest/test/gtest-test-part_test.cc",
|
||||
"gtest/googletest/test/gtest-typed-test2_test.cc",
|
||||
"gtest/googletest/test/gtest-typed-test_test.cc",
|
||||
"gtest/googletest/test/gtest-typed-test_test.h",
|
||||
"gtest/googletest/test/gtest_main_unittest.cc",
|
||||
"gtest/googletest/test/gtest_pred_impl_unittest.cc",
|
||||
"gtest/googletest/test/gtest_prod_test.cc",
|
||||
"gtest/googletest/test/gtest_unittest.cc",
|
||||
"gtest/googletest/test/production.cc",
|
||||
"gtest/googletest/test/production.h",
|
||||
]
|
||||
configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ]
|
||||
configs += [ ":gtest_private_config" ]
|
||||
deps = [
|
||||
":gtest",
|
||||
":gtest_main",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_environment_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest_environment_test.cc",
|
||||
]
|
||||
configs += [ ":gtest_private_config" ]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_listener_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest-listener_test.cc",
|
||||
]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_no_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest_no_test_unittest.cc",
|
||||
]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_param_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest-param-test2_test.cc",
|
||||
"gtest/googletest/test/gtest-param-test_test.cc",
|
||||
"gtest/googletest/test/gtest-param-test_test.h",
|
||||
]
|
||||
configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ]
|
||||
configs += [ ":gtest_private_config" ]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_premature_exit_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest_premature_exit_test.cc",
|
||||
]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_repeat_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest_repeat_test.cc",
|
||||
]
|
||||
configs += [ ":gtest_private_config" ]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_sole_header_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest_sole_header_test.cc",
|
||||
]
|
||||
deps = [
|
||||
":gtest",
|
||||
":gtest_main",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_stress_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest_stress_test.cc",
|
||||
]
|
||||
configs += [ ":gtest_private_config" ]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gtest_unittest_api_test") {
|
||||
sources = [
|
||||
"gtest/googletest/test/gtest-unittest-api_test.cc",
|
||||
]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
group("gtest_all_tests") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":gtest_all_test",
|
||||
":gtest_environment_test",
|
||||
":gtest_listener_test",
|
||||
":gtest_no_test",
|
||||
":gtest_param_test",
|
||||
":gtest_premature_exit_test",
|
||||
":gtest_repeat_test",
|
||||
":gtest_sole_header_test",
|
||||
":gtest_stress_test",
|
||||
":gtest_unittest_api_test",
|
||||
]
|
||||
}
|
||||
|
||||
config("gmock_private_config") {
|
||||
@ -74,19 +223,17 @@ config("gmock_public_config") {
|
||||
|
||||
# The MOCK_METHODn() macros do not specify “override”, which triggers this
|
||||
# warning in users: “error: 'Method' overrides a member function but is not
|
||||
# marked 'override' [-Werror,-Winconsistent-missing-override]”. Suppress
|
||||
# these warnings, and add -Wno-unknown-warning-option because only recent
|
||||
# versions of clang (trunk r220703 and later, version
|
||||
# 3.6 and later) recognize it.
|
||||
# marked 'override' [-Werror,-Winconsistent-missing-override]”. Suppress these
|
||||
# warnings until https://github.com/google/googletest/issues/533 is fixed.
|
||||
if (is_clang) {
|
||||
cflags_cc = [
|
||||
"-Wno-inconsistent-missing-override",
|
||||
"-Wno-unknown-warning-option",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
static_library("gmock") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"gtest/googlemock/include/gmock/gmock-actions.h",
|
||||
"gtest/googlemock/include/gmock/gmock-cardinalities.h",
|
||||
@ -113,15 +260,18 @@ static_library("gmock") {
|
||||
"gtest/googlemock/src/gmock.cc",
|
||||
]
|
||||
sources -= [ "gtest/googlemock/src/gmock-all.cc" ]
|
||||
public_configs = [ ":gmock_public_config" ]
|
||||
configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ]
|
||||
configs += [ ":gmock_private_config" ]
|
||||
deps = [
|
||||
":gtest",
|
||||
]
|
||||
configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ]
|
||||
configs += [ ":gmock_private_config" ]
|
||||
public_configs = [ ":gmock_public_config" ]
|
||||
}
|
||||
|
||||
static_library("gmock_main") {
|
||||
# Tests outside of this file should use ../../test:gmock_main instead.
|
||||
visibility = [ ":*" ]
|
||||
testonly = true
|
||||
sources = [
|
||||
"gtest/googlemock/src/gmock_main.cc",
|
||||
]
|
||||
@ -130,3 +280,65 @@ static_library("gmock_main") {
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gmock_all_test") {
|
||||
sources = [
|
||||
"gtest/googlemock/test/gmock-actions_test.cc",
|
||||
"gtest/googlemock/test/gmock-cardinalities_test.cc",
|
||||
"gtest/googlemock/test/gmock-generated-actions_test.cc",
|
||||
"gtest/googlemock/test/gmock-generated-function-mockers_test.cc",
|
||||
"gtest/googlemock/test/gmock-generated-internal-utils_test.cc",
|
||||
"gtest/googlemock/test/gmock-generated-matchers_test.cc",
|
||||
"gtest/googlemock/test/gmock-internal-utils_test.cc",
|
||||
"gtest/googlemock/test/gmock-matchers_test.cc",
|
||||
"gtest/googlemock/test/gmock-more-actions_test.cc",
|
||||
"gtest/googlemock/test/gmock-nice-strict_test.cc",
|
||||
"gtest/googlemock/test/gmock-port_test.cc",
|
||||
"gtest/googlemock/test/gmock-spec-builders_test.cc",
|
||||
"gtest/googlemock/test/gmock_test.cc",
|
||||
]
|
||||
configs += [
|
||||
":gmock_private_config",
|
||||
":gtest_private_config",
|
||||
]
|
||||
deps = [
|
||||
":gmock",
|
||||
":gmock_main",
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gmock_link_test") {
|
||||
sources = [
|
||||
"gtest/googlemock/test/gmock_link2_test.cc",
|
||||
"gtest/googlemock/test/gmock_link_test.cc",
|
||||
"gtest/googlemock/test/gmock_link_test.h",
|
||||
]
|
||||
configs += [ ":gmock_private_config" ]
|
||||
deps = [
|
||||
":gmock",
|
||||
":gmock_main",
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
test("gmock_stress_test") {
|
||||
sources = [
|
||||
"gtest/googlemock/test/gmock_stress_test.cc",
|
||||
]
|
||||
configs -= [ "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors" ]
|
||||
configs += [ ":gmock_private_config" ]
|
||||
deps = [
|
||||
":gmock",
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
|
||||
group("gmock_all_tests") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":gmock_all_test",
|
||||
":gmock_link_test",
|
||||
":gmock_stress_test",
|
||||
]
|
||||
}
|
||||
|
7
third_party/gtest/gmock.gyp
vendored
7
third_party/gtest/gmock.gyp
vendored
@ -92,22 +92,19 @@
|
||||
# triggers this warning in users: “error: 'Method' overrides a
|
||||
# member function but is not marked 'override'
|
||||
# [-Werror,-Winconsistent-missing-override]”. Suppress these
|
||||
# warnings, and add -Wno-unknown-warning-option because only
|
||||
# recent versions of clang (trunk r220703 and later, version
|
||||
# 3.6 and later) recognize it.
|
||||
# warnings until https://github.com/google/googletest/issues/533 is
|
||||
# fixed.
|
||||
'conditions': [
|
||||
['OS=="mac"', {
|
||||
'xcode_settings': {
|
||||
'WARNING_CFLAGS': [
|
||||
'-Wno-inconsistent-missing-override',
|
||||
'-Wno-unknown-warning-option',
|
||||
],
|
||||
},
|
||||
}],
|
||||
['OS=="linux" or OS=="android"', {
|
||||
'cflags': [
|
||||
'-Wno-inconsistent-missing-override',
|
||||
'-Wno-unknown-warning-option',
|
||||
],
|
||||
}],
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user