vscode-swift icon indicating copy to clipboard operation
vscode-swift copied to clipboard

Test Coverage: Cannot run `swift test` via `cp.execFile` on Windows

Open adam-fowler opened this issue 2 years ago • 1 comments

If you run swift test via Javascript command cp.execFile on Windows it fails to run the tests. It returns an error of the following form. There seems to be an issue with the generated test executables.

<unknown>:0: error: PCH was compiled with module cache path 'C:\Users\User\Developer\libs\swift-collections\.build\x86_64-unknown-windows-msvc\debug\ModuleCache\2TGCAFOH5KUFD', but the path is currently 'c:\Users\User\Developer\libs\swift-collections\.build\x86_64-unknown-windows-msvc\debug\ModuleCache\2TGCAFOH5KUFD'
<unknown>:0: error: missing required module 'SwiftShims'

The only difference between the two paths is one begins with c:\\ the other begins with C:\\.

This means we cannot run the test coverage code on Windows as this is run with swift test --enable-code-coverage.

adam-fowler avatar Jan 19 '23 18:01 adam-fowler

This doesn’t se like an error of the generated executable. Paths are case insensitive on windows, and it seems that the drive is getting normalized to lower case. This is equivalent but will fail the strcmp that occurs.

compnerd avatar Jan 20 '23 15:01 compnerd

I've had success running tests with code coverage on Windows ever since https://github.com/swiftlang/vscode-swift/pull/942 went in. I'm not sure this still applies, so I'm going to close it. @adam-fowler feel free to reopen if its still an issue.

plemarquand avatar Jul 05 '24 18:07 plemarquand