Skip to content

Commit 72fb291

Browse files
authored
Merge pull request #183 from NFFT/feature/collect-core-dumps
Feature/collect core dumps
2 parents 234aead + 246dcf1 commit 72fb291

File tree

2 files changed

+56
-3
lines changed

2 files changed

+56
-3
lines changed

.github/workflows/build-linux.yml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ jobs:
6767
steps:
6868
- uses: actions/checkout@v5
6969

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+
7079
- name: Disable initramfs update
7180
run: sudo sed -i 's/yes/no/g' /etc/initramfs-tools/update-initramfs.conf
7281

@@ -194,13 +203,13 @@ jobs:
194203
run: make check
195204

196205
- name: Run tests again to reproduce failure
197-
if: steps.test.outcome == 'failure'
206+
if: failure() && steps.test.conclusion == 'failure'
198207
run: |
199208
tests/checkall > checkall.log
200209
if [ "${{ matrix.openmp }}" = "1" ]; then tests/checkall_threads > checkall_threads.log; fi
201210
202211
- name: Upload test failure logs
203-
if: steps.test.outcome == 'failure'
212+
if: failure() && steps.test.conclusion == 'failure'
204213
uses: actions/upload-artifact@v5
205214
with:
206215
name: test-failure-logs-${{ env.BUILD_CONFIG }}
@@ -241,6 +250,50 @@ jobs:
241250
cd ../..
242251
done
243252
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+
244297
- name: Publish Test Report
245298
uses: ctrf-io/github-test-reporter@v1
246299
with:

tests/nfft.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static R err_trafo(X(plan) *p)
234234
b = K(50.0);
235235
#elif MANT_DIG == 64
236236
// Intel double extended, 80 bits.
237-
a = K(0.8);
237+
a = K(0.815);
238238
b = K(50.0);
239239
#elif MANT_DIG == 53
240240
// IEEE 754 double precision, 64 bits.

0 commit comments

Comments
 (0)