'Is it a way to prevent gtest (C++) from catching exceptions and segmentation faults? [duplicate]

Looks like Google Test (gtest) framework for C++ somehow catches all failed assertions, exceptions and segmentation faults. The test is marked as failed but the test suite itself recovers and runs the tests that follow after.

This looks kind of cool, just that the diagnostic output that the gtest framework prints to console is very limited. CLion IDE would provide much more information, including the full stack trace and variables. Is it an easy way to turn the gtest "crash recovery" mechanism off?



Solution 1:[1]

You can run your test binary with the option --gtest_catch_exceptions=0. This will cause the test to crash on exception

Do not report exceptions as test failures. Instead, allow them to crash the program or throw a pop-up (on Windows).

Alternatively you can set this environmental var GTEST_CATCH_EXCEPTIONS to 0;

These features are mentioned in gtest docs

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1