c++cmakeros2colcon

Run colcon test with GDB backtrack


I would like to use the colcon test functionality to test multiple colcon packages at once by executing the following command from the terminal.

colcon test --event-handlers console_direct+ --return-code-on-test-failure --packages-select package1 package2 ...

Is it possible to run those tests in GDB backtrace mode? What would i need to add to the command to achieve that?


Solution

  • Because colcon invokes ctest, and ctest doesn't (yet) support this, I recommend manually running the failing test manually under gdb. Make sure to build with debug mode so you have debug symbols available to gdb. For example, here is how I debug this PR:

    colcon build --packages-up-to nav2_util --mixin debug
    gdb -ex run ./build/nav2_util/test/test_twist_publisher
    

    If you are getting timeout errors in the test, then hit ctrl+c while the test is blocking, and then you can use the bt command to figure out where the test is blocked.

    I created a docs update here:

    References: