From 6dfd7a9629c79fed31658a16d99b2ecc6156f057 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 18 Oct 2024 19:17:53 +0200 Subject: [PATCH] CI: Catch test crashes with gdb wrapper Add a gdb script to catch segfaults and launch it using meson --wrapper And try really hard to make that script safe for Windows/msys, because we want to use it there. --- .gitlab-ci/gdb-wrapper.gdb | 28 ++++++++++++++++++++++++++++ .gitlab-ci/run-tests.sh | 1 + .gitlab-ci/test-msys2.sh | 1 + 3 files changed, 30 insertions(+) create mode 100644 .gitlab-ci/gdb-wrapper.gdb diff --git a/.gitlab-ci/gdb-wrapper.gdb b/.gitlab-ci/gdb-wrapper.gdb new file mode 100644 index 0000000000..d9795d0b67 --- /dev/null +++ b/.gitlab-ci/gdb-wrapper.gdb @@ -0,0 +1,28 @@ +set charset UTF-8 +set logging redirect on +set logging debugredirect on +set logging enabled on +set schedule-multiple on +set detach-on-fork off + +catch signal +commands + set logging enabled off + py print ("# " + gdb.execute ("thread apply all bt full", True, True).replace ("\n", "\n# ")) + set logging enabled on + c +end + +catch signal SIGTRAP +commands + set logging enabled off + py print ("# " + gdb.execute ("thread apply all bt full", True, True).replace ("\n", "\n# ")) + set logging enabled on + q 1 +end + +r +if $_isvoid($_exitcode) + q $_exitsignal +else + q $_exitcode diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh index 1a202859a9..bb96f50e05 100755 --- a/.gitlab-ci/run-tests.sh +++ b/.gitlab-ci/run-tests.sh @@ -94,6 +94,7 @@ case "${setup}" in --timeout-multiplier "${multiplier}" \ --num-processes "${n_processes}" \ --maxfail "${max_fail}" \ + --wrapper "gdb -batch -x ..\.gitlab-ci\gdb-wrapper.gdb --args" \ --print-errorlogs \ --setup=${setup} \ --suite=${suite//,/ --suite=} \ diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh index 2ef4605fc3..776f5d256f 100644 --- a/.gitlab-ci/test-msys2.sh +++ b/.gitlab-ci/test-msys2.sh @@ -17,6 +17,7 @@ pacman --noconfirm -S --needed \ ${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme \ ${MINGW_PACKAGE_PREFIX}-atk \ ${MINGW_PACKAGE_PREFIX}-cairo \ + ${MINGW_PACKAGE_PREFIX}-gdb \ ${MINGW_PACKAGE_PREFIX}-gdk-pixbuf2 \ ${MINGW_PACKAGE_PREFIX}-glib2 \ ${MINGW_PACKAGE_PREFIX}-graphene \