The package manager will add an implicit dependency between the test suite and the target it assumes it is trying to test. In your case, however, your package module is named PlayingCard, and your test module is name CardTests (not PlayingCardTests) so it doesn't find that dependency. This leaves it without any dependencies, and so the link fails. That the build of the individual test files doesn't fail is because we don't yet have a good way to enforce your Swift code only see what it is allowed to.
If you do: ``` $ git mv Tests/Card Tests/PlayingCard $ TOOLCHAINS=swift swift build $ TOOLCHAINS=swift swift test ``` then it should work. - Daniel > On Apr 20, 2016, at 5:05 PM, Jose Cheyo Jimenez via swift-users > <swift-users@swift.org> wrote: > > I filed a bug against the swift package manager. > > https://bugs.swift.org/browse/SR-1276 <https://bugs.swift.org/browse/SR-1276> > > >> On Apr 19, 2016, at 11:20 PM, Jose Cheyo Jimenez <ch...@masters3d.com >> <mailto:ch...@masters3d.com>> wrote: >> >> I fixed the previous issue by uninstalling a really old version of >> https://github.com/realm/SwiftLint <https://github.com/realm/SwiftLint> >> >> Now I am having the same error as >> https://bugs.swift.org/browse/SR-151 <https://bugs.swift.org/browse/SR-151> >> but the linking error only occurs when I run the test. (It builds just fine) >> >> This is my fork with added tests. >> https://github.com/masters3d/example-package-playingcard >> <https://github.com/masters3d/example-package-playingcard> >> >> Builds ok. >> Tests fail to link >> >> $ swift build -v >> 2016-04-19 23:07:36.949 xcodebuild[13800:2337418] Build settings from >> command line: >> 2016-04-19 23:07:36.950 xcodebuild[13800:2337418] ENABLE_BITCODE = NO >> 2016-04-19 23:07:36.950 xcodebuild[13800:2337418] >> SWIFT_DISABLE_REQUIRED_ARCLITE = YES >> 2016-04-19 23:07:36.950 xcodebuild[13800:2337418] >> SWIFT_LINK_OBJC_RUNTIME = YES >> 2016-04-19 23:07:36.950 xcodebuild[13800:2337418] TOOLCHAINS = >> org.swift.3020160412a >> 2016-04-19 23:07:36.950 xcodebuild[13800:2337418] >> XCODE_DEFAULT_TOOLCHAIN_OVERRIDE = >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain >> 2016-04-19 23:07:37.348 xcodebuild[13802:2337432] Build settings from >> command line: >> 2016-04-19 23:07:37.349 xcodebuild[13802:2337432] ENABLE_BITCODE = NO >> 2016-04-19 23:07:37.349 xcodebuild[13802:2337432] >> SWIFT_DISABLE_REQUIRED_ARCLITE = YES >> 2016-04-19 23:07:37.349 xcodebuild[13802:2337432] >> SWIFT_LINK_OBJC_RUNTIME = YES >> 2016-04-19 23:07:37.349 xcodebuild[13802:2337432] TOOLCHAINS = >> org.swift.3020160412a >> 2016-04-19 23:07:37.349 xcodebuild[13802:2337432] >> XCODE_DEFAULT_TOOLCHAIN_OVERRIDE = >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/bin/swiftc >> --driver-mode=swift -I >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/lib/swift/pm >> -L >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/lib/swift/pm >> -lPackageDescription -target x86_64-apple-macosx10.10 >> /Volumes/Joses_Stuff/github/Swift\ >> OSS/example-package-playingcard/Package.swift -fileno 3 >> 2016-04-19 23:07:39.731 xcodebuild[13808:2337460] Build settings from >> command line: >> 2016-04-19 23:07:39.732 xcodebuild[13808:2337460] ENABLE_BITCODE = NO >> 2016-04-19 23:07:39.732 xcodebuild[13808:2337460] >> SWIFT_DISABLE_REQUIRED_ARCLITE = YES >> 2016-04-19 23:07:39.732 xcodebuild[13808:2337460] >> SWIFT_LINK_OBJC_RUNTIME = YES >> 2016-04-19 23:07:39.732 xcodebuild[13808:2337460] TOOLCHAINS = >> org.swift.3020160412a >> 2016-04-19 23:07:39.732 xcodebuild[13808:2337460] >> XCODE_DEFAULT_TOOLCHAIN_OVERRIDE = >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/bin/swift-build-tool >> -f /Volumes/Joses_Stuff/github/Swift\ >> OSS/example-package-playingcard/.build/debug.yaml default -v >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/bin/swiftc >> -module-name PlayingCard -incremental -emit-dependencies -emit-module >> -emit-module-path "/Volumes/Joses_Stuff/github/Swift >> OSS/example-package-playingcard/.build/debug/PlayingCard.swiftmodule" >> -output-file-map "/Volumes/Joses_Stuff/github/Swift >> OSS/example-package-playingcard/.build/debug/PlayingCard.build/output-file-map.json" >> -parse-as-library -c "/Volumes/Joses_Stuff/github/Swift >> OSS/example-package-playingcard/Sources/Card.swift" >> "/Volumes/Joses_Stuff/github/Swift >> OSS/example-package-playingcard/Sources/Rank.swift" >> "/Volumes/Joses_Stuff/github/Swift >> OSS/example-package-playingcard/Sources/Suit.swift" -I >> "/Volumes/Joses_Stuff/github/Swift >> OSS/example-package-playingcard/.build/debug" -j8 -Onone -g -D SWIFT_PACKAGE >> -enable-testing -F >> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks >> -target x86_64-apple-macosx10.10 -sdk >> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk >> >> >> >> >> $ swift test >> Compiling Swift Module 'CardTestSuite' (3 sources) >> Linking .build/debug/PlayingCard.xctest/Contents/MacOS/PlayingCard >> Undefined symbols for architecture x86_64: >> "__TFO11PlayingCard4RankCfT8rawValueSi_GSqS0__", referenced from: >> >> __TFFC13CardTestSuite8RankTest22testRankStringEqualityFT_T_U_FSiGSqO11PlayingCard4Rank_ >> in RankTests.swift.o >> "__TFV11PlayingCard4CardCfT4rankOS_4Rank4suitOS_4Suit_S0_", referenced >> from: >> __TFC13CardTestSuite8CardTest14testCardSinglefT_T_ in CardTests.swift.o >> __TFC13CardTestSuite8CardTest22testCardStringEqualityfT_T_ in >> CardTests.swift.o >> "__TMO11PlayingCard4Rank", referenced from: >> __TFC13CardTestSuite8RankTest22testRankStringEqualityfT_T_ in >> RankTests.swift.o >> __TMaGSqO11PlayingCard4Rank_ in RankTests.swift.o >> >> __TFFC13CardTestSuite8RankTest22testRankStringEqualityFT_T_U1_FO11PlayingCard4RankSi >> in RankTests.swift.o >> __TMaGSaO11PlayingCard4Rank_ in RankTests.swift.o >> >> __TFFC13CardTestSuite8RankTest22testRankStringEqualityFT_T_u_KzT_GSqSS_ in >> RankTests.swift.o >> >> __TFFC13CardTestSuite8RankTest22testRankStringEqualityFT_T_u1_KzT_GSqSS_ in >> RankTests.swift.o >> >> __TFFC13CardTestSuite8RankTest22testRankStringEqualityFT_T_u3_KzT_GSqSS_ in >> RankTests.swift.o >> ... >> "__TMO11PlayingCard4Suit", referenced from: >> >> __TFFC13CardTestSuite8SuitTest22testSuitStringEqualityFT_T_u_KzT_GSqSS_ in >> SuitTests.swift.o >> >> __TFFC13CardTestSuite8SuitTest22testSuitStringEqualityFT_T_u1_KzT_GSqSS_ in >> SuitTests.swift.o >> >> __TFFC13CardTestSuite8SuitTest22testSuitStringEqualityFT_T_u3_KzT_GSqSS_ in >> SuitTests.swift.o >> >> __TFFC13CardTestSuite8SuitTest22testSuitStringEqualityFT_T_u5_KzT_GSqSS_ in >> SuitTests.swift.o >> __TFC13CardTestSuite8SuitTest18testSuitComparablefT_T_ in >> SuitTests.swift.o >> "__TMV11PlayingCard4Card", referenced from: >> __TFC13CardTestSuite8CardTest14testCardSinglefT_T_ in CardTests.swift.o >> >> __TFFC13CardTestSuite8CardTest22testCardStringEqualityFT_T_u_KzT_GSqSS_ in >> CardTests.swift.o >> >> __TFFC13CardTestSuite8CardTest22testCardStringEqualityFT_T_u1_KzT_GSqSS_ in >> CardTests.swift.o >> >> __TFFC13CardTestSuite8CardTest22testCardStringEqualityFT_T_u3_KzT_GSqSS_ in >> CardTests.swift.o >> "__TWPO11PlayingCard4Ranks10ComparableS_", referenced from: >> __TFC13CardTestSuite8RankTest18testRankComparablefT_T_ in >> RankTests.swift.o >> "__TWPO11PlayingCard4Suits10ComparableS_", referenced from: >> __TFC13CardTestSuite8SuitTest18testSuitComparablefT_T_ in >> SuitTests.swift.o >> "__TWPV11PlayingCard4Cards10ComparableS_", referenced from: >> __TFC13CardTestSuite8CardTest14testCardSinglefT_T_ in CardTests.swift.o >> "__TWPV11PlayingCard4Cards9EquatableS_", referenced from: >> __TFC13CardTestSuite8CardTest14testCardSinglefT_T_ in CardTests.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): >> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/bin/swift-build-tool >> -f /Volumes/Joses_Stuff/github/Swift\ >> OSS/example-package-playingcard/.build/debug.yaml test >> >> >> >> >> >>> On Apr 14, 2016, at 10:32 PM, Jose Cheyo Jimenez <ch...@masters3d.com >>> <mailto:ch...@masters3d.com>> wrote: >>> >>> Hi Everybody, >>> >>> I am trying to build the example-packages but I am getting errors once I >>> try to run test >>> >>> I was hopping to add some tests to close >>> https://bugs.swift.org/browse/SR-1187 >>> <https://bugs.swift.org/browse/SR-1187> >>> >>> I am using the 3-24 snapshot but I am getting import errors >>> >>> : error: no such module 'FisherYates' >>> import FisherYates >>> ^ >>> <unknown>:0: error: build had 1 command failures >>> >>> It would seem that I am not able to import module names. >>> >>> The same thing happens when I try to run some new xctest from others the >>> other with no dependencies. >>> >>> example-package-deckofplayingcards >>> example-package-fisheryates >>> example-package-playingcard >>> example-package-dealer >>> >>> >> > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users