Skip to content

Commit

Permalink
CI: enable and collect core dumps in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Anderson <sven@redhat.com>
  • Loading branch information
ansiwen committed Nov 9, 2023
1 parent 2852a13 commit e859bac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,23 @@ jobs:
go_version: ${{ needs.go-versions.outputs.unstable }}
steps:
- uses: actions/checkout@v4
- name: Set cores to get stored as "core"
run: sudo bash -c 'echo "core" > /proc/sys/kernel/core_pattern'
- name: Run tests
run: make test-containers-test "CEPH_VERSION=${{ matrix.ceph_version }}" "GO_VERSION=${{ matrix.go_version }}" "RESULTS_DIR=$PWD/_results"
- name: Clean up test containers
if: always()
run: make test-containers-clean "CEPH_VERSION=${{ matrix.ceph_version }}"
- name: Archive test results
if: always()
uses: actions/upload-artifact@v3
with:
name: "go-ceph-results-${{ matrix.ceph_version }}-${{ matrix.go_version }}"
path: |
_results/
retention-days: 30
- name: Check API Versions and Aging
if: always()
run: |
if [ -f _results/implements.json ]; then
./contrib/apiage.py
Expand Down
18 changes: 16 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,23 @@ test_pkg() {
testargs+=("-memprofile" "${pkg}.mem.out")
fi

show go test -v "${testargs[@]}" "./${pkg}"
ulimit -c unlimited
go test -c -v "${testargs[@]}" "./${pkg}"
show "./${pkg}.test"
ret=$(($?+ret))
grep -v "^mode: count" "${pkg}.cover.out" >> "cover.out"
if ls core.* >/dev/null 2>&1; then
echo "Found coredump"
sleep 5
mv core.* "${pkg}.core"
chmod 644 "${pkg}.core"
echo "set auto-load safe-path /" >>/root/.gdbinit
gdb "${pkg}.test" "${pkg}.core" -ex bt -ex q | cat
mkdir -p "${RESULTS_DIR}"
mv "${pkg}.test" "${pkg}.core" "${RESULTS_DIR}"
fi
if [[ -x "${pkg}.cover.out" ]] ; then
grep -v "^mode: count" "${pkg}.cover.out" >> "cover.out"
fi
return ${ret}
}

Expand Down
3 changes: 2 additions & 1 deletion testing/containers/ceph/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ RUN true && \
yum install -y \
git wget curl make \
/usr/bin/cc /usr/bin/c++ \
"libcephfs-devel-${cv}" "librados-devel-${cv}" "librbd-devel-${cv}" && \
"libcephfs-devel-${cv}" "librados-devel-${cv}" "librbd-devel-${cv}" \
gdb librados2-debuginfo && \
yum clean all && \
true

Expand Down

0 comments on commit e859bac

Please sign in to comment.