Skip to content

Commit 1de4680

Browse files
committed
Revert "Add SwiftBuild coverage support (swiftlang#9162)"
This reverts commit acd7b00.
1 parent aa882cf commit 1de4680

File tree

17 files changed

+577
-764
lines changed

17 files changed

+577
-764
lines changed

Fixtures/Coverage/Simple/Package.swift

Lines changed: 0 additions & 26 deletions
This file was deleted.

Fixtures/Coverage/Simple/Sources/Simple/Simple.swift

Lines changed: 0 additions & 10 deletions
This file was deleted.

Fixtures/Coverage/Simple/Tests/SimpleTests/SimpleTests.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

Sources/Commands/SwiftTestCommand.swift

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import ArgumentParser
1414

1515
@_spi(SwiftPMInternal)
1616
import Basics
17-
import struct Basics.Triple
1817

1918
import _Concurrency
2019

@@ -598,11 +597,7 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
598597
for product in testProducts {
599598
// Export the codecov data as JSON.
600599
let jsonPath = productsBuildParameters.codeCovAsJSONPath(packageName: rootManifest.displayName)
601-
try await exportCodeCovAsJSON(
602-
to: jsonPath,
603-
testBinary: product.binaryPath,
604-
swiftCommandState: swiftCommandState,
605-
)
600+
try await exportCodeCovAsJSON(to: jsonPath, testBinary: product.binaryPath, swiftCommandState: swiftCommandState)
606601
}
607602
}
608603

@@ -624,6 +619,7 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
624619
}
625620
}
626621
args += ["-o", productsBuildParameters.codeCovDataFile.pathString]
622+
627623
try await AsyncProcess.checkNonZeroExit(arguments: args)
628624
}
629625

@@ -636,17 +632,11 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
636632
// Export using the llvm-cov tool.
637633
let llvmCov = try swiftCommandState.getTargetToolchain().getLLVMCov()
638634
let (productsBuildParameters, _) = try swiftCommandState.buildParametersForTest(options: self.options)
639-
let archArgs: [String] = if let arch = productsBuildParameters.triple.llvmCovArchArgument {
640-
["--arch", "\(arch)"]
641-
} else {
642-
[]
643-
}
644635
let args = [
645636
llvmCov.pathString,
646637
"export",
647638
"-instr-profile=\(productsBuildParameters.codeCovDataFile)",
648-
] + archArgs + [
649-
testBinary.pathString,
639+
testBinary.pathString
650640
]
651641
let result = try await AsyncProcess.popen(arguments: args)
652642

@@ -719,21 +709,6 @@ extension SwiftTestCommand {
719709
}
720710
}
721711

