File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -847,13 +847,8 @@ final class TestRunner {
847
847
}
848
848
args += [ xctestPath. pathString]
849
849
case . swiftTesting:
850
- // FIXME: better way to get path to self
851
- let toolPath = String ( unsafeUninitializedCapacity: 2048 ) { buffer in
852
- var count = UInt32 ( buffer. count)
853
- _NSGetExecutablePath ( buffer. baseAddress!, & count)
854
- return Int ( count)
855
- }
856
- args += [ toolPath, " --test-bundle-path " , testPath. pathString]
850
+ let helper = try self . toolchain. getSwiftTestingHelper ( )
851
+ args += [ helper. pathString, " --test-bundle-path " , testPath. pathString]
857
852
}
858
853
args += additionalArguments
859
854
args += [ testPath. pathString]
Original file line number Diff line number Diff line change @@ -387,6 +387,24 @@ public final class UserToolchain: Toolchain {
387
387
)
388
388
}
389
389
390
+ #if os(macOS)
391
+ public func getSwiftTestingHelper( ) throws -> AbsolutePath {
392
+ // The helper would be located in `.build/<config>` directory when
393
+ // SwiftPM is built locally and `usr/libexec/swift/pm` directory in
394
+ // an installed version.
395
+ let binDirectories = self . swiftSDK. toolset. rootPaths +
396
+ self . swiftSDK. toolset. rootPaths. map {
397
+ $0. parentDirectory. appending ( components: [ " libexec " , " swift " , " pm " ] )
398
+ }
399
+
400
+ return try UserToolchain . getTool (
401
+ " swiftpm-testing-helper " ,
402
+ binDirectories: binDirectories,
403
+ fileSystem: self . fileSystem
404
+ )
405
+ }
406
+ #endif
407
+
390
408
internal static func deriveSwiftCFlags(
391
409
triple: Triple ,
392
410
swiftSDK: SwiftSDK ,
You can’t perform that action at this time.
0 commit comments