Search code examples
c++dockercoredumpctest

How to get core dump file in docker while running ctest?


I try to run my tests in parallel using ctest in docker environment.This is the command that I execute;

ctest -R MyTest -j 10 -VV --stop-on-failure --output-on-failure --repeat-until-fail 1000

While running the tests, I get a segfault sporadically.

Test #1463: MyTest.case1...***Exception: SegFault  0.15 sec

What I want to do is basically to understand what is going wrong. In that regard, I would like to get a core dump file. But apparently, there is no core dump file generated in docker environment.

My question is if there is a way to know what causes the problem by giving a ctest argument or whether a core dump file is generated in case of any test failure due to segfault in ctest.

Thanks in advance.


Solution

  • Fortunately, I found gtest-parallel library in order to able to run my tests in parallel and to get a core dump file. It has limited options, though. Nevertheless, helps me to get what goes wrong. Btw, this is how I run my tests using this library.

    ./gtest-parallel MyTests --gtest_filter=Fixture1.* --output_dir . --repeat=100 --workers=10
    

    Once this command is executed; if there is any segfaulted test, it creates a file called core which contains core dump regarding this test. Hope this helps people who might have the same issue.