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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 4 additions & 8 deletions Sources/_InternalTestSupport/XCTAssertHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions Tests/BasicsTests/FileSystem/VFSTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 0 additions & 20 deletions Tests/PackageLoadingTests/PkgConfigParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import struct TSCBasic.ByteString

final class PkgConfigParserTests: XCTestCase {
func testCircularPCFile() throws {
try XCTSkipOnWindows()

let observability = ObservabilitySystem.makeForTesting()

_ = try PkgConfig(
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -248,8 +232,6 @@ final class PkgConfigParserTests: XCTestCase {
}

func testUnevenQuotes() throws {
try XCTSkipOnWindows()

do {
try loadPCFile("quotes_failure.pc")
XCTFail("Unexpected success")
Expand All @@ -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, [
Expand Down
6 changes: 0 additions & 6 deletions Tests/PackageLoadingTests/PkgConfigTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -152,8 +150,6 @@ class PkgConfigTests: XCTestCase {
}

func testExplicitPkgConfigDirectories() throws {
try XCTSkipOnWindows()

// Pc file.
for result in try pkgConfigArgs(
for: SystemLibraryModule(pkgConfig: "Foo"),
Expand Down Expand Up @@ -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(
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 @@ -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()
Expand Down