Skip to content

Test: Enable additional tests on Windows #8616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions Sources/_InternalTestSupport/XCTAssertHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
81 changes: 81 additions & 0 deletions Tests/CommandsTests/PackageCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down
13 changes: 9 additions & 4 deletions Tests/CommandsTests/RunCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
}
}

Expand Down
3 changes: 2 additions & 1 deletion Tests/CommandsTests/TestCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct PackageDescription6_2LoadingTests {
results.checkIsEmpty()
}
} when: {
isWindows
isWindows && !CiEnvironment.runningInSmokeTestPipeline
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/WorkspaceTests/ManifestSourceGenerationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions Tests/WorkspaceTests/RegistryPackageContainerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 1 addition & 15 deletions Tests/WorkspaceTests/WorkspaceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down