722-
fileprivate extension Triple {
723-
var llvmCovArchArgument: String? {
724-
guard let arch = self.arch else {
725-
return nil
726-
}
727-
switch arch {
728-
case .aarch64:
729-
// Apple platforms uses arm64
730-
return self.isApple() ? "arm64" : "aarch64"
731-
default:
732-
return "\(arch)"
733-
}
734-
}
735-
}
736-
737712
extension SwiftTestCommand {
738713
struct Last: SwiftCommand {
739714
@OptionGroup(visibility: .hidden)

Sources/SwiftBuildSupport/SwiftBuildSystem.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,9 +1109,8 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
11091109

11101110
private static func constructTestingSettingsOverrides(from parameters: BuildParameters.Testing) -> [String: String] {
11111111
var settings: [String: String] = [:]
1112-
1113-
// Coverage settings
1114-
settings["CLANG_COVERAGE_MAPPING"] = parameters.enableCodeCoverage ? "YES" : "NO"
1112+
// TODO: enableCodeCoverage
1113+
// explicitlyEnabledTestability
11151114

11161115
switch parameters.explicitlyEnabledTestability {
11171116
case true:

Sources/_InternalTestSupport/SwiftTesting+TraitsBug.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ extension Trait where Self == Testing.Bug {
5454
)
5555
}
5656

57-
public static var IssueWindowsPathTestsFailures: Self {
58-
.issue(
59-
"https://github.com/swiftlang/swift-package-manager/issues/8511",
60-
relationship: .defect,
61-
)
62-
}
63-
6457
public static var IssueWindowsCannotSaveAttachment: Self {
6558
// error: unable to write file 'C:\Users\ContainerAdministrator\AppData\Local\Temp\CFamilyTargets_CDynamicLookup.hNxGHC\CFamilyTargets_CDynamicLookup\.build\x86_64-unknown-windows-msvc\Intermediates.noindex\CDynamicLookup.build\Release-windows\CDynamicLookup.build\Objects-normal\x86_64\CDynamicLookup.LinkFileList': No such file or directory (2)
6659
.issue(

Tests/BasicsTests/FileSystem/PathTests.swift

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct PathTests {
4343
}
4444

4545
@Test(
46-
.IssueWindowsPathTestsFailures,
4746
arguments: [
4847
(path: "/ab/cd/ef/", expected: (windows ? #"\ab\cd\ef"# : "/ab/cd/ef"), label: "Trailing path seperator"),
4948
(path: "/ab/cd/ef//", expected: (windows ? #"\ab\cd\ef"# : "/ab/cd/ef"), label: "Trailing path seperator"),
@@ -111,7 +110,6 @@ struct PathTests {
111110
}
112111

113112
@Test(
114-
.IssueWindowsPathTestsFailures,
115113
arguments: [
116114
(path: "/./a", expected: (windows ? #"\"# : "/")),
117115
(path: "/../..", expected: (windows ? #"\"# : "/")),
@@ -145,7 +143,6 @@ struct PathTests {
145143
}
146144

147145
@Test(
148-
.IssueWindowsPathTestsFailures,
149146
arguments: [
150147
(path: "/../..", expected: "/"),
151148
]
@@ -181,7 +178,6 @@ struct PathTests {
181178
}
182179

183180
@Test(
184-
.IssueWindowsPathTestsFailures,
185181
arguments: [
186182
(path: "/../..", expected: "/"),
187183
]
@@ -208,7 +204,6 @@ struct PathTests {
208204
#expect(actual == expectedPath)
209205
}
210206
@Test(
211-
.IssueWindowsPathTestsFailures,
212207
arguments: [
213208
(path: "/", numParentDirectoryCalls: 1, expected: "/"),
214209
(path: "/", numParentDirectoryCalls: 2, expected: "/"),
@@ -220,7 +215,6 @@ struct PathTests {
220215
}
221216

222217
@Test(
223-
.IssueWindowsPathTestsFailures,
224218
arguments: [
225219
(path: "/bar/../foo/..//", numParentDirectoryCalls: 2, expected: "/"),
226220
(path: "/bar/../foo/..//yabba/a/b", numParentDirectoryCalls: 2, expected: "/yabba")
@@ -237,7 +231,6 @@ struct PathTests {
237231
}
238232

239233
@Test(
240-
.IssueWindowsPathTestsFailures,
241234
arguments: [
242235
(path: "/", expected: ["/"]),
243236
(path: "/.", expected: ["/"]),
@@ -375,7 +368,6 @@ struct PathTests {
375368
}
376369

377370
@Test(
378-
.IssueWindowsPathTestsFailures,
379371
arguments: [
380372
(path: "ab//cd//ef", expected: (windows ? #"ab\cd\ef"# : "ab/cd/ef"), label: "repeated path seperators"),
381373
(path: "ab//cd///ef", expected: (windows ? #"ab\cd\ef"# : "ab/cd/ef"), label: "repeated path seperators"),
@@ -448,8 +440,7 @@ struct PathTests {
448440
}
449441

450442
@Test(
451-
.IssueWindowsPathTestsFailures,
452-
arguments: [
443+
arguments: [
453444
(path: "../a/..", expected: "."),
454445
(path: "a/..", expected: "."),
455446
(path: "a/../////../////./////", expected: "."),
@@ -490,7 +481,6 @@ struct PathTests {
490481
}
491482

492483
@Test(
493-
.IssueWindowsPathTestsFailures,
494484
arguments: [
495485
(path: "a/..", expected: "."),
496486
(path: "a/../////../////./////", expected: ".."),
@@ -529,7 +519,6 @@ struct PathTests {
529519
}
530520

531521
@Test(
532-
.IssueWindowsPathTestsFailures,
533522
arguments: [
534523
(path: "../..", expected: ".."),
535524
(path: "../a/..", expected: ".."),
@@ -571,8 +560,7 @@ struct PathTests {
571560
}
572561

573562
@Test(
574-
.IssueWindowsPathTestsFailures,
575-
arguments:[
563+
arguments:[
576564
"a.",
577565
".a",
578566
"",
@@ -613,7 +601,6 @@ struct PathTests {
613601
}
614602

615603
@Test(
616-
.IssueWindowsPathTestsFailures,
617604
arguments: [
618605
(path: "foo/bar/..", expected: ["foo"]),
619606
(path: "bar/../foo", expected: ["foo"]),
@@ -635,22 +622,21 @@ struct PathTests {
635622
}
636623
}
637624

638-
@Test(
639-
.IssueWindowsPathTestsFailures,
640-
)
625+
@Test
641626
func relativePathValidation() throws {
642627
#expect(throws: Never.self) {
643628
try RelativePath(validating: "a/b/c/d")
644629
}
645630

646-
withKnownIssue("https://github.com/swiftlang/swift-package-manager/issues/8511: \\") {
631+
withKnownIssue {
647632
#expect {try RelativePath(validating: "/a/b/d")} throws: { error in
648633
("\(error)" == "invalid relative path '/a/b/d'; relative path should not begin with '/'")
649634
}
650635
} when: {
651636
ProcessInfo.hostOperatingSystem == .windows
652637
}
653638
}
639+
654640
}
655641

656642
@Test

Tests/BasicsTests/HTTPClientTests.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,11 @@ struct HTTPClientTests {
259259
var request = HTTPClient.Request(method: .get, url: "http://test")
260260
request.options.validResponseCodes = [200]
261261

262-
await #expect(throws: HTTPClientError.badResponseStatusCode(statusCode)) {
263-
try await httpClient.execute(request)
262+
do {
263+
let response = try await httpClient.execute(request)
264+
Issue.record("unexpected success \(response)")
265+
} catch {
266+
#expect(error as? HTTPClientError == .badResponseStatusCode(statusCode))
264267
}
265268
}
266269

@@ -404,8 +407,11 @@ struct HTTPClientTests {
404407
var request = HTTPClient.Request(url: "http://test")
405408
request.options.maximumResponseSizeInBytes = 10
406409

407-
await #expect(throws: HTTPClientError.responseTooLarge(maxSize * 2)) {
408-
try await httpClient.execute(request)
410+
do {
411+
let response = try await httpClient.execute(request)
412+
Issue.record("unexpected success \(response)")
413+
} catch {
414+
#expect(error as? HTTPClientError == .responseTooLarge(maxSize * 2))
409415
}
410416
}
411417

Tests/BuildTests/PluginsBuildPlanTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct PluginsBuildPlanTests {
2828
.tags(
2929
.Feature.Command.Build,
3030
),
31-
.IssueWindowsPathTestsFailures, // Fails to build the project to due to incorrect Path handling
31+
.issue("https://github.com/swiftlang/swift-package-manager/issues/8511", relationship: .defect), // Fails to build the project to due to incorrect Path handling
3232
arguments: BuildConfiguration.allCases,
3333
)
3434
func buildToolsDatabasePath(

0 commit comments

Comments
 (0)