Skip to content

Commit f4638e3

Browse files
committed
Test: Enable additional tests on Windows
Enabled additional tests on Windows Since all tests on Windows are either enabled, or are skipped with an associated GitHub issue, update the XCTSkipOnWindows(...) helper API to require providing a reson as to why the test is being skipped. Fixes: #8433 Issue: rdar://148248105
1 parent 2b0505e commit f4638e3

File tree

8 files changed

+6
-59
lines changed

8 files changed

+6
-59
lines changed

Sources/_InternalTestSupport/XCTAssertHelpers.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,12 @@ public func XCTSkipIfselfHostedCI(because reason: String, file: StaticString = #
5959
}
6060
}
6161

62-
public func XCTSkipOnWindows(because reason: String? = nil, skipPlatformCi: Bool = false, skipSelfHostedCI: Bool = false , file: StaticString = #filePath, line: UInt = #line) throws {
62+
public func XCTSkipOnWindows(because reason: String, skipPlatformCi: Bool = false, skipSelfHostedCI: Bool = false , file: StaticString = #filePath, line: UInt = #line) throws {
6363
#if os(Windows)
64-
let failureCause: String
65-
if let reason {
66-
failureCause = " because \(reason.description)"
67-
} else {
68-
failureCause = ""
69-
}
70-
if (skipPlatformCi || skipSelfHostedCI) {
64+
let failureCause = " because \(reason.description)"
65+
if (skipPlatformCi) {
7166
try XCTSkipIfPlatformCI(because: "Test is run in Platform CI. Skipping\(failureCause)", file: file, line: line)
67+
} else if skipSelfHostedCI {
7268
try XCTSkipIfselfHostedCI(because: "Test is run in Self hosted CI. Skipping\(failureCause)", file: file, line: line)
7369
} else {
7470
throw XCTSkip("Skipping test\(failureCause)", file: file, line: line)

Tests/BasicsTests/FileSystem/VFSTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import Testing
1717

1818
import struct TSCBasic.ByteString
1919

20-
import _InternalTestSupport // for XCTSkipOnWindows
21-
2220
func testWithTemporaryDirectory(
2321
function: StaticString = #function,
2422
body: @escaping (AbsolutePath) async throws -> Void

Tests/PackageGraphPerformanceTests/PackageGraphPerfTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ final class PackageGraphPerfTests: XCTestCasePerf {
166166
}
167167

168168
func testRecursiveDependencies() throws {
169-
try XCTSkipOnWindows()
170-
171169
var resolvedTarget = ResolvedModule.mock(packageIdentity: "pkg", name: "t0")
172170
for i in 1..<1000 {
173171
resolvedTarget = ResolvedModule.mock(packageIdentity: "pkg", name: "t\(i)", deps: resolvedTarget)

Tests/PackageLoadingTests/PkgConfigParserTests.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import struct TSCBasic.ByteString
1919

2020
final class PkgConfigParserTests: XCTestCase {
2121
func testCircularPCFile() throws {
22-
try XCTSkipOnWindows()
23-
2422
let observability = ObservabilitySystem.makeForTesting()
2523

2624
_ = try PkgConfig(
@@ -36,8 +34,6 @@ final class PkgConfigParserTests: XCTestCase {
3634
}
3735

3836
func testGTK3PCFile() throws {
39-
try XCTSkipOnWindows()
40-
4137
try! loadPCFile("gtk+-3.0.pc") { parser in
4238
XCTAssertEqual(parser.variables, [
4339
"libdir": "/usr/local/Cellar/gtk+3/3.18.9/lib",
@@ -58,8 +54,6 @@ final class PkgConfigParserTests: XCTestCase {
5854
}
5955

6056
func testEmptyCFlags() throws {
61-
try XCTSkipOnWindows()
62-
6357
try! loadPCFile("empty_cflags.pc") { parser in
6458
XCTAssertEqual(parser.variables, [
6559
"prefix": "/usr/local/bin",
@@ -74,16 +68,12 @@ final class PkgConfigParserTests: XCTestCase {
7468
}
7569

7670
func testCFlagsCaseInsensitveKeys() throws {
77-
try XCTSkipOnWindows()
78-
7971
try! loadPCFile("case_insensitive.pc") { parser in
8072
XCTAssertEqual(parser.cFlags, ["-I/usr/local/include"])
8173
}
8274
}
8375

8476
func testVariableinDependency() throws {
85-
try XCTSkipOnWindows()
86-
8777
try! loadPCFile("deps_variable.pc") { parser in
8878
XCTAssertEqual(parser.variables, [
8979
"prefix": "/usr/local/bin",
@@ -108,8 +98,6 @@ final class PkgConfigParserTests: XCTestCase {
10898
}
10999

110100
func testEscapedSpaces() throws {
111-
try XCTSkipOnWindows()
112-
113101
try! loadPCFile("escaped_spaces.pc") { parser in
114102
XCTAssertEqual(parser.variables, [
115103
"prefix": "/usr/local/bin",
@@ -125,8 +113,6 @@ final class PkgConfigParserTests: XCTestCase {
125113
}
126114

127115
func testDummyDependency() throws {
128-
try XCTSkipOnWindows()
129-
130116
try loadPCFile("dummy_dependency.pc") { parser in
131117
XCTAssertEqual(parser.variables, [
132118
"prefix": "/usr/local/bin",
@@ -213,8 +199,6 @@ final class PkgConfigParserTests: XCTestCase {
213199
}
214200

215201
func testAbsolutePathDependency() throws {
216-
try XCTSkipOnWindows()
217-
218202
let libffiPath = "/usr/local/opt/libffi/lib/pkgconfig/libffi.pc"
219203

220204
try loadPCFile("gobject-2.0.pc") { parser in
@@ -248,8 +232,6 @@ final class PkgConfigParserTests: XCTestCase {
248232
}
249233

250234
func testUnevenQuotes() throws {
251-
try XCTSkipOnWindows()
252-
253235
do {
254236
try loadPCFile("quotes_failure.pc")
255237
XCTFail("Unexpected success")
@@ -259,8 +241,6 @@ final class PkgConfigParserTests: XCTestCase {
259241
}
260242

261243
func testSysrootDir() throws {
262-
try XCTSkipOnWindows()
263-
264244
// sysroot should be prepended to all path variables, and should therefore appear in cflags and libs.
265245
try loadPCFile("gtk+-3.0.pc", sysrootDir: "/opt/sysroot/somewhere") { parser in
266246
XCTAssertEqual(parser.variables, [

Tests/PackageLoadingTests/PkgConfigTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ class PkgConfigTests: XCTestCase {
8787
}
8888

8989
func testEnvVar() throws {
90-
try XCTSkipOnWindows()
91-
9290
// Pc file.
9391
try Environment.makeCustom(["PKG_CONFIG_PATH": inputsDir.pathString]) {
9492
for result in try pkgConfigArgs(
@@ -152,8 +150,6 @@ class PkgConfigTests: XCTestCase {
152150
}
153151

154152
func testExplicitPkgConfigDirectories() throws {
155-
try XCTSkipOnWindows()
156-
157153
// Pc file.
158154
for result in try pkgConfigArgs(
159155
for: SystemLibraryModule(pkgConfig: "Foo"),
@@ -212,8 +208,6 @@ class PkgConfigTests: XCTestCase {
212208
}
213209

214210
func testDependencies() throws {
215-
try XCTSkipOnWindows()
216-
217211
// Use additionalSearchPaths instead of pkgConfigArgs to test handling
218212
// of search paths when loading dependencies.
219213
let result = try PkgConfig(

Tests/WorkspaceTests/ManifestSourceGenerationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ final class ManifestSourceGenerationTests: XCTestCase {
231231
}
232232

233233
func testAdvancedFeatures() async throws {
234-
try XCTSkipOnWindows()
234+
try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8602: TSCBasic/Path.swift:969: Assertion failed")
235235

236236
let manifestContents = """
237237
// swift-tools-version:5.3

Tests/WorkspaceTests/RegistryPackageContainerTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ import XCTest
2424
import struct TSCUtility.Version
2525

2626
final class RegistryPackageContainerTests: XCTestCase {
27-
28-
override func setUpWithError() throws {
29-
try XCTSkipOnWindows()
30-
}
31-
3227
func testToolsVersionCompatibleVersions() async throws {
3328
let fs = InMemoryFileSystem()
3429
try fs.createMockToolchain()

Tests/WorkspaceTests/WorkspaceTests.swift

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,6 @@ import struct TSCBasic.ByteString
2828
import struct TSCUtility.Version
2929

3030
final class WorkspaceTests: XCTestCase {
31-
// override func setUpWithError() throws {
32-
// let windowsPassingTests = [
33-
// #selector(self.testBinaryArtifactsInvalidPath),
34-
// #selector(self.testManifestLoaderDiagnostics),
35-
// #selector(self.testInterpreterFlags),
36-
// #selector(self.testManifestParseError),
37-
// #selector(self.testSimpleAPI)
38-
// ]
39-
// let matches = windowsPassingTests.filter { $0 == self.invocation?.selector}
40-
// if matches.count == 0 {
41-
// try XCTSkipOnWindows()
42-
// }
43-
// }
44-
4531
func testBasics() async throws {
4632
let sandbox = AbsolutePath("/tmp/ws/")
4733
let fs = InMemoryFileSystem()
@@ -8039,7 +8025,7 @@ final class WorkspaceTests: XCTestCase {
80398025

80408026
func testArtifactChecksum() async throws {
80418027
try XCTSkipOnWindows(because: #"""
8042-
threw error "\tmp\ws doesn't exist in file system" because there is an issue with InMemoryFileSystem readFileContents(...) on Windows
8028+
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
80438029
"""#)
80448030

80458031
let fs = InMemoryFileSystem()

0 commit comments

Comments
 (0)