From 46f2574b728f47b24f073a10390371d798b069ca Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Wed, 9 Apr 2025 12:12:13 -0700 Subject: [PATCH 1/3] Tests: Minor tweaks in Swift Build related tests --- Tests/BuildTests/BuildPlanTests.swift | 22 ++++-------- Tests/CommandsTests/APIDiffTests.swift | 23 ++++--------- Tests/CommandsTests/BuildCommandTests.swift | 34 ++++++------------- Tests/CommandsTests/PackageCommandTests.swift | 23 ++++--------- Tests/CommandsTests/RunCommandTests.swift | 21 ++++-------- Tests/CommandsTests/TestCommandTests.swift | 22 ++++-------- 6 files changed, 41 insertions(+), 104 deletions(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index 423afcd0e04..3086f593c23 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -6977,23 +6977,15 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { } } -class BuildPlanNativeTests: BuildPlanTestCase { - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .native - } - - override func testDuplicateProductNamesWithNonDefaultLibsThrowError() async throws { - try await super.testDuplicateProductNamesWithNonDefaultLibsThrowError() +final class BuildPlanNativeTests: BuildPlanTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .native } } -class BuildPlanSwiftBuildTests: BuildPlanTestCase { - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .swiftbuild - } - - override func testDuplicateProductNamesWithNonDefaultLibsThrowError() async throws { - try await super.testDuplicateProductNamesWithNonDefaultLibsThrowError() +final class BuildPlanSwiftBuildTests: BuildPlanTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .swiftbuild } override func testTargetsWithPackageAccess() async throws { @@ -7014,8 +7006,6 @@ class BuildPlanSwiftBuildTests: BuildPlanTestCase { throw XCTSkip("Skipping SwiftBuild testing on Amazon Linux because of platform issues.") } #endif - try await super.testPackageNameFlag() } - } diff --git a/Tests/CommandsTests/APIDiffTests.swift b/Tests/CommandsTests/APIDiffTests.swift index b8473e4c253..75062277664 100644 --- a/Tests/CommandsTests/APIDiffTests.swift +++ b/Tests/CommandsTests/APIDiffTests.swift @@ -455,25 +455,14 @@ class APIDiffTestCase: CommandsBuildProviderTestCase { } } -class APIDiffNativeTests: APIDiffTestCase { - - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .native - } - - override func skipIfApiDigesterUnsupportedOrUnset() throws { - try super.skipIfApiDigesterUnsupportedOrUnset() +final class APIDiffNativeTests: APIDiffTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .native } - } -class APIDiffSwiftBuildTests: APIDiffTestCase { - - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .swiftbuild - } - - override func skipIfApiDigesterUnsupportedOrUnset() throws { - try super.skipIfApiDigesterUnsupportedOrUnset() +final class APIDiffSwiftBuildTests: APIDiffTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .swiftbuild } } diff --git a/Tests/CommandsTests/BuildCommandTests.swift b/Tests/CommandsTests/BuildCommandTests.swift index bead37cf431..1dba76bf57a 100644 --- a/Tests/CommandsTests/BuildCommandTests.swift +++ b/Tests/CommandsTests/BuildCommandTests.swift @@ -782,27 +782,17 @@ class BuildCommandTestCases: CommandsBuildProviderTestCase { } - -class BuildCommandNativeTests: BuildCommandTestCases { - - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .native - } - - override func testUsage() async throws { - try await super.testUsage() +final class BuildCommandNativeTests: BuildCommandTestCases { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .native } } #if os(macOS) -// Xcode build system tests can only function on macOS -class BuildCommandXcodeTests: BuildCommandTestCases { - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .xcode - } - - override func testUsage() async throws { - try await super.testUsage() +/// Xcode build system tests can only function on macOS. +final class BuildCommandXcodeTests: BuildCommandTestCases { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .xcode } override func testAutomaticParseableInterfacesWithLibraryEvolution() async throws { @@ -855,10 +845,9 @@ class BuildCommandXcodeTests: BuildCommandTestCases { } #endif -class BuildCommandSwiftBuildTests: BuildCommandTestCases { - - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .swiftbuild +final class BuildCommandSwiftBuildTests: BuildCommandTestCases { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .swiftbuild } override func testNonReachableProductsAndTargetsFunctional() async throws { @@ -892,7 +881,7 @@ class BuildCommandSwiftBuildTests: BuildCommandTestCases { override func testImportOfMissedDepWarning() async throws { throw XCTSkip("SWBINTTODO: Test fails because the warning message regarding missing imports is expected to be more verbose and actionable at the SwiftPM level with mention of the involved targets. This needs to be investigated. See case targetDiagnostic(TargetDiagnosticInfo) as a message type that may help.") } - + override func testProductAndTarget() async throws { throw XCTSkip("SWBINTTODO: Test fails because there isn't a clear warning message about the lib1 being an automatic product and that the default product is being built instead. This needs to be investigated") } @@ -946,5 +935,4 @@ class BuildCommandSwiftBuildTests: BuildCommandTestCases { try await super.testBuildCompleteMessage() #endif } - } diff --git a/Tests/CommandsTests/PackageCommandTests.swift b/Tests/CommandsTests/PackageCommandTests.swift index eb1f658d432..916f01f976a 100644 --- a/Tests/CommandsTests/PackageCommandTests.swift +++ b/Tests/CommandsTests/PackageCommandTests.swift @@ -3836,26 +3836,15 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } } - -class PackageCommandNativeTests: PackageCommandTestCase { - - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .native - } - - override func testNoParameters() async throws { - try await super.testNoParameters() +final class PackageCommandNativeTests: PackageCommandTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .native } } -class PackageCommandSwiftBuildTests: PackageCommandTestCase { - - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .swiftbuild - } - - override func testNoParameters() async throws { - try await super.testNoParameters() +final class PackageCommandSwiftBuildTests: PackageCommandTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .swiftbuild } override func testCommandPluginBuildingCallbacks() async throws { diff --git a/Tests/CommandsTests/RunCommandTests.swift b/Tests/CommandsTests/RunCommandTests.swift index 7516cc41308..54a0350e3b0 100644 --- a/Tests/CommandsTests/RunCommandTests.swift +++ b/Tests/CommandsTests/RunCommandTests.swift @@ -234,24 +234,15 @@ class RunCommandTestCase: CommandsBuildProviderTestCase { } -class RunCommandNativeTests: RunCommandTestCase { - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .native - } - - override func testUsage() async throws { - try await super.testUsage() +final class RunCommandNativeTests: RunCommandTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .native } } - -class RunCommandSwiftBuildTests: RunCommandTestCase { - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .swiftbuild - } - - override func testUsage() async throws { - try await super.testUsage() +final class RunCommandSwiftBuildTests: RunCommandTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .swiftbuild } override func testMultipleExecutableAndExplicitExecutable() async throws { diff --git a/Tests/CommandsTests/TestCommandTests.swift b/Tests/CommandsTests/TestCommandTests.swift index 4e27e48fc68..5cbb4d851f3 100644 --- a/Tests/CommandsTests/TestCommandTests.swift +++ b/Tests/CommandsTests/TestCommandTests.swift @@ -601,27 +601,17 @@ class TestCommandTestCase: CommandsBuildProviderTestCase { } } } - } -class TestCommandNativeTests: TestCommandTestCase { - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .native - } - - override func testUsage() async throws { - try await super.testUsage() +final class TestCommandNativeTests: TestCommandTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .native } } - -class TestCommandSwiftBuildTests: TestCommandTestCase { - override open var buildSystemProvider: BuildSystemProvider.Kind { - return .swiftbuild - } - - override func testUsage() async throws { - try await super.testUsage() +final class TestCommandSwiftBuildTests: TestCommandTestCase { + override public var buildSystemProvider: BuildSystemProvider.Kind { + .swiftbuild } override func testFatalErrorDisplayedCorrectNumberOfTimesWhenSingleXCTestHasFatalErrorInBuildCompilation() async throws { From 32944d85fd48332fc1118c285c287653e9b46340 Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Sat, 12 Apr 2025 00:54:49 -0700 Subject: [PATCH 2/3] Fix CI build error in RegistryClientTests.swift --- Tests/PackageRegistryTests/RegistryClientTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/PackageRegistryTests/RegistryClientTests.swift b/Tests/PackageRegistryTests/RegistryClientTests.swift index b8390c1900f..809fdf32b89 100644 --- a/Tests/PackageRegistryTests/RegistryClientTests.swift +++ b/Tests/PackageRegistryTests/RegistryClientTests.swift @@ -803,7 +803,7 @@ final class RegistryClientTests: XCTestCase { let availableManifests = try await registryClient.getAvailableManifests( package: identity, version: version, - observabilityScope: ObservabilitySystem.NOOP, + observabilityScope: ObservabilitySystem.NOOP ) XCTAssertEqual(availableManifests["Package.swift"]?.toolsVersion, .v5_5) @@ -3987,7 +3987,7 @@ extension RegistryClient { package: package.underlying, version: version, fileSystem: InMemoryFileSystem(), - observabilityScope: ObservabilitySystem.NOOP, + observabilityScope: ObservabilitySystem.NOOP ) } From c47a96b356ac2d08e97c2f28829c2d5d445dbb23 Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Sat, 12 Apr 2025 16:42:01 -0700 Subject: [PATCH 3/3] Fix CI build error in IntegrationTests/BasicTests.swift --- IntegrationTests/Tests/IntegrationTests/BasicTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IntegrationTests/Tests/IntegrationTests/BasicTests.swift b/IntegrationTests/Tests/IntegrationTests/BasicTests.swift index f02fd1faa69..91d6abd483a 100644 --- a/IntegrationTests/Tests/IntegrationTests/BasicTests.swift +++ b/IntegrationTests/Tests/IntegrationTests/BasicTests.swift @@ -94,7 +94,7 @@ private struct BasicTests { } @Test( - .skipHostOS(.windows, "'try!' expression unexpectedly raised an error: TSCBasic.Process.Error.missingExecutableProgram(program: \"which\")"), + .skipHostOS(.windows, "'try!' expression unexpectedly raised an error: TSCBasic.Process.Error.missingExecutableProgram(program: \"which\")") ) func testSwiftCompiler() throws { try withTemporaryDirectory { tempDir in