From a11beabb932a41720cfcc28bad439c6e384eeb22 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 10 Jun 2021 10:35:29 -0400 Subject: [PATCH] When the "Test Suites" job fails on Darwin, upload core and object files as artifacts. If the failure was due to a crash, this allows us to debug the crash. Unfortunately, I don't see an obvious way to only do the upload if the failure was due a crash. Luckily the big thing is the core file and that won't exist if this is not a crash failure. --- .github/workflows/tests.yaml | 34 +++++++++++++++++++++++++++++++++- scripts/tests/test_suites.sh | 2 ++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6ec07e559f7c0c..448fc94fb6f20d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,6 +17,7 @@ name: Tests on: push: pull_request: + workflow_dispatch: jobs: test_suites_linux: @@ -75,6 +76,11 @@ jobs: submodules: true - name: Setup Environment run: brew install openssl pkg-config + - name: Try to ensure the directories for core dumping and diagnostic log collection exist and we can write them. + run: | + sudo chown ${USER} /cores || true + mkdir -p ~/Library/Logs/DiagnosticReports || true + mkdir objdir-clone || true - name: Fix pkgconfig link working-directory: /usr/local/lib/pkgconfig run: | @@ -102,8 +108,34 @@ jobs: timeout-minutes: 5 run: | scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ + - name: Copy objdir + run: | + # The idea is to not upload our objdir unless builds have + # actually succeeded, because that just wastes space. + rsync -a out/debug/standalone/ objdir-clone || true - name: Run Test Suites timeout-minutes: 5 run: | scripts/tests/test_suites.sh - + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: crash-core + path: /cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading diagnostic logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: crash-log + path: ~/Library/Logs/DiagnosticReports/ + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: crash-objdir + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 diff --git a/scripts/tests/test_suites.sh b/scripts/tests/test_suites.sh index 36e12e502bf463..997f9ac08e03b7 100755 --- a/scripts/tests/test_suites.sh +++ b/scripts/tests/test_suites.sh @@ -45,6 +45,8 @@ done echo "" echo "" +ulimit -c unlimited || true + declare -a iter_array="($(seq "$iterations"))" for j in "${iter_array[@]}"; do echo " ===== Iteration $j starting"