test: Run undefined sanitizer without ignoring errors (#2134)

This commit is contained in:
Ayaz Salikhov
2025-05-19 09:07:14 +01:00
committed by GitHub
parent cdb5882688
commit 5cb3908e4f
2 changed files with 14 additions and 8 deletions

View File

@@ -46,6 +46,10 @@ jobs:
if: inputs.run_unit_tests if: inputs.run_unit_tests
env:
# TODO: remove when we have fixed all currently existing issues from sanitizers
SANITIZER_IGNORE_ERRORS: ${{ inputs.sanitizer != 'false' && inputs.sanitizer != 'ubsan' }}
steps: steps:
- name: Clean workdir - name: Clean workdir
if: ${{ runner.os == 'macOS' }} if: ${{ runner.os == 'macOS' }}
@@ -64,15 +68,15 @@ jobs:
run: chmod +x ./clio_tests run: chmod +x ./clio_tests
- name: Run clio_tests (regular) - name: Run clio_tests (regular)
if: inputs.sanitizer == 'false' if: env.SANITIZER_IGNORE_ERRORS == 'false'
run: ./clio_tests run: ./clio_tests
- name: Run clio_tests (sanitizer) - name: Run clio_tests (sanitizer errors ignored)
if: inputs.sanitizer != 'false' if: env.SANITIZER_IGNORE_ERRORS == 'true'
run: ./.github/scripts/execute-tests-under-sanitizer ./clio_tests run: ./.github/scripts/execute-tests-under-sanitizer ./clio_tests
- name: Check for sanitizer report - name: Check for sanitizer report
if: inputs.sanitizer != 'false' if: env.SANITIZER_IGNORE_ERRORS == 'true'
shell: bash shell: bash
id: check_report id: check_report
run: | run: |
@@ -83,16 +87,15 @@ jobs:
fi fi
- name: Upload sanitizer report - name: Upload sanitizer report
if: inputs.sanitizer != 'false' && steps.check_report.outputs.found_report == 'true' if: env.SANITIZER_IGNORE_ERRORS == 'true' && steps.check_report.outputs.found_report == 'true'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.conan_profile }}_report name: ${{ inputs.conan_profile }}_report
path: .sanitizer-report/* path: .sanitizer-report/*
include-hidden-files: true include-hidden-files: true
# TODO: enable when we have fixed all currently existing issues from sanitizers
- name: Create an issue - name: Create an issue
if: false && inputs.sanitizer != 'false' && steps.check_report.outputs.found_report == 'true' if: false && env.SANITIZER_IGNORE_ERRORS == 'true' && steps.check_report.outputs.found_report == 'true'
uses: ./.github/actions/create_issue uses: ./.github/actions/create_issue
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}

View File

@@ -184,5 +184,8 @@ TEST_P(WarningCodeTest, WarningToJSON)
TEST(RPCErrorsTest, InvalidWarningToJSON) TEST(RPCErrorsTest, InvalidWarningToJSON)
{ {
EXPECT_ANY_THROW((void)makeWarning(static_cast<WarningCode>(999999))); auto notSanitizedMakeWarning = []() __attribute__((no_sanitize("undefined"))) {
return makeWarning(static_cast<WarningCode>(999999));
};
EXPECT_ANY_THROW((void)notSanitizedMakeWarning());
} }