diff --git a/Sources/_InternalTestSupport/XCTAssertHelpers.swift b/Sources/_InternalTestSupport/XCTAssertHelpers.swift index 58a47f7fc43..5fbcdc74875 100644 --- a/Sources/_InternalTestSupport/XCTAssertHelpers.swift +++ b/Sources/_InternalTestSupport/XCTAssertHelpers.swift @@ -61,20 +61,13 @@ public func XCTSkipIfselfHostedCI(because reason: String, file: StaticString = # } } -public func XCTSkipOnWindows(because reason: String? = nil, skipPlatformCi: Bool = false, skipSelfHostedCI: Bool = false , file: StaticString = #filePath, line: UInt = #line) throws { +public func XCTSkipOnWindows(because reason: String, skipPlatformCi: Bool = false, skipSelfHostedCI: Bool = false , file: StaticString = #filePath, line: UInt = #line) throws { #if os(Windows) - let failureCause: String - if let reason { - failureCause = " because \(reason.description)" - } else { - failureCause = "" - } + let failureCause = "Skipping because \(reason.description)" if (skipPlatformCi) { - try XCTSkipIfPlatformCI(because: "Test is run in Platform CI. Skipping\(failureCause)", file: file, line: line) - } - - if (skipSelfHostedCI) { - try XCTSkipIfselfHostedCI(because: "Test is run in Self hosted CI. Skipping\(failureCause)", file: file, line: line) + try XCTSkipIfPlatformCI(because: "Test is run in Platform CI. \(failureCause)", file: file, line: line) + } else if skipSelfHostedCI { + try XCTSkipIfselfHostedCI(because: "Test is run in Self hosted CI. \(failureCause)", file: file, line: line) } if (!skipPlatformCi && !skipSelfHostedCI) { diff --git a/Tests/CommandsTests/PackageCommandTests.swift b/Tests/CommandsTests/PackageCommandTests.swift index 70c5b6767e8..8469e246e44 100644 --- a/Tests/CommandsTests/PackageCommandTests.swift +++ b/Tests/CommandsTests/PackageCommandTests.swift @@ -4411,6 +4411,15 @@ class PackageCommandNativeTests: PackageCommandTestCase { override func testNoParameters() async throws { try await super.testNoParameters() } + + override func testMigrateCommandWhenDependencyBuildsForHostAndTarget() async throws { + try XCTSkipOnWindows( + because: "error: build planning stopped due to build-tool plugin failures", + skipPlatformCi: true, + ) + + try await super.testMigrateCommandWhenDependencyBuildsForHostAndTarget() + } } class PackageCommandSwiftBuildTests: PackageCommandTestCase { @@ -4423,6 +4432,78 @@ class PackageCommandSwiftBuildTests: PackageCommandTestCase { try await super.testNoParameters() } + override func testMigrateCommand() async throws { + try XCTSkipOnWindows( + because: """ + Possibly https://github.com/swiftlang/swift-package-manager/issues/8602: + error: Could not choose a single platform for target 'AllIncludingTests' from the supported platforms 'android qnx webassembly'. Specialization parameters imposed by workspace: platform 'nil' sdkVariant 'nil' supportedPlatforms: 'nil' toolchain: 'nil' + """, + skipPlatformCi: true, + ) + + try await super.testMigrateCommand() + } + + override func testMigrateCommandUpdateManifest2Targets() async throws { + try XCTSkipOnWindows( + because: """ + Possibly https://github.com/swiftlang/swift-package-manager/issues/8602: + error: Could not choose a single platform for target 'A' from the supported platforms 'android qnx webassembly'. Specialization parameters imposed by workspace: platform 'nil' sdkVariant 'nil' supportedPlatforms: 'nil' toolchain: 'nil' + """, + skipPlatformCi: true, + ) + + try await super.testMigrateCommandUpdateManifest2Targets() + } + + override func testMigrateCommandUpdateManifestSingleTarget() async throws { + try XCTSkipOnWindows( + because: """ + Possibly https://github.com/swiftlang/swift-package-manager/issues/8602: + error: Could not choose a single platform for target 'A' from the supported platforms 'android qnx webassembly'. Specialization parameters imposed by workspace: platform 'nil' sdkVariant 'nil' supportedPlatforms: 'nil' toolchain: 'nil' + """, + skipPlatformCi: true, + ) + + try await super.testMigrateCommandUpdateManifestSingleTarget() + } + + override func testMigrateCommandUpdateManifestWithErrors() async throws { + try XCTSkipOnWindows( + because: """ + Possibly https://github.com/swiftlang/swift-package-manager/issues/8602: + error: Could not choose a single platform for target 'A' from the supported platforms 'android qnx webassembly'. Specialization parameters imposed by workspace: platform 'nil' sdkVariant 'nil' supportedPlatforms: 'nil' toolchain: 'nil' + """, + skipPlatformCi: true, + ) + + try await super.testMigrateCommandUpdateManifestWithErrors() + } + + override func testMigrateCommandWhenDependencyBuildsForHostAndTarget() async throws { + try XCTSkipOnWindows( + because: """ + Possibly https://github.com/swiftlang/swift-package-manager/issues/8602: + error: Could not choose a single platform for target 'A' from the supported platforms 'android qnx webassembly'. Specialization parameters imposed by workspace: platform 'nil' sdkVariant 'nil' supportedPlatforms: 'nil' toolchain: 'nil' + """, + skipPlatformCi: true, + ) + + try await super.testMigrateCommandWhenDependencyBuildsForHostAndTarget() + } + + override func testMigrateCommandWithBuildToolPlugins() async throws { + try XCTSkipOnWindows( + because: """ + Possibly https://github.com/swiftlang/swift-package-manager/issues/8602: + error: Could not choose a single platform for target 'A' from the supported platforms 'android qnx webassembly'. Specialization parameters imposed by workspace: platform 'nil' sdkVariant 'nil' supportedPlatforms: 'nil' toolchain: 'nil' + """, + skipPlatformCi: true, + ) + + try await super.testMigrateCommandWithBuildToolPlugins() + } + override func testCommandPluginSymbolGraphCallbacks() async throws { try XCTSkipOnWindows(because: "TSCBasic/Path.swift:969: Assertion failed, https://github.com/swiftlang/swift-package-manager/issues/8602") try await super.testCommandPluginSymbolGraphCallbacks() diff --git a/Tests/CommandsTests/RunCommandTests.swift b/Tests/CommandsTests/RunCommandTests.swift index 33c66cc1300..58d24bc7a97 100644 --- a/Tests/CommandsTests/RunCommandTests.swift +++ b/Tests/CommandsTests/RunCommandTests.swift @@ -399,7 +399,9 @@ struct RunCommandTests { } @Test( - .bug("https://github.com/swiftlang/swift-package-manager/issues/8844"), + .issue("https://github.com/swiftlang/swift-package-manager/issues/8844", relationship: .verifies), + .issue("https://github.com/swiftlang/swift-package-manager/issues/8911", relationship: .defect), + .issue("https://github.com/swiftlang/swift-package-manager/issues/8912", relationship: .defect), arguments: SupportedBuildSystemOnPlatform, BuildConfiguration.allCases ) func swiftRunQuietLogLevel( @@ -423,9 +425,12 @@ struct RunCommandTests { #expect(stdout == "done\n") } } when: { - ProcessInfo.hostOperatingSystem == .linux && - buildSystem == .swiftbuild && - CiEnvironment.runningInSelfHostedPipeline + ( + ProcessInfo.hostOperatingSystem == .linux && + buildSystem == .swiftbuild && + CiEnvironment.runningInSelfHostedPipeline + ) + || (CiEnvironment.runningInSmokeTestPipeline && ProcessInfo.hostOperatingSystem == .windows) } } diff --git a/Tests/CommandsTests/TestCommandTests.swift b/Tests/CommandsTests/TestCommandTests.swift index c8cb6840747..dadf7dc3282 100644 --- a/Tests/CommandsTests/TestCommandTests.swift +++ b/Tests/CommandsTests/TestCommandTests.swift @@ -243,7 +243,8 @@ struct TestCommandTests { } } when: { (buildSystem == .swiftbuild && .linux == ProcessInfo.hostOperatingSystem) - || (buildSystem == .swiftbuild && .windows == ProcessInfo.hostOperatingSystem && CiEnvironment.runningInSelfHostedPipeline) + // || (buildSystem == .swiftbuild && .windows == ProcessInfo.hostOperatingSystem && CiEnvironment.runningInSelfHostedPipeline) + || (buildSystem == .swiftbuild && .windows == ProcessInfo.hostOperatingSystem ) } } diff --git a/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift b/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift index 66c98c79c27..179685e17c5 100644 --- a/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift +++ b/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift @@ -167,8 +167,6 @@ final class PackageGraphPerfTests: XCTestCasePerf { } func testRecursiveDependencies() throws { - try XCTSkipOnWindows() - var resolvedTarget = ResolvedModule.mock(packageIdentity: "pkg", name: "t0") for i in 1..<1000 { resolvedTarget = ResolvedModule.mock(packageIdentity: "pkg", name: "t\(i)", deps: resolvedTarget) diff --git a/Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift b/Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift index 00fedd695f5..19ddde7e991 100644 --- a/Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift +++ b/Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift @@ -86,7 +86,7 @@ struct PackageDescription6_2LoadingTests { results.checkIsEmpty() } } when: { - isWindows + isWindows && !CiEnvironment.runningInSmokeTestPipeline } } } diff --git a/Tests/WorkspaceTests/ManifestSourceGenerationTests.swift b/Tests/WorkspaceTests/ManifestSourceGenerationTests.swift index 18e5ccfab44..f14e60b990c 100644 --- a/Tests/WorkspaceTests/ManifestSourceGenerationTests.swift +++ b/Tests/WorkspaceTests/ManifestSourceGenerationTests.swift @@ -233,7 +233,7 @@ final class ManifestSourceGenerationTests: XCTestCase { } func testAdvancedFeatures() async throws { - try XCTSkipOnWindows() + try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8602: TSCBasic/Path.swift:969: Assertion failed") let manifestContents = """ // swift-tools-version:5.3 diff --git a/Tests/WorkspaceTests/RegistryPackageContainerTests.swift b/Tests/WorkspaceTests/RegistryPackageContainerTests.swift index d7eb6a20461..5a1595a53be 100644 --- a/Tests/WorkspaceTests/RegistryPackageContainerTests.swift +++ b/Tests/WorkspaceTests/RegistryPackageContainerTests.swift @@ -24,11 +24,6 @@ import XCTest import struct TSCUtility.Version final class RegistryPackageContainerTests: XCTestCase { - - override func setUpWithError() throws { - try XCTSkipOnWindows() - } - func testToolsVersionCompatibleVersions() async throws { let fs = InMemoryFileSystem() try fs.createMockToolchain() diff --git a/Tests/WorkspaceTests/WorkspaceTests.swift b/Tests/WorkspaceTests/WorkspaceTests.swift index 667d61aee2f..571b91683ac 100644 --- a/Tests/WorkspaceTests/WorkspaceTests.swift +++ b/Tests/WorkspaceTests/WorkspaceTests.swift @@ -28,20 +28,6 @@ import struct TSCBasic.ByteString import struct TSCUtility.Version final class WorkspaceTests: XCTestCase { - // override func setUpWithError() throws { - // let windowsPassingTests = [ - // #selector(self.testBinaryArtifactsInvalidPath), - // #selector(self.testManifestLoaderDiagnostics), - // #selector(self.testInterpreterFlags), - // #selector(self.testManifestParseError), - // #selector(self.testSimpleAPI) - // ] - // let matches = windowsPassingTests.filter { $0 == self.invocation?.selector} - // if matches.count == 0 { - // try XCTSkipOnWindows() - // } - // } - func testBasics() async throws { let sandbox = AbsolutePath("/tmp/ws/") let fs = InMemoryFileSystem() @@ -8036,7 +8022,7 @@ final class WorkspaceTests: XCTestCase { func testArtifactChecksum() async throws { try XCTSkipOnWindows(because: #""" - threw error "\tmp\ws doesn't exist in file system" because there is an issue with InMemoryFileSystem readFileContents(...) on Windows + https://github.com/swiftlang/swift-package-manager/issues/8615: threw error "\tmp\ws doesn't exist in file system" because there is an issue with InMemoryFileSystem readFileContents(...) on Windows """#) let fs = InMemoryFileSystem()