summaryrefslogtreecommitdiffstats
path: root/googletest/test/BUILD.bazel
diff options
context:
space:
mode:
authorDerek Mauro <dmauro@google.com>2018-07-10 18:30:42 (GMT)
committerDerek Mauro <dmauro@google.com>2018-07-10 18:30:42 (GMT)
commit4c417877648f5f240aecead1c19d7c1fd340423b (patch)
tree845c821bd6bc6015f82cb10f911158a2c6a92a16 /googletest/test/BUILD.bazel
parentba96d0b1161f540656efdaed035b3c062b60e006 (diff)
downloadgoogletest-4c417877648f5f240aecead1c19d7c1fd340423b.zip
googletest-4c417877648f5f240aecead1c19d7c1fd340423b.tar.gz
googletest-4c417877648f5f240aecead1c19d7c1fd340423b.tar.bz2
Adds stacktrace support from Abseil to Google Test
This change adds the ability to generate stacktraces in Google Test on both failures of assertions/expectations and on crashes. The stacktrace support is conditionally available only when using Abseil with Google Test. To use this support, run the test under Bazel with a command like this: bazel test --define absl=1 --test_env=GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1 //path/to/your:test The "--define absl=1" part enables stacktraces on assertion/expectation failures. The "--test_env=GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" part enables the signal handler that logs a stacktrace in the event of a crash (this also requires the "--define absl=1" part). This is not the default since it may interfere with existing tests.
Diffstat (limited to 'googletest/test/BUILD.bazel')
-rw-r--r--googletest/test/BUILD.bazel62
1 files changed, 42 insertions, 20 deletions
diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel
index 365a855..405feee 100644
--- a/googletest/test/BUILD.bazel
+++ b/googletest/test/BUILD.bazel
@@ -34,35 +34,48 @@
licenses(["notice"])
-""" gtest own tests """
+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 and gtest-tuple_test.cc
cc_test(
name = "gtest_all_test",
size = "small",
- srcs = glob(
- include = [
- "gtest-*.cc",
- "*.h",
- "googletest/include/gtest/**/*.h",
- ],
- exclude = [
- "gtest-unittest-api_test.cc",
- "gtest-tuple_test.cc",
- "googletest/src/gtest-all.cc",
- "gtest_all_test.cc",
- "gtest-death-test_ex_test.cc",
- "gtest-listener_test.cc",
- "gtest-unittest-api_test.cc",
- "gtest-param-test_test.cc",
- ],
- ) + select({
+ srcs = glob(
+ include = [
+ "gtest-*.cc",
+ "*.h",
+ "googletest/include/gtest/**/*.h",
+ ],
+ exclude = [
+ "gtest-unittest-api_test.cc",
+ "gtest-tuple_test.cc",
+ "googletest/src/gtest-all.cc",
+ "gtest_all_test.cc",
+ "gtest-death-test_ex_test.cc",
+ "gtest-listener_test.cc",
+ "gtest-unittest-api_test.cc",
+ "gtest-param-test_test.cc",
+ ],
+ ) + select({
"//:windows": [],
"//:windows_msvc": [],
"//conditions:default": [
"gtest-tuple_test.cc",
],
- }),
+ }),
copts = select({
"//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
"//:windows_msvc": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
@@ -135,7 +148,6 @@ py_library(
name = "gtest_test_utils",
testonly = 1,
srcs = ["gtest_test_utils.py"],
-
)
cc_binary(
@@ -144,6 +156,7 @@ cc_binary(
srcs = ["gtest_help_test_.cc"],
deps = ["//:gtest_main"],
)
+
py_test(
name = "gtest_help_test",
size = "small",
@@ -163,6 +176,10 @@ py_test(
name = "gtest_output_test",
size = "small",
srcs = ["gtest_output_test.py"],
+ args = select({
+ ":has_absl": [],
+ "//conditions:default": ["--no_stacktrace_support"],
+ }),
data = [
"gtest_output_test_golden_lin.txt",
":gtest_output_test_",
@@ -176,6 +193,7 @@ cc_binary(
srcs = ["gtest_color_test_.cc"],
deps = ["//:gtest"],
)
+
py_test(
name = "gtest_color_test",
size = "small",
@@ -327,6 +345,10 @@ py_test(
"gtest_xml_output_unittest.py",
"gtest_xml_test_utils.py",
],
+ args = select({
+ ":has_absl": [],
+ "//conditions:default": ["--no_stacktrace_support"],
+ }),
data = [
# We invoke gtest_no_test_unittest to verify the XML output
# when the test program contains no test definition.