Googletest export
Improve Bazel build files. New target gtest_prod allows access to the FRIEND_TEST macro without depending on the entirety of GTest in production executables. Additionally, duplicate config_setting rules were removed and formatting was adjusted. PiperOrigin-RevId: 220279205
This commit is contained in:
@@ -34,21 +34,6 @@
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
config_setting(
|
||||
name = "windows",
|
||||
values = {"cpu": "x64_windows"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "windows_msvc",
|
||||
values = {"cpu": "x64_windows_msvc"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "has_absl",
|
||||
values = {"define": "absl=1"},
|
||||
)
|
||||
|
||||
#on windows exclude gtest-tuple.h
|
||||
cc_test(
|
||||
name = "gtest_all_test",
|
||||
@@ -73,26 +58,23 @@ cc_test(
|
||||
"googletest-env-var-test_.cc",
|
||||
"googletest-filter-unittest_.cc",
|
||||
"googletest-break-on-failure-unittest_.cc",
|
||||
"googletest-listener-test.cc",
|
||||
"googletest-output-test_.cc",
|
||||
"googletest-list-tests-unittest_.cc",
|
||||
"googletest-shuffle-test_.cc",
|
||||
"googletest-uninitialized-test_.cc",
|
||||
"googletest-death-test_ex_test.cc",
|
||||
"googletest-param-test-test",
|
||||
"googletest-throw-on-failure-test_.cc",
|
||||
"googletest-param-test-invalid-name1-test_.cc",
|
||||
"googletest-param-test-invalid-name2-test_.cc",
|
||||
|
||||
"googletest-listener-test.cc",
|
||||
"googletest-output-test_.cc",
|
||||
"googletest-list-tests-unittest_.cc",
|
||||
"googletest-shuffle-test_.cc",
|
||||
"googletest-uninitialized-test_.cc",
|
||||
"googletest-death-test_ex_test.cc",
|
||||
"googletest-param-test-test",
|
||||
"googletest-throw-on-failure-test_.cc",
|
||||
"googletest-param-test-invalid-name1-test_.cc",
|
||||
"googletest-param-test-invalid-name2-test_.cc",
|
||||
],
|
||||
) + select({
|
||||
"//:windows": [],
|
||||
"//:windows_msvc": [],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = select({
|
||||
"//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
|
||||
"//:windows_msvc": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
|
||||
"//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"],
|
||||
}),
|
||||
includes = [
|
||||
@@ -103,15 +85,11 @@ cc_test(
|
||||
],
|
||||
linkopts = select({
|
||||
"//:windows": [],
|
||||
"//:windows_msvc": [],
|
||||
"//conditions:default": [
|
||||
"-pthread",
|
||||
],
|
||||
"//conditions:default": ["-pthread"],
|
||||
}),
|
||||
deps = ["//:gtest_main"],
|
||||
)
|
||||
|
||||
|
||||
# Tests death tests.
|
||||
cc_test(
|
||||
name = "googletest-death-test-test",
|
||||
@@ -196,13 +174,12 @@ cc_binary(
|
||||
deps = ["//:gtest"],
|
||||
)
|
||||
|
||||
|
||||
py_test(
|
||||
name = "googletest-output-test",
|
||||
size = "small",
|
||||
srcs = ["googletest-output-test.py"],
|
||||
args = select({
|
||||
":has_absl": [],
|
||||
"//:has_absl": [],
|
||||
"//conditions:default": ["--no_stacktrace_support"],
|
||||
}),
|
||||
data = [
|
||||
@@ -257,7 +234,6 @@ py_test(
|
||||
deps = [":gtest_test_utils"],
|
||||
)
|
||||
|
||||
|
||||
cc_binary(
|
||||
name = "googletest-break-on-failure-unittest_",
|
||||
testonly = 1,
|
||||
@@ -265,8 +241,6 @@ cc_binary(
|
||||
deps = ["//:gtest"],
|
||||
)
|
||||
|
||||
|
||||
|
||||
py_test(
|
||||
name = "googletest-break-on-failure-unittest",
|
||||
size = "small",
|
||||
@@ -275,7 +249,6 @@ py_test(
|
||||
deps = [":gtest_test_utils"],
|
||||
)
|
||||
|
||||
|
||||
cc_test(
|
||||
name = "gtest_assert_by_exception_test",
|
||||
size = "small",
|
||||
@@ -283,8 +256,6 @@ cc_test(
|
||||
deps = ["//:gtest"],
|
||||
)
|
||||
|
||||
|
||||
|
||||
cc_binary(
|
||||
name = "googletest-throw-on-failure-test_",
|
||||
testonly = 1,
|
||||
@@ -300,7 +271,6 @@ py_test(
|
||||
deps = [":gtest_test_utils"],
|
||||
)
|
||||
|
||||
|
||||
cc_binary(
|
||||
name = "googletest-list-tests-unittest_",
|
||||
testonly = 1,
|
||||
@@ -378,7 +348,7 @@ py_test(
|
||||
"gtest_xml_test_utils.py",
|
||||
],
|
||||
args = select({
|
||||
":has_absl": [],
|
||||
"//:has_absl": [],
|
||||
"//conditions:default": ["--no_stacktrace_support"],
|
||||
}),
|
||||
data = [
|
||||
@@ -449,7 +419,6 @@ py_test(
|
||||
deps = [":gtest_test_utils"],
|
||||
)
|
||||
|
||||
|
||||
py_test(
|
||||
name = "googletest-json-outfiles-test",
|
||||
size = "small",
|
||||
@@ -471,18 +440,19 @@ py_test(
|
||||
"googletest-json-output-unittest.py",
|
||||
"gtest_json_test_utils.py",
|
||||
],
|
||||
args = select({
|
||||
"//:has_absl": [],
|
||||
"//conditions:default": ["--no_stacktrace_support"],
|
||||
}),
|
||||
data = [
|
||||
# We invoke gtest_no_test_unittest to verify the JSON output
|
||||
# when the test program contains no test definition.
|
||||
":gtest_no_test_unittest",
|
||||
":gtest_xml_output_unittest_",
|
||||
],
|
||||
args = select({
|
||||
":has_absl": [],
|
||||
"//conditions:default": ["--no_stacktrace_support"],
|
||||
}),
|
||||
deps = [":gtest_test_utils"],
|
||||
)
|
||||
|
||||
# Verifies interaction of death tests and exceptions.
|
||||
cc_test(
|
||||
name = "googletest-death-test_ex_catch_test",
|
||||
|
||||
Reference in New Issue
Block a user