blob: 281376818a3e5cbef8b6fceea033f4cf77f516b9 [file] [log] [blame]
# Copyright 2017 The Crashpad Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../build/crashpad_buildconfig.gni")
import("../../build/test.gni")
if (crashpad_is_in_chromium) {
group("gtest") {
testonly = true
public_deps = [
"//testing/gtest",
]
}
group("gmock") {
testonly = true
public_deps = [
"//testing/gmock",
]
}
} else if (crashpad_is_in_dart || crashpad_is_in_fuchsia) {
group("gtest") {
testonly = true
public_deps = [
"//third_party/googletest:gtest",
]
public_configs = [ "../..:disable_ubsan" ]
}
group("gmock") {
testonly = true
public_deps = [
"//third_party/googletest:gmock",
]
}
} else if (crashpad_is_standalone) {
config("gtest_private_config") {
visibility = [ ":*" ]
include_dirs = [ "gtest/googletest" ]
defines = [ "GUNIT_NO_GOOGLE3=1" ]
}
config("gtest_public_config") {
include_dirs = [ "gtest/googletest/include" ]
}
static_library("gtest") {
testonly = true
sources = [
"gtest/googletest/include/gtest/gtest-death-test.h",
"gtest/googletest/include/gtest/gtest-matchers.h",
"gtest/googletest/include/gtest/gtest-message.h",
"gtest/googletest/include/gtest/gtest-param-test.h",
"gtest/googletest/include/gtest/gtest-printers.h",
"gtest/googletest/include/gtest/gtest-spi.h",
"gtest/googletest/include/gtest/gtest-test-part.h",
"gtest/googletest/include/gtest/gtest-typed-test.h",
"gtest/googletest/include/gtest/gtest.h",
"gtest/googletest/include/gtest/gtest_pred_impl.h",
"gtest/googletest/include/gtest/gtest_prod.h",
"gtest/googletest/include/gtest/internal/custom/gtest-port.h",
"gtest/googletest/include/gtest/internal/custom/gtest-printers.h",
"gtest/googletest/include/gtest/internal/custom/gtest.h",
"gtest/googletest/include/gtest/internal/gtest-death-test-internal.h",
"gtest/googletest/include/gtest/internal/gtest-filepath.h",
"gtest/googletest/include/gtest/internal/gtest-internal.h",
"gtest/googletest/include/gtest/internal/gtest-param-util.h",
"gtest/googletest/include/gtest/internal/gtest-port-arch.h",
"gtest/googletest/include/gtest/internal/gtest-port.h",
"gtest/googletest/include/gtest/internal/gtest-string.h",
"gtest/googletest/include/gtest/internal/gtest-type-util.h",
"gtest/googletest/src/gtest-all.cc",
"gtest/googletest/src/gtest-death-test.cc",
"gtest/googletest/src/gtest-filepath.cc",
"gtest/googletest/src/gtest-internal-inl.h",
"gtest/googletest/src/gtest-matchers.cc",
"gtest/googletest/src/gtest-port.cc",
"gtest/googletest/src/gtest-printers.cc",
"gtest/googletest/src/gtest-test-part.cc",
"gtest/googletest/src/gtest-typed-test.cc",
"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" ]
if (crashpad_is_fuchsia) {
deps = [
"../fuchsia",
]
}
}
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/googletest-death-test-test.cc",
"gtest/googletest/test/googletest-filepath-test.cc",
"gtest/googletest/test/googletest-message-test.cc",
"gtest/googletest/test/googletest-options-test.cc",
"gtest/googletest/test/googletest-port-test.cc",
"gtest/googletest/test/googletest-printers-test.cc",
"gtest/googletest/test/googletest-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_skip_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",
]
if (crashpad_is_win) {
cflags = [ "/wd4702" ] # unreachable code
}
}
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/googletest-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/googletest-param-test-test.cc",
"gtest/googletest/test/googletest-param-test-test.h",
"gtest/googletest/test/googletest-param-test2-test.cc",
]
configs -= [
"//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors",
]
configs += [ ":gtest_private_config" ]
deps = [
":gtest",
]
if (crashpad_is_clang) {
cflags_cc = [
# For gtest/googlemock/test/gmock-matchers_test.cc’s
# Unstreamable::value_.
"-Wno-unused-private-field",
]
}
}
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") {
visibility = [ ":*" ]
include_dirs = [ "gtest/googlemock" ]
}
config("gmock_public_config") {
include_dirs = [ "gtest/googlemock/include" ]
if (crashpad_is_clang) {
cflags_cc = [
# 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
# until https://github.com/google/googletest/issues/533 is fixed.
"-Wno-inconsistent-missing-override",
]
}
}
static_library("gmock") {
testonly = true
sources = [
"gtest/googlemock/include/gmock/gmock-actions.h",
"gtest/googlemock/include/gmock/gmock-cardinalities.h",
"gtest/googlemock/include/gmock/gmock-function-mocker.h",
"gtest/googlemock/include/gmock/gmock-generated-actions.h",
"gtest/googlemock/include/gmock/gmock-generated-function-mockers.h",
"gtest/googlemock/include/gmock/gmock-generated-matchers.h",
"gtest/googlemock/include/gmock/gmock-matchers.h",
"gtest/googlemock/include/gmock/gmock-more-actions.h",
"gtest/googlemock/include/gmock/gmock-more-matchers.h",
"gtest/googlemock/include/gmock/gmock-nice-strict.h",
"gtest/googlemock/include/gmock/gmock-spec-builders.h",
"gtest/googlemock/include/gmock/gmock.h",
"gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h",
"gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h",
"gtest/googlemock/include/gmock/internal/custom/gmock-port.h",
"gtest/googlemock/include/gmock/internal/gmock-internal-utils.h",
"gtest/googlemock/include/gmock/internal/gmock-port.h",
"gtest/googlemock/include/gmock/internal/gmock-pp.h",
"gtest/googlemock/src/gmock-all.cc",
"gtest/googlemock/src/gmock-cardinalities.cc",
"gtest/googlemock/src/gmock-internal-utils.cc",
"gtest/googlemock/src/gmock-matchers.cc",
"gtest/googlemock/src/gmock-spec-builders.cc",
"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",
]
}
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",
]
deps = [
":gmock",
":gtest",
]
}
test("gmock_all_test") {
sources = [
"gtest/googlemock/test/gmock-actions_test.cc",
"gtest/googlemock/test/gmock-cardinalities_test.cc",
"gtest/googlemock/test/gmock-function-mocker_test.cc",
"gtest/googlemock/test/gmock-generated-actions_test.cc",
"gtest/googlemock/test/gmock-generated-function-mockers_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-pp-string_test.cc",
"gtest/googlemock/test/gmock-pp_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",
]
if (crashpad_is_clang) {
cflags_cc = [
# For gtest/googlemock/test/gmock-matchers_test.cc’s
# testing::gmock_matchers_test::Unprintable::c_.
"-Wno-unused-private-field",
]
}
}
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",
]
}
}