XCTest on Linux


(Stepan Hruda) #1

I’m having a hard time linking against XCTest on Linux. The absolute
minimal example:

import XCTest
XCTMain([])

being run through `swift main.swift` outputs "LLVM ERROR: Program used
external function '_TF6XCTest7XCTMainFGSaPS_10XCTestCase__T_' which could
not be resolved!”.

Could anyone nudge me in the right direction?


(Mish Awadah) #2

Don’t use “swift” unless you want to run the REPL. Here’s how you should build a package that runs tests:

local@ubuntu:~/Documents$ mkdir XTest
local@ubuntu:~/Documents$ cd XTest/
local@ubuntu:~/Documents/XTest$ touch Package.swift
local@ubuntu:~/Documents/XTest$ emacs -nw main.swift
local@ubuntu:~/Documents/XTest$ swift build
Compiling Swift Module 'XTest' (1 sources)
Linking Executable: .build/debug/XTest
local@ubuntu:~/Documents/XTest$ .build/debug/XTest
Total executed 0 tests, with 0 failures (0 unexpected) in -nan (0.0) seconds

- mish

···

On Dec 7, 2015, at 9:26 PM, Stepan Hruda via swift-users <swift-users@swift.org> wrote:

I’m having a hard time linking against XCTest on Linux. The absolute minimal example:

import XCTest
XCTMain([])

being run through `swift main.swift` outputs "LLVM ERROR: Program used external function '_TF6XCTest7XCTMainFGSaPS_10XCTestCase__T_' which could not be resolved!”.

Could anyone nudge me in the right direction?
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Stepan Hruda) #3

Thank you, Mish.

···

On Tue, Dec 8, 2015 at 12:37 AM Mish Awadah <mawadah@apple.com> wrote:

Don’t use “swift” unless you want to run the REPL. Here’s how you should
build a package that runs tests:

local@ubuntu:~/Documents$ mkdir XTest
local@ubuntu:~/Documents$ cd XTest/
local@ubuntu:~/Documents/XTest$ touch Package.swift
local@ubuntu:~/Documents/XTest$ emacs -nw main.swift
local@ubuntu:~/Documents/XTest$ swift build
Compiling Swift Module 'XTest' (1 sources)
Linking Executable: .build/debug/XTest
local@ubuntu:~/Documents/XTest$ .build/debug/XTest
Total executed 0 tests, with 0 failures (0 unexpected) in -nan (0.0)
seconds

- mish

On Dec 7, 2015, at 9:26 PM, Stepan Hruda via swift-users < > swift-users@swift.org> wrote:

I’m having a hard time linking against XCTest on Linux. The absolute
minimal example:

import XCTest
XCTMain([])

being run through `swift main.swift` outputs "LLVM ERROR: Program used
external function '_TF6XCTest7XCTMainFGSaPS_10XCTestCase__T_' which could
not be resolved!”.

Could anyone nudge me in the right direction?

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Jordan Rose) #4

Using "swift" as an interpreter definitely ought to work (including with XCTest), but it hasn't been a focus yet, so if you get the chance please also file a bug at bugs.swift.org <http://bugs.swift.org/>.

Thanks!
Jordan

···

On Dec 7, 2015, at 21:37, Mish Awadah via swift-users <swift-users@swift.org> wrote:

Don’t use “swift” unless you want to run the REPL. Here’s how you should build a package that runs tests:

local@ubuntu:~/Documents$ mkdir XTest
local@ubuntu:~/Documents$ cd XTest/
local@ubuntu:~/Documents/XTest$ touch Package.swift
local@ubuntu:~/Documents/XTest$ emacs -nw main.swift
local@ubuntu:~/Documents/XTest$ swift build
Compiling Swift Module 'XTest' (1 sources)
Linking Executable: .build/debug/XTest
local@ubuntu:~/Documents/XTest$ .build/debug/XTest
Total executed 0 tests, with 0 failures (0 unexpected) in -nan (0.0) seconds

- mish

On Dec 7, 2015, at 9:26 PM, Stepan Hruda via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

I’m having a hard time linking against XCTest on Linux. The absolute minimal example:

import XCTest
XCTMain([])

being run through `swift main.swift` outputs "LLVM ERROR: Program used external function '_TF6XCTest7XCTMainFGSaPS_10XCTestCase__T_' which could not be resolved!”.

Could anyone nudge me in the right direction?
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto: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