Skip to content

Disable some tests when running on Windows platform smoke test #8759

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

Merged
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
9 changes: 7 additions & 2 deletions Sources/_InternalTestSupport/XCTAssertHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ public func XCTSkipOnWindows(because reason: String? = nil, skipPlatformCi: Bool
} else {
failureCause = ""
}
if (skipPlatformCi || skipSelfHostedCI) {
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)
} else {
}

if (!skipPlatformCi && !skipSelfHostedCI) {
throw XCTSkip("Skipping test\(failureCause)", file: file, line: line)
}
#endif
Expand Down
54 changes: 54 additions & 0 deletions Tests/CommandsTests/RunCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ class RunCommandTestCase: CommandsBuildProviderTestCase {
}

func testUnknownProductAndArgumentPassing() async throws {
try XCTSkipOnWindows(
because: """
Invalid absolute path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Miscellaneous/EchoExecutable") { fixturePath in
let (stdout, stderr) = try await execute(
["secho", "1", "--hello", "world"], packagePath: fixturePath)
Expand Down Expand Up @@ -115,6 +121,12 @@ class RunCommandTestCase: CommandsBuildProviderTestCase {
}

func testUnreachableExecutable() async throws {
try XCTSkipOnWindows(
because: """
Invalid absolute path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Miscellaneous/UnreachableTargets") { fixturePath in
let (output, _) = try await execute(["bexec"], packagePath: fixturePath.appending("A"))
let outputLines = output.split(whereSeparator: { $0.isNewline })
Expand Down Expand Up @@ -246,6 +258,48 @@ class RunCommandNativeTests: RunCommandTestCase {
override func testUsage() async throws {
try await super.testUsage()
}

override func testUnknownProductAndArgumentPassing() async throws {
try XCTSkipOnWindows(
because: """
Invalid absolute path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await super.testUnknownProductAndArgumentPassing()
}

override func testToolsetDebugger() async throws {
try XCTSkipOnWindows(
because: """
Invalid absolute path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await super.testToolsetDebugger()
}


override func testUnreachableExecutable() async throws {
try XCTSkipOnWindows(
because: """
Invalid absolute path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await super.testUnreachableExecutable()
}

override func testMultipleExecutableAndExplicitExecutable() async throws {
try XCTSkipOnWindows(
because: """
Invalid absolute path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await super.testMultipleExecutableAndExplicitExecutable()
}

}


Expand Down
20 changes: 17 additions & 3 deletions Tests/FunctionalTests/MiscellaneousTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,11 @@ final class MiscellaneousTestCase: XCTestCase {

func testEditModeEndToEnd() async throws {
try await fixture(name: "Miscellaneous/Edit") { fixturePath in
#if os(Windows)
let prefix = fixturePath
#else
let prefix = try resolveSymlinks(fixturePath)
#endif
let appPath = fixturePath.appending("App")

// prepare the dependencies as git repos
Expand All @@ -487,8 +491,12 @@ final class MiscellaneousTestCase: XCTestCase {
// make sure it builds
let output = try await executeSwiftBuild(appPath)
// package resolution output goes to stderr
XCTAssertMatch(output.stderr, .contains("Fetching \(prefix.appending("Foo"))"))
XCTAssertMatch(output.stderr, .contains("Creating working copy for \(prefix.appending("Foo"))"))
XCTAssertMatch(output.stderr, .contains("Fetching \(prefix.appending("Foo").pathString)"))
XCTAssertMatch(output.stderr, .contains("Fetched \(prefix.appending("Foo").pathString)"))
XCTAssertMatch(output.stderr, .contains("Creating working copy for \(prefix.appending("Foo").pathString)"))
XCTAssertMatch(output.stderr, .contains("Fetching \(prefix.appending("Bar").pathString)"))
XCTAssertMatch(output.stderr, .contains("Fetched \(prefix.appending("Bar").pathString)"))
XCTAssertMatch(output.stderr, .contains("Creating working copy for \(prefix.appending("Bar").pathString)"))
// in "swift build" build output goes to stdout
XCTAssertMatch(output.stdout, .contains("Build complete!"))
}
Expand Down Expand Up @@ -597,6 +605,12 @@ final class MiscellaneousTestCase: XCTestCase {
func testPluginGeneratedResources() async throws {
// Only run the test if the environment in which we're running actually supports Swift concurrency (which the plugin APIs require).
try XCTSkipIf(!UserToolchain.default.supportsSwiftConcurrency(), "skipping because test environment doesn't support concurrency")
try XCTSkipOnWindows(
because: """
Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)

try await fixture(name: "Miscellaneous/PluginGeneratedResources") { path in
let result = try await SwiftPM.Run.execute(packagePath: path)
Expand All @@ -610,7 +624,7 @@ final class MiscellaneousTestCase: XCTestCase {
await XCTAssertBuilds(fixturePath)
}
}

func testNoJSONOutputWithFlatPackageStructure() async throws {
try await fixture(name: "Miscellaneous/FlatPackage") { package in
// First build, make sure we got the `.build` directory where we expect it, and that there is no JSON output (by looking for known output).
Expand Down
7 changes: 7 additions & 0 deletions Tests/FunctionalTests/ResourcesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import XCTest

final class ResourcesTests: XCTestCase {
func testSimpleResources() async throws {
try XCTSkipOnWindows(
because: """
Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)

try await fixture(name: "Resources/Simple") { fixturePath in
var executables = ["SwiftyResource"]

Expand Down
57 changes: 57 additions & 0 deletions Tests/FunctionalTests/TraitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import XCTest

final class TraitTests: XCTestCase {
func testTraits_whenNoFlagPassed() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand All @@ -40,6 +46,12 @@ final class TraitTests: XCTestCase {
}

func testTraits_whenTraitUnification() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand All @@ -66,6 +78,12 @@ final class TraitTests: XCTestCase {
}

func testTraits_whenTraitUnification_whenSecondTraitNotEnabled() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand All @@ -90,6 +108,12 @@ final class TraitTests: XCTestCase {
}

func testTraits_whenIndividualTraitsEnabled_andDefaultTraits() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand Down Expand Up @@ -119,6 +143,13 @@ final class TraitTests: XCTestCase {
}

func testTraits_whenDefaultTraitsDisabled() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)

try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand All @@ -137,6 +168,12 @@ final class TraitTests: XCTestCase {
}

func testTraits_whenIndividualTraitsEnabled_andDefaultTraitsDisabled() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand All @@ -158,6 +195,13 @@ final class TraitTests: XCTestCase {
}

func testTraits_whenAllTraitsEnabled() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)

try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand Down Expand Up @@ -187,6 +231,13 @@ final class TraitTests: XCTestCase {
}

func testTraits_whenAllTraitsEnabled_andDefaultTraitsDisabled() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)

try await fixture(name: "Traits") { fixturePath in
let (stdout, stderr) = try await executeSwiftRun(
fixturePath.appending("Example"),
Expand Down Expand Up @@ -231,6 +282,12 @@ final class TraitTests: XCTestCase {
}

func testTests_whenNoFlagPassed() async throws {
try XCTSkipOnWindows(
because: """
Error during swift Run Invalid path. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511 or https://github.com/swiftlang/swift-package-manager/issues/8602
""",
skipPlatformCi: true,
)
try await fixture(name: "Traits") { fixturePath in
let (stdout, _) = try await executeSwiftTest(
fixturePath.appending("Example"),
Expand Down
32 changes: 19 additions & 13 deletions Tests/WorkspaceTests/ManifestSourceGenerationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ final class ManifestSourceGenerationTests: XCTestCase {
toolsVersion: ToolsVersion,
toolsVersionHeaderComment: String? = .none,
additionalImportModuleNames: [String] = [],
fs: FileSystem = localFileSystem
fs: FileSystem = localFileSystem,
file: StaticString = #file,
line: UInt = #line,
) async throws -> String {
try await withTemporaryDirectory { packageDir in
let observability = ObservabilitySystem.makeForTesting()
Expand Down Expand Up @@ -98,18 +100,18 @@ final class ManifestSourceGenerationTests: XCTestCase {

// Check that all the relevant properties survived.
let failureDetails = "\n--- ORIGINAL MANIFEST CONTENTS ---\n" + manifestContents + "\n--- REWRITTEN MANIFEST CONTENTS ---\n" + newContents
XCTAssertEqual(newManifest.toolsVersion, manifest.toolsVersion, failureDetails)
XCTAssertEqual(newManifest.displayName, manifest.displayName, failureDetails)
XCTAssertEqual(newManifest.defaultLocalization, manifest.defaultLocalization, failureDetails)
XCTAssertEqual(newManifest.platforms, manifest.platforms, failureDetails)
XCTAssertEqual(newManifest.pkgConfig, manifest.pkgConfig, failureDetails)
XCTAssertEqual(newManifest.providers, manifest.providers, failureDetails)
XCTAssertEqual(newManifest.products, manifest.products, failureDetails)
XCTAssertEqual(newManifest.dependencies, manifest.dependencies, failureDetails)
XCTAssertEqual(newManifest.targets, manifest.targets, failureDetails)
XCTAssertEqual(newManifest.swiftLanguageVersions, manifest.swiftLanguageVersions, failureDetails)
XCTAssertEqual(newManifest.cLanguageStandard, manifest.cLanguageStandard, failureDetails)
XCTAssertEqual(newManifest.cxxLanguageStandard, manifest.cxxLanguageStandard, failureDetails)
XCTAssertEqual(newManifest.toolsVersion, manifest.toolsVersion, "toolsVersion not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.displayName, manifest.displayName, "displayName not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.defaultLocalization, manifest.defaultLocalization, "defaultLocalization not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.platforms, manifest.platforms, "platforms not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.pkgConfig, manifest.pkgConfig, "pkgConfig not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.providers, manifest.providers, "providers not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.products, manifest.products, "products not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.dependencies, manifest.dependencies, "dependencies not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.targets, manifest.targets, "targets not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.swiftLanguageVersions, manifest.swiftLanguageVersions, "swiftLanguageVersions not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.cLanguageStandard, manifest.cLanguageStandard, "cLanguageStandard not as expected" + failureDetails, file: file, line: line)
XCTAssertEqual(newManifest.cxxLanguageStandard, manifest.cxxLanguageStandard, "cxxLanguageStandard not as expected" + failureDetails, file: file, line: line)

// Return the generated manifest so that the caller can do further testing on it.
return newContents
Expand Down Expand Up @@ -282,6 +284,10 @@ final class ManifestSourceGenerationTests: XCTestCase {
}

func testPackageDependencyVariations() async throws {
try XCTSkipOnWindows(
because:"Intermittently fails",
skipPlatformCi: true,
)
let manifestContents = """
// swift-tools-version:5.4
import PackageDescription
Expand Down