Skip to content

Commit ab48712

Browse files
committed
Tests: avoid some warnings on Windows (NFCI)
Process away the body of the tests on Windows to avoid the warning during the build. This is hopefully temporary as the tests should not be skipped, but require further investigation and skipping the tests enables running the test suite completely on Windows.
1 parent 708caad commit ab48712

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

Tests/SwiftDriverTests/APIDigesterTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ class APIDigesterTests: XCTestCase {
176176
}
177177

178178
func testBaselineGenerationEndToEnd() throws {
179+
#if true
179180
// rdar://82302797
180181
throw XCTSkip()
182+
#else
181183
try withTemporaryDirectory { path in
182184
try localFileSystem.changeCurrentWorkingDirectory(to: path)
183185
let source = path.appending(component: "foo.swift")
@@ -214,6 +216,7 @@ class APIDigesterTests: XCTestCase {
214216
XCTAssertTrue((json?["children"] as? [Any])!.count >= 1)
215217
}
216218
}
219+
#endif
217220
}
218221

219222
func testComparisonOptionValidation() throws {
@@ -261,8 +264,10 @@ class APIDigesterTests: XCTestCase {
261264
}
262265

263266
func testAPIComparisonEndToEnd() throws {
267+
#if true
264268
// rdar://82302797
265269
throw XCTSkip()
270+
#else
266271
try withTemporaryDirectory { path in
267272
try localFileSystem.changeCurrentWorkingDirectory(to: path)
268273
let source = path.appending(component: "foo.swift")
@@ -315,11 +320,14 @@ class APIDigesterTests: XCTestCase {
315320
"API breakage: accessor MyStruct.a.Set() has parameter 0 type change from Swift.Int to Swift.Bool"
316321
])
317322
}
323+
#endif
318324
}
319325

320326
func testABIComparisonEndToEnd() throws {
327+
#if true
321328
// rdar://82302797
322329
throw XCTSkip()
330+
#else
323331
try withTemporaryDirectory { path in
324332
try localFileSystem.changeCurrentWorkingDirectory(to: path)
325333
let source = path.appending(component: "foo.swift")
@@ -386,5 +394,6 @@ class APIDigesterTests: XCTestCase {
386394
XCTAssertTrue(messages.contains("ABI breakage: var MyStruct.a in a non-resilient type changes position from 0 to 1"))
387395
XCTAssertTrue(messages.contains("ABI breakage: var MyStruct.b in a non-resilient type changes position from 1 to 0"))
388396
}
397+
#endif
389398
}
390399
}

