如何从通过ctest运行的单元测试中生成核心转储文件



我遇到了一个单元测试因seg错误而随机失败的问题,我不知道如何从这些测试中生成核心转储。

我使用cmake和ctest3.21.1来运行这些测试,并且这些测试是使用gtest框架编写的。

我不认为这是我的系统环境的问题,我可以制作一个小的c++程序来分段并生成核心转储。问题是从使用ctest运行的测试生成核心转储。

如果GTest是底层测试框架,那么有一个GTest命令行选项对windows有帮助:MyTest.exe --gtest_catch_exceptions=0

注意:这并不能回答有关CTest的问题。我还没有找到类似的CTest选项。

GTest:的帮助信息

Assertion Behavior:
--gtest_break_on_failure
Turn assertion failures into debugger break-points.
--gtest_throw_on_failure
Turn assertion failures into C++ exceptions for use by an external
test framework.
--gtest_catch_exceptions=0
Do not report exceptions as test failures. Instead, allow them
to crash the program or throw a pop-up (on Windows).

最新更新