Skip to content

Commit 678f079

Browse files
neonichuMaxDesiatov
authored andcommitted
Do not process code coverage when tests failed (#6894)
This can currently lead to bogus output like ``` error: terminated(1): /Users/neonacho/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata merge -sparse -o /Users/neonacho/Desktop/lunch7/.build/arm64-apple-macosx/debug/codecov/default.profdata output: error: no input files specified. See llvm-profdata merge -help ``` I would also think even if it succeeded, it could result in incorrect data. rdar://115436056
1 parent 10d52d4 commit 678f079

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Commands/SwiftTestTool.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public struct SwiftTestTool: SwiftCommand {
296296
swiftTool.executionStatus = .failure
297297
}
298298

299-
if self.options.enableCodeCoverage {
299+
if self.options.enableCodeCoverage, ranSuccessfully {
300300
try processCodeCoverage(testProducts, swiftTool: swiftTool)
301301
}
302302

@@ -355,7 +355,7 @@ public struct SwiftTestTool: SwiftCommand {
355355
}
356356

357357
// process code Coverage if request
358-
if self.options.enableCodeCoverage {
358+
if self.options.enableCodeCoverage, runner.ranSuccessfully {
359359
try processCodeCoverage(testProducts, swiftTool: swiftTool)
360360
}
361361

0 commit comments

Comments
 (0)