Skip to content

Commit

Permalink
Save associated binary for core dump (awslabs#896)
Browse files Browse the repository at this point in the history
* Save associated binary for core dump

To be able to analyze the core dump we also need
the binary it was generated from. This adds a new
script for uploading the binary associated with the
core dump when tests are failing in the CI.

Signed-off-by: Monthon Klongklaew <monthonk@amazon.com>

* Update core dump pattern

Signed-off-by: Monthon Klongklaew <monthonk@amazon.com>

---------

Signed-off-by: Monthon Klongklaew <monthonk@amazon.com>
  • Loading branch information
monthonk authored May 31, 2024
1 parent 036ed3b commit 4525331
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/actions/scripts/save-coredump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

bucket_name=$S3_BUCKET_NAME
bucket_prefix=$S3_BUCKET_TEST_PREFIX
coredump_path=/var/lib/systemd/coredump/
coredump_pattern=core.*

# upload core dump files to S3
aws s3 cp ${coredump_path} s3://${bucket_name}/${bucket_prefix}coredump/ --recursive --exclude "*" --include "${coredump_pattern}"

# get all core dump records to find their associated binary files
coredump_records=`coredumpctl --no-legend | awk '{print $5,$10}'`

while IFS= read -r line; do
# get the pid to help matching it with the core dump
pid=`echo $line | awk '{print $1}'`
binary_path=`echo $line | awk '{print $2}'`
binary_name=$(basename $binary_path)
# upload each binary to S3
aws s3 cp ${binary_path} s3://${bucket_name}/${bucket_prefix}binary/${pid}_${binary_name}
done <<< "$coredump_records"
6 changes: 3 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
run: cargo test --features $RUST_FEATURES
- name: Save dump files
if: ${{ failure() && matrix.runner.name == 'Amazon Linux arm' }}
run: aws s3 cp /var/lib/systemd/coredump/ s3://${{ env.S3_BUCKET_NAME }}/${{ env.S3_BUCKET_TEST_PREFIX }}coredump/ --recursive --exclude "*" --include "core.mountpoint_s3*"
run: ./.github/actions/scripts/save-coredump.sh

s3express-test:
name: S3 Express One Zone tests (${{ matrix.runner.name }}, FUSE ${{ matrix.fuseVersion }})
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
run: cargo test --features '${{ env.RUST_FEATURES }},s3express_tests'
- name: Save dump files
if: ${{ failure() && matrix.runner.name == 'Amazon Linux arm' }}
run: aws s3 cp /var/lib/systemd/coredump/ s3://${{ env.S3_EXPRESS_ONE_ZONE_BUCKET_NAME }}/${{ env.S3_BUCKET_TEST_PREFIX }}coredump/ --recursive --exclude "*" --include "core.mountpoint_s3*"
run: ./.github/actions/scripts/save-coredump.sh

asan:
name: Address sanitizer
Expand Down Expand Up @@ -171,4 +171,4 @@ jobs:
run: make test-asan
- name: Save dump files
if: ${{ failure() }}
run: aws s3 cp /var/lib/systemd/coredump/ s3://${{ env.S3_BUCKET_NAME }}/${{ env.S3_BUCKET_TEST_PREFIX }}coredump/ --recursive --exclude "*" --include "core.mountpoint_s3*"
run: ./.github/actions/scripts/save-coredump.sh

0 comments on commit 4525331

Please sign in to comment.