This prevents warning D9025 (one command-line option overrides
another) on MSVC builds: some test targets are built with
the /EHs-c- which conflicts with /EHsc.
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.
Because in `std::tr1::tuple_element` the first template parameter should be of type int (https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/a00547.html), but the code inserts a size_t, the first template parameter should be casted to int before, to get rid of the following errors:
googletest-src/googletest/include/gtest/gtest-printers.h:957:60: error: conversion from ‘long unsigned int’ to ‘int’ may change value [-Werror=conversion]
struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};
and
googletest-src/googletest/include/gtest/gtest-printers.h:961:56: error: conversion from ‘long unsigned int’ to ‘int’ may change value [-Werror=conversion]
const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
non-ASCII charactors are interpreted as Shift-JIS on the environment.
But the charators in the files are non Shift-JIS charactors and the compiler
stops compiling with C4819.
To fix the errors, remove non-ASCII charactors.
GTEST_TEST_FILTER_ENV_VAR_ was used to specify an environment variable to obtain
the default test filter from. By default it was unset which broke
"--test_filter" for bazel. This CL eliminates GTEST_TEST_FILTER_ENV_VAR_ and
explicitly obtains the default test filter from the environment variable
TESTBRIDGE_TEST_ONLY if it exists.