Skip to content

Commit 85f6dda

Browse files
committed
[Commands] Fix code coverage export
This probably got regressed during the swift-test rework but was caught by the code coverage integration tests in the swift-integration-tests repo. <rdar://problem/59716913>
1 parent 6ff0677 commit 85f6dda

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/Commands/SwiftTestTool.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
309309
let jsonPath = codeCovAsJSONPath(
310310
buildParameters: buildParameters,
311311
packageName: product.packageName)
312-
try exportCodeCovAsJSON(to: jsonPath, testBinary: product.bundlePath)
312+
try exportCodeCovAsJSON(to: jsonPath, testBinary: product.binaryPath)
313313
}
314314
}
315315

@@ -351,6 +351,11 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
351351
testBinary.pathString
352352
]
353353
let result = try Process.popen(arguments: args)
354+
355+
if result.exitStatus != .terminated(code: 0) {
356+
let output = try result.utf8Output() + result.utf8stderrOutput()
357+
throw StringError("Unable to export code coverage:\n \(output)")
358+
}
354359
try localFileSystem.writeFileContents(path, bytes: ByteString(result.output.get()))
355360
}
356361

0 commit comments

Comments
 (0)