Skip to content

Commit 37df8b7

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

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
@@ -134,22 +134,6 @@ extension UserToolchain {
134134
}
135135
}
136136

137-
// 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.
138-
public func supportsWarningsAsErrors() -> Bool {
139-
do {
140-
try testWithTemporaryDirectory { tmpPath in
141-
let inputPath = tmpPath.appending("best.swift")
142-
try localFileSystem.writeFileContents(inputPath, string: "print(\"hello\")")
143-
let outputPath = tmpPath.appending("foo")
144-
let toolchainPath = self.swiftCompilerPath.parentDirectory.parentDirectory
145-
try Process.checkNonZeroExit(arguments: ["/usr/bin/xcrun", "--toolchain", toolchainPath.pathString, "swiftc", inputPath.pathString, "-o", outputPath.pathString, "-warnings-as-errors"])
146-
}
147-
return true
148-
} catch {
149-
return false
150-
}
151-
}
152-
153137
/// Helper function to determine whether we should run SDK-dependent tests.
154138
public func supportsSDKDependentTests() -> Bool {
155139
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
@@ -2338,10 +2338,7 @@ final class PackageToolTests: CommandsTestCase {
23382338
do {
23392339
let (stdout, stderr) = try SwiftPM.Package.execute(["plugin", "MyPlugin", "--foo", "--help", "--version", "--verbose"], packagePath: packageDir)
23402340
XCTAssertMatch(stdout, .contains("success"))
2341-
let filteredStderr = stderr.components(separatedBy: "\n").filter {
2342-
!$0.contains("annotation implies no releases") && !$0.contains("note: add explicit")
2343-
}.joined(separator: "\n")
2344-
XCTAssertEqual(filteredStderr, "")
2341+
XCTAssertEqual(stderr, "")
23452342
}
23462343

23472344
// Check default command arguments

Tests/FunctionalTests/MiscellaneousTests.swift

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

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)