|
67 | 67 | steps: |
68 | 68 | - uses: actions/checkout@v5 |
69 | 69 |
|
| 70 | + - name: Enable core dumps |
| 71 | + run: | |
| 72 | + ulimit -c unlimited |
| 73 | + sudo mkdir /cores |
| 74 | + sudo chmod 777 /cores |
| 75 | + # Core filenames will be of the form executable.pid.timestamp: |
| 76 | + sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern' |
| 77 | + echo "Core dumps will be written to: /cores" |
| 78 | +
|
70 | 79 | - name: Disable initramfs update |
71 | 80 | run: sudo sed -i 's/yes/no/g' /etc/initramfs-tools/update-initramfs.conf |
72 | 81 |
|
@@ -194,13 +203,13 @@ jobs: |
194 | 203 | run: make check |
195 | 204 |
|
196 | 205 | - name: Run tests again to reproduce failure |
197 | | - if: steps.test.outcome == 'failure' |
| 206 | + if: failure() && steps.test.conclusion == 'failure' |
198 | 207 | run: | |
199 | 208 | tests/checkall > checkall.log |
200 | 209 | if [ "${{ matrix.openmp }}" = "1" ]; then tests/checkall_threads > checkall_threads.log; fi |
201 | 210 |
|
202 | 211 | - name: Upload test failure logs |
203 | | - if: steps.test.outcome == 'failure' |
| 212 | + if: failure() && steps.test.conclusion == 'failure' |
204 | 213 | uses: actions/upload-artifact@v5 |
205 | 214 | with: |
206 | 215 | name: test-failure-logs-${{ env.BUILD_CONFIG }} |
@@ -241,6 +250,50 @@ jobs: |
241 | 250 | cd ../.. |
242 | 251 | done |
243 | 252 |
|
| 253 | + - name: Collect core dumps and binaries |
| 254 | + if: failure() |
| 255 | + run: | |
| 256 | + # Extract binary paths from core dumps and copy them |
| 257 | + for corefile in /cores/*.*.*; do |
| 258 | + if [ -f "$corefile" ]; then |
| 259 | + echo "Processing $corefile" |
| 260 | + |
| 261 | + # Get the binary path from the core dump |
| 262 | + binary=$(file "$corefile" | grep -oP "from '[^']*'" | cut -d"'" -f2) |
| 263 | + |
| 264 | + # Alternative method using gdb (more reliable) |
| 265 | + if command -v gdb &> /dev/null; then |
| 266 | + binary=$(gdb -quiet -batch -c "$corefile" 2>/dev/null | grep "Core was generated by" | sed "s/Core was generated by \`\(.*\)'.*/\1/" | awk '{print $1}') |
| 267 | + fi |
| 268 | + |
| 269 | + echo "Binary: $binary" |
| 270 | + |
| 271 | + # Copy the binary if it exists |
| 272 | + if [ -n "$binary" ] && [ -f "$binary" ]; then |
| 273 | + cp "$binary" /cores/ |
| 274 | + echo "Copied binary: $binary" |
| 275 | + |
| 276 | + # Also copy any shared libraries if needed |
| 277 | + ldd "$binary" 2>/dev/null | grep "=>" | awk '{print $3}' | while read lib; do |
| 278 | + if [ -f "$lib" ]; then |
| 279 | + cp --parents "$lib" /cores/ 2>/dev/null || true |
| 280 | + fi |
| 281 | + done |
| 282 | + fi |
| 283 | + fi |
| 284 | + done |
| 285 | + |
| 286 | + ls -lah /cores/ |
| 287 | +
|
| 288 | + - name: Upload core dumps |
| 289 | + if: failure() |
| 290 | + uses: actions/upload-artifact@v4 |
| 291 | + with: |
| 292 | + name: coredumps-${{ github.run_id }} |
| 293 | + path: /cores/ |
| 294 | + if-no-files-found: warn |
| 295 | + retention-days: 7 |
| 296 | + |
244 | 297 | - name: Publish Test Report |
245 | 298 | uses: ctrf-io/github-test-reporter@v1 |
246 | 299 | with: |
|
0 commit comments