Repository navigation
test: Add per-test sanitizers only through obs_test_sanitize - #422
Merged
Merged
Conversation
The eight tests that compile their code with ASan/UBSan now go through one helper, which skips the flags on MSVC, when the build is already sanitized, or when OBS_TEST_SANITIZE_PER_TARGET is OFF. A TSan, MSan or valgrind build of the tree no longer fails on mixed sanitizers. Closes #159 Local-Gate: v1 tree=09b7963777baa33e3d085edefec480a78cdfc479 secs=139 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791854223,"gate":"rust/all/fmt","host":"linux-x86_64","key":"410051af9b87b8efe73243aaed515fae3b73c1ada522ffd27f4809f52f216561","lane":"lint","parents":["c3388bd59eb06a0e4e599e1f8b0d01c7558193d4"],"secs":17,"stamp":"be27f4fb4a7c9934ff83d39711d2f288","tree":"09b7963777baa33e3d085edefec480a78cdfc479","v":1,"via":"run"} Ci-Attestation: {"at":1791854223,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"410051af9b87b8efe73243aaed515fae3b73c1ada522ffd27f4809f52f216561","lane":"lint","parents":["c3388bd59eb06a0e4e599e1f8b0d01c7558193d4"],"secs":17,"stamp":"39031d6035ef9cb8fecde4537a08d8bc","tree":"09b7963777baa33e3d085edefec480a78cdfc479","v":1,"via":"run"} Ci-Attestation: {"at":1791854223,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"92562d9e529839c999f5ac6677f7f059daf98a7d0617c03c572a9103eb5f99b7","lane":"rust-test","parents":["c3388bd59eb06a0e4e599e1f8b0d01c7558193d4"],"secs":56,"stamp":"da8d271682947ea6395f303720794118","tree":"09b7963777baa33e3d085edefec480a78cdfc479","v":1,"via":"run"} Ci-Attestation: {"at":1791854223,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"922b2b595ab1a4ef1a10a183942f597f86d6beba257a59ac9e0c1bfa255409a7","lane":"tier2-linux","parents":["c3388bd59eb06a0e4e599e1f8b0d01c7558193d4"],"secs":66,"stamp":"ee49e86b958dd4553a303cb8453fe851","tree":"09b7963777baa33e3d085edefec480a78cdfc479","v":1,"via":"run"}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #159.
Eight cmocka tests hard-coded
-fsanitize=address/undefinedon their targets, so a tree configured with-fsanitize=thread(or MSan) failed to build (-fsanitize=thread is incompatible with -fsanitize=address), and valgrind couldn't run the ASan binaries.ci/test_cmocka_sanitize.py(run by./lint) rejects any raw-fsanitizeintest/cmocka/CMakeLists.txtandtests.d/*.cmakeoutside the helper.obs_test_sanitize(<target> <sanitizers>)plus optionOBS_TEST_SANITIZE_PER_TARGET(default ON). It adds-fsanitize=<s> -fno-omit-frame-pointer(and-fno-sanitize-recover=undefinedwith UBSan) except on MSVC, whenCMAKE_C_FLAGS/CMAKE_CXX_FLAGS/CMAKE_EXE_LINKER_FLAGSalready contain-fsanitize=, or when the option is OFF. It covers test_avc, test_formatted_filename, test_utf8, test_amf_decode (keeps-fsigned-char), test_utf8_insize0, test_amf3_terminator, test_amf3_classname and test_dstr_zero_len. No C test source changed.Checked by configuring a scratch project with the helper: a plain build gets
-fsanitize=address,undefined;-fno-omit-frame-pointer;-fno-sanitize-recover=undefined, and-DCMAKE_C_FLAGS=-fsanitize=threadgets none. The local gate (incl. Tier 2 OFF/ON) passed and is stamped.