-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
swift test
does not discover all tests
#5573
Comments
radar://59655518 |
👋🏻 Hello, this issue is still happening, I have faced it during implementation of Sourcery on Linux, where tests are discovered on macOS, but not on Linux. Any pointers anyone? I'd appreciate it a bunch 🙏🏻 |
Looks like this was supposed to be solved by #5637 -- which version of SwiftPM were you using? |
👋🏻 Hello @neonichu , thank you very much for your response!
I have tried to use the latest development snapshot from 12th of August, 2023, facing the same issue there. I have also asked this question on Swift forums and received a useful reply, related to specifics of Sourcery library, which relies on Quick framework, which has this issue, where tests are not discovered, even though test (<#something#>Spec) classes are subclassed from I am trying to make it work according to what's documented there, but I wanted to run SPM myself from sources to debug and probably fix this issue, and could not, hitting "PackageDescription" import failing [2] when calling a compiled Notes[1] - public typealias QuickSpecBase = XCTestCase
|
the fix (and logic) itself was done in https://github.com/apple/swift-tools-support-core/pull/335/files#diff-de74314b412b8d423fec461826c4ad64056d9d77e95c65ace4e27eb969beb8acR84 cc @stmontgomery since this is based on XCTest internals afaik |
My best guess is that this might still be happening only when using an "intermediary" testing library like Quick. Is the current logic in SwiftPM for using indexer data to find tests only examining the object files for the test target(s) in a particular package, or does this logic also scan the object files from package dependencies? If it's not scanning the object files for Quick package too, it might not realize that the @tomerd I'm not deeply familiar with this logic in SwiftPM, but are you able to check on this? |
👋🏻 Hello @stmontgomery , thank you very much for your response! I would like to add a couple of notes here:
I would love to just debug this myself since I have already cloned SPM and tried to run it against Sourcery' Package.swift, but as mentioned above, I see a runtime compilation error with that |
If you're building SwiftPM in Xcode and seeing |
Description
On Linux platforms the test discovery mechanism does not discover all tests. Specifically, it does not discover tests which are declared in a parent class.
As an example:
Should include two tests:
BaseTests.testItShouldPass
andInheritestTests.testItShouldPass
.On Linux only
BestTests.testItShouldPass
is discovered:On macOS all tests are discovered:
As expected, the same is true when running the tests: 2 tests are run on macOS and only 1 on Linux.
Expected behavior
I would expect the output of
swift test --list-tests
to be the same on macOS and Linux.Actual behavior
Tests which run on macOS are silently not run on Linux when using test discovery.
Steps to reproduce
See example in description.
Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version && uname -a
)This also reproduces with older Linux toolchains.
The text was updated successfully, but these errors were encountered: