Skip to content

Commit

Permalink
Upload core dump files as test artifacts (#14499)
Browse files Browse the repository at this point in the history
This PR sets the `core_pattern` such that core dumps from LXD with be
gzipped and placed in `/var/crash`. Then, if any files are present in
`/var/crash` at the end of the run they will be uploaded as artifacts
(regardless of test status).

#14498 should be merged first and I'll remove the cherry-picked commit.
  • Loading branch information
tomponline authored Nov 21, 2024
2 parents 682df74 + 3a99bb9 commit ec03f4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,23 @@ jobs:

- name: "Run system tests (${{ matrix.suite }}, ${{ matrix.backend }})"
run: |
echo '|/bin/sh -c $@ -- eval exec gzip --fast > /var/crash/core-%e.%p.gz' | sudo tee /proc/sys/kernel/core_pattern
set -eux
chmod +x ~
echo "root:1000000:1000000000" | sudo tee /etc/subuid /etc/subgid
cd test
sudo --preserve-env=PATH,GOPATH,GOCOVERDIR,GITHUB_ACTIONS,LXD_VERBOSE,LXD_BACKEND,LXD_CEPH_CLUSTER,LXD_CEPH_CEPHFS,LXD_CEPH_CEPHOBJECT_RADOSGW,LXD_OFFLINE,LXD_SKIP_TESTS,LXD_REQUIRED_TESTS, LXD_BACKEND=${{ matrix.backend }} ./main.sh ${{ matrix.suite }}
- name: Upload crash dumps
if: always()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: crash-dumps-${{ matrix.suite }}-${{ matrix.backend }}
path: |
/var/crash/core-*
retention-days: 5
if-no-files-found: ignore

- name: Upload coverage data
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
Expand Down
7 changes: 0 additions & 7 deletions test/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ cleanup() {
if [ "${expandDmesg}" = "no" ]; then
echo "::endgroup::"
fi

if [ "$(ls -A /var/crash)" ]; then
echo "::group::crashes"
ls -la /var/crash
find /var/crash -type f -exec cat {} +
echo "::endgroup::"
fi
fi

if [ -n "${GITHUB_ACTIONS:-}" ]; then
Expand Down

0 comments on commit ec03f4c

Please sign in to comment.