[WIP] Implement test discovery on linux#2174
Conversation
jakepetroules
left a comment
There was a problem hiding this comment.
Please update commit message to "[WIP] Implement test discovery on platforms without an Objective-C runtime (Linux, etc.)"
| } | ||
| } | ||
|
|
||
| class LinuxMainCommand: ExternalCommand { |
There was a problem hiding this comment.
Please remove all occurrences of "Linux" from the names of these things -- there's nothing inherently Linux-specific about this so it should be named something like "TestMainCommand", "test-main-tool", etc.
|
|
||
| public func dlopen(_ path: String?, mode: DLOpenFlags) throws -> DLHandle { | ||
| #if os(Windows) | ||
| guard let handle = path?.withCString(encodedAs: UTF16.self, LoadLibraryW) else { |
| } | ||
|
|
||
| #if !os(Windows) | ||
| public func dlerror() -> String? { |
There was a problem hiding this comment.
On Windows you can implement dlerror using GetLastError + FormatMessage. Example here: https://docs.microsoft.com/en-us/windows/desktop/debug/retrieving-the-last-error-code
4788df3 to
573ff5f
Compare
…(Linux, etc.) This is a WIP PR for implementing test discovery on linux using indexing data. The basic idea is to leverage the IndexStore library to get the test methods and then generate a LinuxMain.swift file during the build process. This PR "works" but there are a number of serious hacks that require resolving before we can merge it.
573ff5f to
e36d674
Compare
|
@swift-ci smoke test |
| } | ||
| } | ||
|
|
||
| final class TestDiscoveryCommand: CustomLLBuildCommand { |
There was a problem hiding this comment.
Docs would be nice, I have no idea what this command is trying to do :)
There was a problem hiding this comment.
Going to add some docs in a separate commit.
|
@aciidb0mb3r would that be something we could have on 5.1 too? |
|
Ya, I think that would be fine since this is currently opt-in. |
Awesome. Are you doing the backport cherry-pick or do you want me to? |
|
I am just bringing the 5.1 branch in sync with master as I plan on making more bug fixes (in unrelated areas) that might make cherry-picking harder: #2196 |
|
CC @tomerd btw |
|
Is there a way we can turn this on in a |
|
@dabrahams there's a pitch to enable this by default, and the current thinking is to enable it automatically when there is no LinuxMain.swift file present. https://forums.swift.org/t/pitch-enable-test-discovery-by-default/36619/15 |
|
@benlangmuir So is there no way for me to turn it on in a |
SwiftPM does not exist in the Windows toolchain yet; very little works (mostly because of path handling). That said, there is nothing platform‐specific about this feature, so I imagine it will just work on Windows once the lower‐level issues are resolved. (It certainly worked for Android without anyone needing to put any effort to supporting it.)
No. |
This is a WIP PR for implementing test discovery on linux using indexing
data. The basic idea is to leverage the IndexStore library to get the
test methods and then generate a LinuxMain.swift file during the build
process.
This PR "works" but there are a number of serious hacks that require
resolving before we can merge it.