From 15a566b63010ec29ed1faed3c42359cc6f8163df Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 22 Nov 2024 14:26:35 +0000 Subject: [PATCH] CI: Move sanitizer output into a separate CI step Instead of writing ASAN and UBSAN output into the same stream we use for test logging, direct them to log files, named asan.log.$PID and ubsan.log.$PID, and then output them in a separate CI job that runs afterwards. This should hopefully make it easier to see which tests are failing, without losing any benefits. --- .github/workflows/lagom-template.yml | 15 +++++++++++++++ CMakePresets.json | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lagom-template.yml b/.github/workflows/lagom-template.yml index 340ab6f11d82f..a24c3d470171d 100644 --- a/.github/workflows/lagom-template.yml +++ b/.github/workflows/lagom-template.yml @@ -185,6 +185,9 @@ jobs: run: ctest --preset Sanitizer --output-on-failure --test-dir Build env: TESTS_ONLY: 1 + # NOTE: These are appended to the preset's options. + ASAN_OPTIONS: 'log_path=${{ github.workspace }}/asan.log' + UBSAN_OPTIONS: 'log_path=${{ github.workspace }}/ubsan.log' - name: Upload LibWeb Test Artifacts if: ${{ always() && inputs.fuzzer == 'NO_FUZZ' }} @@ -195,6 +198,18 @@ jobs: retention-days: 7 if-no-files-found: ignore + - name: Sanitizer Output + if: ${{ !cancelled() && inputs.fuzzer == 'NO_FUZZ' }} + working-directory: ${{ github.workspace }} + run: | + log_output=$(find . -maxdepth 1 \( -name 'asan.log.*' -o -name 'ubsan.log.*' \) -exec cat {} \; ) + if [ -z "$log_output" ]; then + echo "No sanitizer issues found." + else + echo "$log_output" + exit 1 + fi + - name: Lints if: ${{ inputs.os_name == 'Linux' && inputs.fuzzer == 'NO_FUZZ' }} working-directory: ${{ github.workspace }} diff --git a/CMakePresets.json b/CMakePresets.json index 24274d5af2cc7..b582a6866b399 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -239,8 +239,8 @@ "inherits": "default", "configurePreset": "Sanitizer", "environment": { - "ASAN_OPTIONS": "strict_string_checks=1:check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1:allocator_may_return_null=1", - "UBSAN_OPTIONS": "print_stacktrace=1:print_summary=1:halt_on_error=1" + "ASAN_OPTIONS": "strict_string_checks=1:check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1:allocator_may_return_null=1:$penv{ASAN_OPTIONS}", + "UBSAN_OPTIONS": "print_stacktrace=1:print_summary=1:halt_on_error=1:$penv{UBSAN_OPTIONS}" } }, {