Skip to content

Disable flaky tests on Windows #1759

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
merged 1 commit into from
Oct 15, 2024
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
2 changes: 1 addition & 1 deletion Sources/SKTestSupport/FindTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ package func findTool(name: String) async -> URL? {
#elseif os(Windows)
var buf = [WCHAR](repeating: 0, count: Int(MAX_PATH))
GetWindowsDirectoryW(&buf, DWORD(MAX_PATH))
var wherePath = String(decodingCString: &buf, as: UTF16.self)
let wherePath = String(decodingCString: &buf, as: UTF16.self)
.appendingPathComponent("system32")
.appendingPathComponent("where.exe")
let cmd = [wherePath, name]
Expand Down
9 changes: 9 additions & 0 deletions Sources/SKTestSupport/SwiftPMTestProject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ package import SKOptions
package import SourceKitLSP
import TSCBasic
import ToolchainRegistry
import XCTest
#else
import Foundation
import LanguageServerProtocol
import SKOptions
import SourceKitLSP
import TSCBasic
import ToolchainRegistry
import XCTest
#endif

private struct SwiftSyntaxCShimsModulemapNotFoundError: Error {}
Expand Down Expand Up @@ -171,6 +173,13 @@ package class SwiftPMTestProject: MultiFileTestProject {
cleanUp: (@Sendable () -> Void)? = nil,
testName: String = #function
) async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
var filesByPath: [RelativeFileLocation: String] = [:]
for (fileLocation, contents) in files {
let directories =
Expand Down
24 changes: 24 additions & 0 deletions Tests/SourceKitLSPTests/BackgroundIndexingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,14 @@ final class BackgroundIndexingTests: XCTestCase {
}

func testPrepareTargetAfterEditToDependency() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif

var testHooks = TestHooks()
let expectedPreparationTracker = ExpectedIndexTaskTracker(expectedPreparations: [
[
Expand Down Expand Up @@ -634,6 +642,14 @@ final class BackgroundIndexingTests: XCTestCase {
}

func testDontStackTargetPreparationForEditorFunctionality() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif

let allDocumentsOpened = WrappedSemaphore(name: "All documents opened")
let libBStartedPreparation = WrappedSemaphore(name: "LibB started preparing")
let libDPreparedForEditing = WrappedSemaphore(name: "LibD prepared for editing")
Expand Down Expand Up @@ -765,6 +781,14 @@ final class BackgroundIndexingTests: XCTestCase {
}

func testIndexingHappensInParallel() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif

let fileAIndexingStarted = WrappedSemaphore(name: "FileA indexing started")
let fileBIndexingStarted = WrappedSemaphore(name: "FileB indexing started")

Expand Down
8 changes: 8 additions & 0 deletions Tests/SourceKitLSPTests/PullDiagnosticsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ final class PullDiagnosticsTests: XCTestCase {
}

func testDontReturnEmptyDiagnosticsIfDiagnosticRequestIsCancelled() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif

let diagnosticRequestCancelled = self.expectation(description: "diagnostic request cancelled")
let packageLoadingDidFinish = self.expectation(description: "Package loading did finish")
var testHooks = TestHooks()
Expand Down
4 changes: 4 additions & 0 deletions Tests/SourceKitLSPTests/ReferencesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import XCTest
/// Tests that test the overall state of the SourceKit-LSP server, that's not really specific to any language
final class ReferencesTests: XCTestCase {
func testReferencesInMacro() async throws {
#if os(Windows)
// FIXME: https://github.com/swiftlang/sourcekit-lsp/issues/1758
try XCTSkipIf(true, "Disabled until https://github.com/swiftlang/sourcekit-lsp/issues/1758 is fixed")
#endif
let project = try await IndexedSingleSwiftFileTestProject(
"""
import Observation
Expand Down
7 changes: 7 additions & 0 deletions Tests/SourceKitLSPTests/SwiftPMIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ final class SwiftPMIntegrationTests: XCTestCase {
}

func testNestedPackage() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
let project = try await MultiFileTestProject(files: [
"pkg/Sources/lib/lib.swift": "",
"pkg/Package.swift": """
Expand Down
7 changes: 7 additions & 0 deletions Tests/SourceKitLSPTests/WorkspaceSymbolsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import XCTest

class WorkspaceSymbolsTests: XCTestCase {
func testWorkspaceSymbolsAcrossPackages() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
let project = try await MultiFileTestProject(
files: [
"packageA/Sources/PackageALib/PackageALib.swift": """
Expand Down
42 changes: 42 additions & 0 deletions Tests/SourceKitLSPTests/WorkspaceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ import XCTest
final class WorkspaceTests: XCTestCase {

func testMultipleSwiftPMWorkspaces() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
// The package manifest is the same for both packages we open.
let packageManifest = """
// swift-tools-version: 5.7
Expand Down Expand Up @@ -159,6 +166,13 @@ final class WorkspaceTests: XCTestCase {
}

func testOpenPackageManifestInMultiSwiftPMWorkspaceSetup() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
let project = try await MultiFileTestProject(
files: [
// PackageA
Expand Down Expand Up @@ -235,6 +249,13 @@ final class WorkspaceTests: XCTestCase {
}

func testSwiftPMPackageInSubfolder() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
let packageManifest = """
// swift-tools-version: 5.7

Expand Down Expand Up @@ -314,6 +335,13 @@ final class WorkspaceTests: XCTestCase {
}

func testNestedSwiftPMWorkspacesWithoutDedicatedWorkspaceFolder() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
// The package manifest is the same for both packages we open.
let packageManifest = """
// swift-tools-version: 5.7
Expand Down Expand Up @@ -496,6 +524,13 @@ final class WorkspaceTests: XCTestCase {
}

func testRecomputeFileWorkspaceMembershipOnPackageSwiftChange() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
let project = try await MultiFileTestProject(
files: [
"PackageA/Sources/MyLibrary/libA.swift": "",
Expand Down Expand Up @@ -625,6 +660,13 @@ final class WorkspaceTests: XCTestCase {
}

func testChangeWorkspaceFolders() async throws {
#if os(Windows)
// FIXME: Enable when https://github.com/swiftlang/swift-package-manager/issues/8038 is fixed
try XCTSkipIf(
true,
"SwiftPM tests fail nondeterministically due to https://github.com/swiftlang/swift-package-manager/issues/8038"
)
#endif
let project = try await MultiFileTestProject(
files: [
"subdir/Sources/otherPackage/otherPackage.swift": """
Expand Down