From 43e3b78eb0efb7bd5b9e784e3a3665ddc8fd6818 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Wed, 7 Dec 2022 11:58:12 -0800 Subject: [PATCH] feat: CI: capture core dumps --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ shell.nix | 1 + 2 files changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b098619615..0a7859a97d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -157,6 +157,12 @@ jobs: # open nix-shell once for initial setup true if: matrix.os == 'ubuntu-latest' + - name: Set up core dumps + run: | + mkdir -p $PWD/coredumps + # store in current directory, for easy uploading together with binary + echo $PWD/coredumps/%e.%p.%t | sudo tee /proc/sys/kernel/core_pattern + if: matrix.os == 'ubuntu-latest' - name: Build run: | mkdir build @@ -203,6 +209,7 @@ jobs: - name: Test run: | cd build/stage1 + ulimit -c unlimited # coredumps # exclude nonreproducible test ctest -j4 --output-on-failure -E leanlaketest_git ${{ matrix.CTEST_OPTIONS }} < /dev/null if: ${{ !matrix.cross }} @@ -233,6 +240,22 @@ jobs: if: matrix.name == 'Linux' - name: CCache stats run: ccache -s + - name: Show stacktrace for coredumps + if: ${{ failure() }} && matrix.os == 'ubuntu-latest' + run: | + for c in coredumps/*; do + progbin="$(file $c | sed "s/.*execfn: '\([^']*\)'.*/\1/")" + echo bt | $GDB/bin/gdb -q $progbin $c || true + done + - name: Upload coredumps + uses: actions/upload-artifact@v3 + if: ${{ failure() }} && matrix.os == 'ubuntu-latest' + with: + name: coredumps-${{ matrix.name }} + path: | + ./coredumps + ./build/stage1/bin/lean + ./build/stage1/lib/lean/libleanshared.so release: if: startsWith(github.ref, 'refs/tags/') diff --git a/shell.nix b/shell.nix index af11dcb5f7..dfc4b124c4 100644 --- a/shell.nix +++ b/shell.nix @@ -21,6 +21,7 @@ in { pkgs ? flakePkgs.nixpkgs, pkgsDist ? pkgs }: GLIBC_DEV = pkgsDist.glibc.dev; GCC_LIB = pkgsDist.gcc.cc.lib; ZLIB = pkgsDist.zlib; + GDB = pkgsDist.gdb; }); nix = flake.devShell.${builtins.currentSystem}; }