Skip to content

Commit a99919e

Browse files
committed
More fixes to test path recording
1 parent 48415d5 commit a99919e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Sources/SPMBuildCore/BuildParameters/BuildParameters.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ public struct BuildParameters: Encodable {
327327
let base = "\(product.name).xctest"
328328
return try RelativePath(validating: "\(base)/Contents/MacOS/\(product.name)")
329329
} else {
330-
let base = "\(product.name)-test-runner"
330+
var base = "\(product.name)-test-runner"
331+
let ext = self.triple.executableExtension
332+
if !ext.isEmpty {
333+
base += ".\(ext)"
334+
}
331335
return try RelativePath(validating: base)
332336
}
333337
}

Sources/SPMBuildCore/BuiltTestProduct.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public struct BuiltTestProduct: Codable {
2828
/// When the test product is not bundled (for instance, when using XCTest on
2929
/// non-Darwin targets), this path is equal to ``binaryPath``.
3030
public var bundlePath: AbsolutePath {
31+
// If the binary path is a test runner binary, return it as-is.
32+
guard !binaryPath.basenameWithoutExt.hasSuffix("test-runner") else {
33+
return binaryPath
34+
}
3135
// Go up the folder hierarchy until we find the .xctest bundle.
3236
let pathExtension = ".xctest"
3337
let hierarchySequence = sequence(first: binaryPath, next: { $0.isRoot ? nil : $0.parentDirectory })

0 commit comments

Comments
 (0)