Skip to content
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

[SR-11866] SwiftPM: Test targets can't depend on executable products #4639

Closed
jpsim opened this issue Nov 27, 2019 · 1 comment
Closed

[SR-11866] SwiftPM: Test targets can't depend on executable products #4639

jpsim opened this issue Nov 27, 2019 · 1 comment
Labels

Comments

@jpsim
Copy link
Contributor

jpsim commented Nov 27, 2019

Previous ID SR-11866
Radar rdar://problem/57549293
Original Reporter @jpsim
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift version 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9)
Target: x86_64-apple-darwin18.7.0

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 9be230e8cbd0661523d9b755773d4e1e

duplicates:

  • SR-1503 Can't test module under linux that has main.swift in it

Issue Description:

Attempting to add a test target that depends on an executable product produces linker errors: Undefined symbols for architecture

$ mkdir sr-11866
$ cd sr-11866
$ swift package init
$ swift test
[6/6] Linking sr-11866PackageTests
Test Suite 'All tests' started at 2019-11-27 14:07:03.745
Test Suite 'sr-11866PackageTests.xctest' started at 2019-11-27 14:07:03.746
Test Suite 'sr_11866Tests' started at 2019-11-27 14:07:03.746
Test Case '-[sr_11866Tests.sr_11866Tests testExample]' started.
Test Case '-[sr_11866Tests.sr_11866Tests testExample]' passed (0.075 seconds).
Test Suite 'sr_11866Tests' passed at 2019-11-27 14:07:03.820.
   Executed 1 test, with 0 failures (0 unexpected) in 0.075 (0.075) seconds
Test Suite 'sr-11866PackageTests.xctest' passed at 2019-11-27 14:07:03.820.
   Executed 1 test, with 0 failures (0 unexpected) in 0.075 (0.075) seconds
Test Suite 'All tests' passed at 2019-11-27 14:07:03.821.
   Executed 1 test, with 0 failures (0 unexpected) in 0.075 (0.075) seconds
$ sed -i '' 's/library/executable/g' Package.swift
$ mv Sources/sr-11866/sr_11866.swift Sources/sr-11866/main.swift
$ swift test                                                 
Undefined symbols for architecture x86_64:
  "_$s7sr_11866AAVABycfC", referenced from:
      _$s12sr_11866TestsAAC11testExampleyyFSSyKXEfu_ in sr_11866Tests.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)
[6/7] Linking sr-11866PackageTests
@beccadax
Copy link
Contributor

beccadax commented Dec 2, 2019

@swift-ci create

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants