diff --git a/.github/workflows/lagom-template.yml b/.github/workflows/lagom-template.yml index b2c0d75cd00e6..2a0fa13dae997 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 --timeout 1800 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,19 @@ 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" + echo "::notice Sanitizer errors happened while running tests; see the Test step above." + 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}" } }, {