[swift-users] Debugging XCTests on Linux
Ankit Agarwal
ankit at ankit.im
Thu Jan 5 12:13:46 CST 2017
Using swift module in REPL:
Toolchain: January 4, 2017
Platform: Ubuntu 16.04
Add this at end of Package.swift:
```
products += [Product(name: "Result", type: .Library(.Dynamic), modules:
"Result")]
```
$ swift build
$ swift -I .build/debug -L .build/debug -lResult -I
/usr/lib/clang/3.8/include
Welcome to Swift version 3.1-dev (LLVM 217eb6c2b6, Clang 34a98ce92e, Swift
1eb5648c46). Type :help for assistance.
1> import Result
2> let a = Result<String, AnyError>("a")
a: Result.Result<String, Result.AnyError> = success {
success = "a"
}
3> a.dematerialize()
$R0: String = "a"
PS: Make sure you pass these flags when launching docker bash:
"--security-opt seccomp=unconfined"
On Thu, Jan 5, 2017 at 3:33 PM, Robert Atkins via swift-users <
swift-users at swift.org> wrote:
> Hi all,
>
> I'm trying to solve a simple (?) problem where a test suite runs fine on
> macOS but fails on Linux
> (https://github.com/antitypical/Result/pull/210#pullrequestreview-14963305
> ).
> I've downloaded and installed the Swift Linux Docker image
> (https://ashfurrow.com/blog/swift-on-linux/) and got the project
> building and testing, and, mercifully, I get the same failure locally as
> I'm getting on Travis CI. But at this point I'm stuck.
>
> 1) I can't get the SPM-built module the project produces working
> properly in the Swift REPL in order to just play around with it
> (https://bugs.swift.org/browse/SR-1191). Can anyone help me with this?
>
> 2a) How do I use LLDB to set a breakpoint in a test method and step into
> its execution so I can trace through the source of the test failure?
> Saying "lldb swift test" does something, but doesn't know about any of
> the lines I'm trying to set a breakpoint on—I suspect it thinks I'm
> trying to set breakpoints in the swift binary itself, rather than the
> test suite?
>
> 2b) Saying "swift -warnings-as-errors test" doesn't seem to do what I
> want, complaining about "no such file or directory: 'test'", whereas
> "swift test" works fine. Is there a way to pass flags to the swift
> interpreter when it runs tests?
>
> Thanks, Robert.
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
--
Ankit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170105/f61dd7d2/attachment.html>
More information about the swift-users
mailing list