diff --git a/Sources/_InternalTestSupport/XCTAssertHelpers.swift b/Sources/_InternalTestSupport/XCTAssertHelpers.swift index b558a0692bf..9e670f242cb 100644 --- a/Sources/_InternalTestSupport/XCTAssertHelpers.swift +++ b/Sources/_InternalTestSupport/XCTAssertHelpers.swift @@ -59,16 +59,12 @@ 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 = "" - } - if (skipPlatformCi || skipSelfHostedCI) { + let failureCause = " because \(reason.description)" + if (skipPlatformCi) { try XCTSkipIfPlatformCI(because: "Test is run in Platform CI. Skipping\(failureCause)", file: file, line: line) + } else if skipSelfHostedCI { try XCTSkipIfselfHostedCI(because: "Test is run in Self hosted CI. Skipping\(failureCause)", file: file, line: line) } else { throw XCTSkip("Skipping test\(failureCause)", file: file, line: line) diff --git a/Tests/BasicsTests/FileSystem/VFSTests.swift b/Tests/BasicsTests/FileSystem/VFSTests.swift index fc251b3b650..0f8b5efac2b 100644 --- a/Tests/BasicsTests/FileSystem/VFSTests.swift +++ b/Tests/BasicsTests/FileSystem/VFSTests.swift @@ -17,8 +17,6 @@ import Testing import struct TSCBasic.ByteString -import _InternalTestSupport // for XCTSkipOnWindows - func testWithTemporaryDirectory( function: StaticString = #function, body: @escaping (AbsolutePath) async throws -> Void diff --git a/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift b/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift index 7858462a026..5ffb2235d8e 100644 --- a/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift +++ b/Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift @@ -166,8 +166,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/PkgConfigParserTests.swift b/Tests/PackageLoadingTests/PkgConfigParserTests.swift index e62bc3ca0c8..cfdad79f4db 100644 --- a/Tests/PackageLoadingTests/PkgConfigParserTests.swift +++ b/Tests/PackageLoadingTests/PkgConfigParserTests.swift @@ -19,8 +19,6 @@ import struct TSCBasic.ByteString final class PkgConfigParserTests: XCTestCase { func testCircularPCFile() throws { - try XCTSkipOnWindows() - let observability = ObservabilitySystem.makeForTesting() _ = try PkgConfig( @@ -36,8 +34,6 @@ final class PkgConfigParserTests: XCTestCase { } func testGTK3PCFile() throws { - try XCTSkipOnWindows() - try! loadPCFile("gtk+-3.0.pc") { parser in XCTAssertEqual(parser.variables, [ "libdir": "/usr/local/Cellar/gtk+3/3.18.9/lib", @@ -58,8 +54,6 @@ final class PkgConfigParserTests: XCTestCase { } func testEmptyCFlags() throws { - try XCTSkipOnWindows() - try! loadPCFile("empty_cflags.pc") { parser in XCTAssertEqual(parser.variables, [ "prefix": "/usr/local/bin", @@ -74,16 +68,12 @@ final class PkgConfigParserTests: XCTestCase { } func testCFlagsCaseInsensitveKeys() throws { - try XCTSkipOnWindows() - try! loadPCFile("case_insensitive.pc") { parser in XCTAssertEqual(parser.cFlags, ["-I/usr/local/include"]) } } func testVariableinDependency() throws { - try XCTSkipOnWindows() - try! loadPCFile("deps_variable.pc") { parser in XCTAssertEqual(parser.variables, [ "prefix": "/usr/local/bin", @@ -108,8 +98,6 @@ final class PkgConfigParserTests: XCTestCase { } func testEscapedSpaces() throws { - try XCTSkipOnWindows() - try! loadPCFile("escaped_spaces.pc") { parser in XCTAssertEqual(parser.variables, [ "prefix": "/usr/local/bin", @@ -125,8 +113,6 @@ final class PkgConfigParserTests: XCTestCase { } func testDummyDependency() throws { - try XCTSkipOnWindows() - try loadPCFile("dummy_dependency.pc") { parser in XCTAssertEqual(parser.variables, [ "prefix": "/usr/local/bin", @@ -213,8 +199,6 @@ final class PkgConfigParserTests: XCTestCase { } func testAbsolutePathDependency() throws { - try XCTSkipOnWindows() - let libffiPath = "/usr/local/opt/libffi/lib/pkgconfig/libffi.pc" try loadPCFile("gobject-2.0.pc") { parser in @@ -248,8 +232,6 @@ final class PkgConfigParserTests: XCTestCase { } func testUnevenQuotes() throws { - try XCTSkipOnWindows() - do { try loadPCFile("quotes_failure.pc") XCTFail("Unexpected success") @@ -259,8 +241,6 @@ final class PkgConfigParserTests: XCTestCase { } func testSysrootDir() throws { - try XCTSkipOnWindows() - // sysroot should be prepended to all path variables, and should therefore appear in cflags and libs. try loadPCFile("gtk+-3.0.pc", sysrootDir: "/opt/sysroot/somewhere") { parser in XCTAssertEqual(parser.variables, [ diff --git a/Tests/PackageLoadingTests/PkgConfigTests.swift b/Tests/PackageLoadingTests/PkgConfigTests.swift index 4cc34895f87..094b485b478 100644 --- a/Tests/PackageLoadingTests/PkgConfigTests.swift +++ b/Tests/PackageLoadingTests/PkgConfigTests.swift @@ -87,8 +87,6 @@ class PkgConfigTests: XCTestCase { } func testEnvVar() throws { - try XCTSkipOnWindows() - // Pc file. try Environment.makeCustom(["PKG_CONFIG_PATH": inputsDir.pathString]) { for result in try pkgConfigArgs( @@ -152,8 +150,6 @@ class PkgConfigTests: XCTestCase { } func testExplicitPkgConfigDirectories() throws { - try XCTSkipOnWindows() - // Pc file. for result in try pkgConfigArgs( for: SystemLibraryModule(pkgConfig: "Foo"), @@ -212,8 +208,6 @@ class PkgConfigTests: XCTestCase { } func testDependencies() throws { - try XCTSkipOnWindows() - // Use additionalSearchPaths instead of pkgConfigArgs to test handling // of search paths when loading dependencies. let result = try PkgConfig( diff --git a/Tests/WorkspaceTests/ManifestSourceGenerationTests.swift b/Tests/WorkspaceTests/ManifestSourceGenerationTests.swift index 0a550e24fe0..514118db55a 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 fcd6809d83b..92aa55dd45d 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 15180376160..23d84f3726b 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() @@ -8039,7 +8025,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()