#!/bin/bash cd build/$CMAKE_PRESET ctest --output-on-failure CTEST_EXIT_CODE=$? # If the program fails, show the backtracs if [ $CTEST_EXIT_CODE -ne '0' ]; then gdb -ex run -ex bt --args ctest --output-on-failure fi # Forward exit code exit $CTEST_EXIT_CODE