-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?
- Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands,
swift build,swift test,swift packageetc.
Description
When running swift test with both --filter and --sanitize flags, the test fails to execute because the sanitizer runtime library cannot be loaded into the xctest subprocess.
Environment:
- Swift: 6.2.3 (swiftlang-6.2.3.3.21)
- Xcode: 26.2
- macOS: 26.1 (Build 25B78)
- Architecture: arm64
Steps to Reproduce:
- Create or use any Swift package with tests
- Run: swift test --sanitize address --filter
Expected behavior
Tests matching the filter run with AddressSanitizer enabled.
Actual behavior
Build succeeds, but test execution fails with:
Library not loaded: '@rpath/libclang_rt.asan_osx_dynamic.dylib'
...
code signature in '/Applications/Xcode-26.2.0.app/.../libclang_rt.asan_osx_dynamic.dylib'
not valid for use in process: Sanitizer load violates platform policy
Workaround:
Running without --filter works correctly:
swift test --sanitize address # ✓ works
swift test --sanitize address --filter Foo # ✗ fails
Analysis:
When --filter is used, Swift PM spawns xctest as a subprocess to run filtered tests. The sanitizer runtime's code signature appears to be rejected by macOS platform policy when loaded into this subprocess, but works when tests run directly without the filter mechanism.
Steps to reproduce
No response
Swift Package Manager version/commit hash
No response
Swift & OS version (output of swift --version ; uname -a)
swift-driver version: 1.127.14.1 Apple Swift version 6.2.3 (swiftlang-6.2.3.3.21 clang-1700.6.3.2)
Target: arm64-apple-macosx26.0
Darwin Alex-M3-Air.local 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:26:04 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8122 arm64