-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add functional test for swift test --sanitize --filter failure #9547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add functional test for swift test --sanitize --filter failure #9547
Conversation
|
This PR intentionally only adds coverage for the sanitizer + filter behavior. |
|
Note: This test documents a known failure that appears to originate in the swiftpm-xctest-helper (an Xcode tool), not SwiftPM itself. The test is intentionally added as coverage to prevent regressions and to make the behavior explicit while the underlying issue is tracked separately (via Apple Feedback). |
Co-authored-by: Stuart Montgomery <smontgomery@apple.com>
| } | ||
| } | ||
| #else | ||
| throw SkipTest("Sanitizer + filter behavior is macOS-specific") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd generally recommend an .enabled(if:) for expressing that a particular test is only relevant on certain platforms
| _ buildSystem: BuildSystemProvider.Kind | ||
| ) async throws { | ||
| #if os(macOS) | ||
| try await withKnownIssue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indentation looks off; I'd expect the body of this whole function to be indented one level
| ) async throws { | ||
| #if os(macOS) | ||
| try await withKnownIssue( | ||
| "Fails due to swiftpm-xctest-helper (Xcode tool) violating platform sanitizer policy (#9546, rdar://168234231)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the part I commented on/suggested, and that part LGTM! Thanks
Add functional test covering swift test --sanitize --filter failure
Motivation:
When running swift test on macOS with both --sanitize address and --filter enabled, test execution fails with the error:
Sanitizer load violates platform policy.
Running either flag independently works as expected, but the combination consistently fails. This behavior is currently undocumented and untested. Adding coverage ensures the issue is reproducible and prevents accidental regressions while the underlying cause is investigated.
Modifications:
Added a new functional test in TestDiscoveryTests
Used SwiftPM’s functional test harness to invoke swift test
Passed --sanitize address and --filter together
Asserted on the observed platform policy violation message
Guarded the test to macOS
Result:
The sanitizer + filter failure is now captured by SwiftPM’s test suite, making the behavior explicit and providing a stable foundation for future fixes or refactors.
Fixes #9546