Skip to content

Commit f70919e

Browse files
committed
debug: add gdb backtrace on segfault for embed tests
1 parent cf07741 commit f70919e

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,24 @@ jobs:
225225
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/bin/llvm-config" >> $GITHUB_ENV
226226
227227
- name: Test with embed feature
228-
run: cargo test --workspace --release --features closure,embed,anyhow --no-fail-fast
228+
run: |
229+
sudo apt-get update && sudo apt-get install -y gdb
230+
sudo sysctl -w kernel.core_pattern='core.%e.%p'
231+
ulimit -c unlimited
232+
echo "Core pattern: $(cat /proc/sys/kernel/core_pattern)"
233+
echo "Ulimit -c: $(ulimit -c)"
234+
cargo test --workspace --release --features closure,embed,anyhow --no-fail-fast || \
235+
(echo "Test failed, looking for core dumps..."; ls -la core.* 2>/dev/null || echo "No core files found"; \
236+
for core in core.*; do \
237+
if [ -f "$core" ]; then \
238+
echo "Found core: $core"; \
239+
exe=$(find target/release/deps -type f -executable -name "sapi_tests-*" ! -name "*.d" | head -1); \
240+
if [ -n "$exe" ]; then \
241+
echo "Using executable: $exe"; \
242+
gdb -batch -ex "thread apply all bt" "$exe" "$core"; \
243+
fi; \
244+
fi; \
245+
done; exit 1)
229246
230247
build-musl:
231248
name: musl / ${{ matrix.php }} / ${{ matrix.phpts[1] }}
@@ -239,7 +256,7 @@ jobs:
239256
steps:
240257
- name: Checkout code
241258
uses: actions/checkout@v5
242-
- name: Setup DockerX
259+
- name: Setup DockerX
243260
uses: docker/setup-buildx-action@v3
244261
- name: Build
245262
uses: docker/build-push-action@v6
@@ -267,4 +284,4 @@ jobs:
267284
-v $(pwd):/workspace \
268285
-w /workspace \
269286
extphprs/ext-php-rs:musl-${{ matrix.php }}-${{ matrix.phpts[1] }} \
270-
test --workspace --release --features closure,anyhow,runtime --no-fail-fast
287+
test --workspace --release --features closure,anyhow,runtime --no-fail-fast

0 commit comments

Comments
 (0)