[SR-13718] swift test --generate-linuxmain
doesn't grok conditionally compiled tests
#4488
Labels
swift test --generate-linuxmain
doesn't grok conditionally compiled tests
#4488
Attachment: Download
Additional Detail from JIRA
md5: 376ee6032ad73b2b9443fab165a3646a
Issue Description:
The swift-atomics package has some functionality that may be unavailable depending on properties of the underlying architecture. In particular, atomic strong references are only available when the target platform supports double-wide atomic primitives. Linux happens to prevent the use of double-wide atomics on x86_64 by default, so these features aren't normally available there.
This means that XCTestCase classes that test this functionality must be placed behind a compile-time `#if` conditional.
Unfortunately SwiftPM's handy `swift test --generate-linuxmain` functionality ignores conditional compilation directives, and unconditionally tries to register all tests, leading to a broken test manifest.
To reproduce, download the attached sample package and try to build its test on Linux.
Generated XCTestManifests.swift:
Output when attempting to build this on Ubuntu 20.04 with the Swift 5.3 toolchain:
The text was updated successfully, but these errors were encountered: