问题描述:

I use GTEST with GCC on Linux. I want to see stacktrace printed on test fail (be it assert or signal based crash). It can be done manually, yet I wonder if it can be set as GTEST build/run option (without more than one line modifications to my codebase)?

网友答案:

There is not "fully" documented option: --gtest_stack_trace_depth=10 (10 is just example value).

It must be used with --gmock_verbose=info

And yes - it works for failing EXPECT_CALL - in gmock only.

For asserts (like ASSERT_EQ) it has less sence - since ASSERT is just where it is - its tack trace is empty (meaning does not contain any of non-gtest/UT code).

An example:

some_test --gmock_verbose=info --gtest_stack_trace_depth=10


If you believe it shall work also for ASSERT* - you might raise an issue here: https://github.com/google/googletest/issues

相关阅读:
Top