Debugging swift-testing tests on Linux?

I see that .build/debug/TargetTest.xctest binary is generated. But I don’t see any binary generated for tests by swift-testing. My idea is to attach debugger to the binary generated by swift-testing build. Is that possible?

In general, you can figure out SwiftPM issues like this by running it with the --vv flag to dump all log output. If you do, you will see that it invokes the test*.xctest test runner twice: once with no flags to run the XCTest tests, then a second time with the --testing-library swift-testing flags to run the Testing tests.

Try it with the --filter flag and some test name to see how each handles filtering tests differently. :wink:

In other words, the *.xctest binary contains both types of tests, so if you pass that same test runner in to lldb with the right flags, you can run either type of tests.

Thanks for the solution @Finagolfin , the solution works for me. Also thanks for –vv flag thing, will be useful for me going forward with Swift.

1 Like