Skip to content

Commit e509def

Browse files
committed
Revert "Filter superfluous diagnostics"
This reverts commit ac8806f since it is no longer needed with more recent Swift compilers.
1 parent e10ff90 commit e509def

File tree

5 files changed

+2
-32
lines changed

5 files changed

+2
-32
lines changed

Sources/SPMTestSupport/Observability.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@ public struct TestingObservability {
7272

7373
// TODO: do something useful with scope
7474
func handleDiagnostic(scope: ObservabilityScope, diagnostic: Basics.Diagnostic) {
75-
// Filter superfluous diagnostics.
76-
guard !diagnostic.message.hasPrefix("<unknown>:0: warning: annotation implies no releases") else {
77-
return
78-
}
79-
guard !diagnostic.message.hasPrefix("<unknown>:0: note: add explicit") else {
80-
return
81-
}
82-
8375
if self.verbose {
8476
print(diagnostic.description)
8577
}

Sources/SPMTestSupport/Toolchain.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,6 @@ extension UserToolchain {
111111
}
112112
}
113113

114-
// This builds a trivial program with `-warnings-as-errors`, if it fails, the compiler in use generates warnings by default and is not suitable for testing warnings as errors behaviors.
115-
public func supportsWarningsAsErrors() -> Bool {
116-
do {
117-
try testWithTemporaryDirectory { tmpPath in
118-
let inputPath = tmpPath.appending("best.swift")
119-
try localFileSystem.writeFileContents(inputPath, string: "print(\"hello\")")
120-
let outputPath = tmpPath.appending("foo")
121-
let toolchainPath = self.swiftCompilerPath.parentDirectory.parentDirectory
122-
try Process.checkNonZeroExit(arguments: ["/usr/bin/xcrun", "--toolchain", toolchainPath.pathString, "swiftc", inputPath.pathString, "-o", outputPath.pathString, "-warnings-as-errors"])
123-
}
124-
return true
125-
} catch {
126-
return false
127-
}
128-
}
129-
130114
/// Helper function to determine whether we should run SDK-dependent tests.
131115
public func supportsSDKDependentTests() -> Bool {
132116
return ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] == nil

Tests/CommandsTests/PackageToolTests.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,10 +2407,7 @@ final class PackageToolTests: CommandsTestCase {
24072407
do {
24082408
let (stdout, stderr) = try SwiftPM.Package.execute(["plugin", "MyPlugin", "--foo", "--help", "--version", "--verbose"], packagePath: packageDir)
24092409
XCTAssertMatch(stdout, .contains("success"))
2410-
let filteredStderr = stderr.components(separatedBy: "\n").filter {
2411-
!$0.contains("annotation implies no releases") && !$0.contains("note: add explicit")
2412-
}.joined(separator: "\n")
2413-
XCTAssertEqual(filteredStderr, "")
2410+
XCTAssertEqual(stderr, "")
24142411
}
24152412

24162413
// Check default command arguments

Tests/FunctionalTests/MiscellaneousTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ class MiscellaneousTestCase: XCTestCase {
665665
func testRootPackageWithConditionals() throws {
666666
try fixture(name: "Miscellaneous/RootPackageWithConditionals") { path in
667667
let (_, stderr) = try SwiftPM.Build.execute(packagePath: path)
668-
let errors = stderr.components(separatedBy: .newlines).filter { !$0.contains("[logging] misuse") && !$0.contains("annotation implies no releases") && !$0.contains("note: add explicit") && !$0.isEmpty }
668+
let errors = stderr.components(separatedBy: .newlines).filter { !$0.contains("[logging] misuse") && !$0.isEmpty }
669669
XCTAssertEqual(errors, [], "unexpected errors: \(errors)")
670670
}
671671
}

Tests/FunctionalTests/ResourcesTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Basics
14-
import PackageModel
1514
import SPMTestSupport
1615
import XCTest
1716

@@ -101,8 +100,6 @@ class ResourcesTests: XCTestCase {
101100
}
102101

103102
func testSwiftResourceAccessorDoesNotCauseInconsistentImportWarning() throws {
104-
try XCTSkipIf(!UserToolchain.default.supportsWarningsAsErrors(), "skipping because test environment doesn't support warnings as errors")
105-
106103
try fixture(name: "Resources/FoundationlessClient/UtilsWithFoundationPkg") { fixturePath in
107104
XCTAssertBuilds(
108105
fixturePath,

0 commit comments

Comments
 (0)