if any coredump is found, it is passed to gdb with
'thread apply all bt full'
---
 .github/workflows/vtest.yml | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/vtest.yml b/.github/workflows/vtest.yml
index 8c461385f..a704c92dc 100644
--- a/.github/workflows/vtest.yml
+++ b/.github/workflows/vtest.yml
@@ -49,6 +49,13 @@ jobs:
     - uses: actions/checkout@v4
       with:
         fetch-depth: 100
+
+    - name: Setup coredumps
+      if: ${{ startsWith(matrix.os, 'ubuntu-') }}
+      run: |
+        sudo sysctl -w fs.suid_dumpable=1
+        sudo sysctl kernel.core_pattern=/tmp/core.%h.%e.%t
+
 #
 # Github Action cache key cannot contain comma, so we calculate it based on 
job name
 #
@@ -92,7 +99,8 @@ jobs:
           libpcre2-dev \
           libsystemd-dev \
           ninja-build \
-          socat
+          socat \
+          gdb
     - name: Install brew dependencies
       if: ${{ startsWith(matrix.os, 'macos-') }}
       run: |
@@ -150,6 +158,7 @@ jobs:
         # This is required for macOS which does not actually allow to increase
         # the '-n' soft limit to the hard limit, thus failing to run.
         ulimit -n 65536
+        ulimit -c unlimited
         make reg-tests HAPROXY_ARGS="-dI" VTEST_PROGRAM=../vtest/vtest 
REGTESTS_TYPES=default,bug,devel
     - name: Config syntax check memleak smoke testing
       if: ${{ contains(matrix.name, 'ASAN') }}
@@ -175,3 +184,18 @@ jobs:
           echo "::endgroup::"
         done
         exit 1
+
+    - name: Show coredumps
+      if: ${{ failure() && steps.vtest.outcome == 'failure' }}
+      run: |
+        failed=false
+        shopt -s nullglob
+        for file in /tmp/core.*; do
+          failed=true
+          printf "::group::"
+          gdb -ex 'thread apply all bt full' ./haproxy $file
+          echo "::endgroup::"
+        done
+        if [ "$failed" = true ]; then
+          exit 1;
+        fi
-- 
2.44.0


Reply via email to