You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the code for that module is in src/SwiftPMOddErrors.
In the Tests directory, I have a directory called Tests/SwiftPMOddErrorz (notice Error_z_ vs Error_s_, ie a small typo).
Compiling that project with swift build works just fine but running the tests (swift test) leads to
Linking ./.build/debug/swiftpm-odd-errorsPackageTests.xctest/Contents/MacOS/swiftpm-odd-errorsPackageTests
Undefined symbols for architecture x86_64:
"__TF16SwiftPMOddErrors3mooFT_T_", referenced from:
__TFC21SwiftPMOddErrorzTests16SwiftPMOddErrors7testMoofT_T_ in SwiftPMOddErrorsTests.swift.o
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /private/tmp/swiftpm-odd-errors/.build/debug.yaml test
Checking the compiler/linker invocations from swift test -v, we can see that the module SwiftPMOddErrors (the one with the correct name) isn't actually included in the build:
That's because the other-args section in debug.yaml's "<SwiftPMOddErrorzTests.module>" doesn't contain the module map for the SwiftPMOddErrors module.
My guess is that when SwiftPM tried to link a tests module XXXTests it automatically adds the module XXX 's module map and everything works. Now if you mistype the tests to XXYTests, then it tries to find module XXY but doesn't find it. Unfortunately it doesn't output any diagnostics...
Please find attached a tar ball with a minimal repro repo. The first commit contains the working state and the second commit then breaks it. The diff is
$ git show HEAD
commit aac0c0b1d0e40ef7906c51929f8fd50fcf5f890e
Author: Johannes Weiß <johannesweiss@apple.com>
Date: Fri May 26 15:55:18 2017 +0100
now broken
diff --git a/Tests/SwiftPMOddErrorsTests/SwiftPMOddErrorsTests.swift b/Tests/SwiftPMOddErrorzTests/SwiftPMOddErrorsTests.swift
similarity index 100%
rename from Tests/SwiftPMOddErrorsTests/SwiftPMOddErrorsTests.swift
rename to Tests/SwiftPMOddErrorzTests/SwiftPMOddErrorsTests.swift
The text was updated successfully, but these errors were encountered:
This is expected, we establish an automatic dependency if there are `Foo` and `FooTest` targets. In all other cases, you need to manually specify the dependency.
The automatic dependency rule is removed from V4 manifest, so you will always need to specify the dependencies in the new manifest.
Attachment: Download
Additional Detail from JIRA
md5: 734451aac566b34f637735a73a8ff5c7
relates to:
Issue Description:
tl;dr When having a typo in the tests directory name, the module to be tested doesn't get linked.
Full version
I have a project with the following structure
the package manifest declares a target
SwiftPMOddErrors
:the code for that module is in
src/SwiftPMOddErrors
.In the
Tests
directory, I have a directory calledTests/SwiftPMOddErrorz
(notice Error_z_ vs Error_s_, ie a small typo).Compiling that project with
swift build
works just fine but running the tests (swift test
) leads toChecking the compiler/linker invocations from
swift test -v
, we can see that the moduleSwiftPMOddErrors
(the one with the correct name) isn't actually included in the build:That's because the
other-args
section in debug.yaml's"<SwiftPMOddErrorzTests.module>"
doesn't contain the module map for theSwiftPMOddErrors
module.My guess is that when SwiftPM tried to link a tests module
XXXTests
it automatically adds the moduleXXX
's module map and everything works. Now if you mistype the tests toXXYTests
, then it tries to find moduleXXY
but doesn't find it. Unfortunately it doesn't output any diagnostics...Please find attached a tar ball with a minimal repro repo. The first commit contains the working state and the second commit then breaks it. The diff is
The text was updated successfully, but these errors were encountered: