Skip to content

Commit

Permalink
CI: Move sanitizer output into a separate CI step
Browse files Browse the repository at this point in the history
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.

The downside is that it's now harder to tell which tests the *SAN errors
are related to.
  • Loading branch information
AtkinsSJ committed Nov 22, 2024
1 parent 75b7a3e commit b968863
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/lagom-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand All @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
},
{
Expand Down

0 comments on commit b968863

Please sign in to comment.