Tests/SwiftDriverTests/IncrementalBuildPerformanceTests.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class IncrementalBuildPerformanceTests: XCTestCase {
3434

3535
func testPerformance(_ whatToMeasure: WhatToMeasure) throws {
3636

37-
#if !os(macOS)
37+
#if !os(macOS)
3838
// rdar://81411914
3939
throw XCTSkip()
40-
#endif
40+
#else
4141

4242
let packageRootPath = AbsolutePath(#file)
4343
.parentDirectory
@@ -52,6 +52,7 @@ class IncrementalBuildPerformanceTests: XCTestCase {
5252
#endif
5353

5454
try test(swiftDepsDirectory: swiftDepsDirectoryPath.pathString, atMost: limit, whatToMeasure)
55+
#endif
5556
}
5657

5758
/// Test the cost of reading `swiftdeps` files without doing a full build.

Tests/SwiftDriverTests/IncrementalCompilationTests.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ extension IncrementalCompilationTests {
136136
/// Much of the code below is taking from testLinking(), but uses the output file map code here.
137137
func testAutolinkOutputPath() {
138138
#if os(Windows)
139-
XCTSkip("Driver.init fatalError")
139+
// XCTSkip("Driver.init fatalError")
140140
return
141-
#endif
141+
#else
142142
var env = ProcessEnv.vars
143143
env["SWIFT_DRIVER_TESTS_ENABLE_EXEC_PATH_FALLBACK"] = "1"
144144
env["SWIFT_DRIVER_SWIFT_AUTOLINK_EXTRACT_EXEC"] = "/garbage/swift-autolink-extract"
@@ -158,6 +158,7 @@ extension IncrementalCompilationTests {
158158
let autoOut = autoOuts[0]
159159
let expected = AbsolutePath(derivedDataPath, "\(module).autolink")
160160
XCTAssertEqual(autoOut.file.absolutePath, expected)
161+
#endif
161162
}
162163
}
163164

Tests/SwiftDriverTests/JobExecutorTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ final class JobExecutorTests: XCTestCase {
290290
func testStubProcessProtocol() throws {
291291
#if os(Windows)
292292
throw XCTSkip("processId.getter returning `-1`")
293-
#endif
293+
#else
294294
let job = Job(
295295
moduleName: "main",
296296
kind: .compile,
@@ -311,6 +311,7 @@ final class JobExecutorTests: XCTestCase {
311311
try executor.execute(env: ProcessEnv.vars, fileSystem: localFileSystem)
312312

313313
XCTAssertEqual(try delegate.finished[0].1.utf8Output(), "test")
314+
#endif
314315
}
315316

316317
func testSwiftDriverExecOverride() throws {
@@ -347,7 +348,7 @@ final class JobExecutorTests: XCTestCase {
347348
func testInputModifiedDuringSingleJobBuild() throws {
348349
#if os(Windows)
349350
throw XCTSkip("Requires -sdk")
350-
#endif
351+
#else
351352
try withTemporaryDirectory { path in
352353
let main = path.appending(component: "main.swift")
353354
try localFileSystem.writeFileContents(main) {
@@ -369,6 +370,7 @@ final class JobExecutorTests: XCTestCase {
369370
}
370371

371372
}
373+
#endif
372374
}
373375

374376
func testShellEscapingArgsInJobDescription() throws {

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ final class SwiftDriverTests: XCTestCase {
262262
func testRecordedInputModificationDates() throws {
263263
#if os(Windows)
264264
throw XCTSkip("TSCUtility.RelativePath failure")
265-
#endif
265+
#else
266266
try withTemporaryDirectory { path in
267267
guard let cwd = localFileSystem
268268
.currentWorkingDirectory else { fatalError() }
@@ -282,6 +282,7 @@ final class SwiftDriverTests: XCTestCase {
282282
.init(file: VirtualPath.relative(utilRelative).intern(), type: .swift) : utilMDate,
283283
])
284284
}
285+
#endif
285286
}
286287

287288
func testPrimaryOutputKinds() throws {
@@ -958,7 +959,7 @@ final class SwiftDriverTests: XCTestCase {
958959
func testOutputFileMapRelativePathArg() throws {
959960
#if os(Windows)
960961
throw XCTSkip("TSCUtility.RelativePath failure")
961-
#endif
962+
#else
962963
try withTemporaryDirectory { path in
963964
guard let cwd = localFileSystem
964965
.currentWorkingDirectory else { fatalError() }
@@ -988,6 +989,7 @@ final class SwiftDriverTests: XCTestCase {
988989
"main.swift", "util.swift",
989990
]))
990991
}
992+
#endif
991993
}
992994

993995
func testResponseFileExpansion() throws {
@@ -1659,15 +1661,16 @@ final class SwiftDriverTests: XCTestCase {
16591661
}
16601662

16611663
private func clangPathInActiveXcode() throws -> AbsolutePath? {
1662-
#if !os(macOS)
1664+
#if !os(macOS)
16631665
return nil
1664-
#endif
1666+
#else
16651667
let process = Process(arguments: ["xcrun", "-toolchain", "default", "-f", "clang"])
16661668
try process.launch()
16671669
let result = try process.waitUntilExit()
16681670
guard result.exitStatus == .terminated(code: EXIT_SUCCESS) else { return nil }
16691671
guard let path = String(bytes: try result.output.get(), encoding: .utf8) else { return nil }
16701672
return path.isEmpty ? nil : AbsolutePath(path.spm_chomp())
1673+
#endif
16711674
}
16721675

16731676
func testCompatibilityLibs() throws {

0 commit comments

Comments
 (0)