[TSan] Deflake positive TSan+libdispatch test #25669
Merged
+28
−20
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.
TSan does not guarantee the detection of races [1]. This means that any
positive test, i.e., a test that asserts the detection of a race, comes
with inherent flakiness. In the LLVM TSan test suite this unfortunate
circumstance is mitigated via the deflake utility [2] (plus lit
substitution) which executes a test multiple times.
Since we currently only have 3 positive TSan tests in the Swift test
suite [3] (the remaining ones test the absence of false positives), we
decided against bringing over this utility for now. Instead this change
attempts to "deflake" as part of the test itself.
[1] https://groups.google.com/d/msg/thread-sanitizer/KIok3F_b1oI/RwrMNhyHafwJ
[2] llvm/llvm-project@233f401
[3] Positive TSan tests:
test/Sanitizers/tsan.swift
test/Sanitizers/tsan-libdispatch.swift
validation-test/Sanitizers/tsan-inout.swift
rdar://51730684