Skip to content

Commit 96e45c8

Browse files
authored
Merge pull request #941 from compnerd/silence-is-golden
Tests: avoid some warnings on Windows (NFCI)
2 parents 18f043b + 716e6d5 commit 96e45c8

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,10 @@ extension IncrementalCompilationTests {
134134
/// Ensure that autolink output file goes with .o directory, to not prevent incremental omission of
135135
/// autolink job.
136136
/// Much of the code below is taking from testLinking(), but uses the output file map code here.
137-
func testAutolinkOutputPath() {
137+
func testAutolinkOutputPath() throws {
138138
#if os(Windows)
139-
XCTSkip("Driver.init fatalError")
140-
return
141-
#endif
139+
throw XCTSkip("Driver.init fatalError")
140+
#else
142141
var env = ProcessEnv.vars
143142
env["SWIFT_DRIVER_TESTS_ENABLE_EXEC_PATH_FALLBACK"] = "1"
144143
env["SWIFT_DRIVER_SWIFT_AUTOLINK_EXTRACT_EXEC"] = "/garbage/swift-autolink-extract"
@@ -158,6 +157,7 @@ extension IncrementalCompilationTests {
158157
let autoOut = autoOuts[0]
159158
let expected = AbsolutePath(derivedDataPath, "\(module).autolink")
160159
XCTAssertEqual(autoOut.file.absolutePath, expected)
160+
#endif
161161
}
162162
}
163163

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
@@ -286,7 +286,7 @@ final class SwiftDriverTests: XCTestCase {
286286
func testRecordedInputModificationDates() throws {
287287
#if os(Windows)
288288
throw XCTSkip("TSCUtility.RelativePath failure")
289-
#endif
289+
#else
290290
try withTemporaryDirectory { path in
291291
guard let cwd = localFileSystem
292292
.currentWorkingDirectory else { fatalError() }
@@ -306,6 +306,7 @@ final class SwiftDriverTests: XCTestCase {
306306
.init(file: VirtualPath.relative(utilRelative).intern(), type: .swift) : utilMDate,
307307
])
308308
}
309+
#endif
309310
}
310311

311312
func testPrimaryOutputKinds() throws {
@@ -986,7 +987,7 @@ final class SwiftDriverTests: XCTestCase {
986987
func testOutputFileMapRelativePathArg() throws {
987988
#if os(Windows)
988989
throw XCTSkip("TSCUtility.RelativePath failure")
989-
#endif
990+
#else
990991
try withTemporaryDirectory { path in
991992
guard let cwd = localFileSystem
992993
.currentWorkingDirectory else { fatalError() }
@@ -1016,6 +1017,7 @@ final class SwiftDriverTests: XCTestCase {
10161017
"main.swift", "util.swift",
10171018
]))
10181019
}
1020+
#endif
10191021
}
10201022

10211023
func testResponseFileExpansion() throws {
@@ -1687,15 +1689,16 @@ final class SwiftDriverTests: XCTestCase {
16871689
}
16881690

16891691
private func clangPathInActiveXcode() throws -> AbsolutePath? {
1690-
#if !os(macOS)
1692+
#if !os(macOS)
16911693
return nil
1692-
#endif
1694+
#else
16931695
let process = Process(arguments: ["xcrun", "-toolchain", "default", "-f", "clang"])
16941696
try process.launch()
16951697
let result = try process.waitUntilExit()
16961698
guard result.exitStatus == .terminated(code: EXIT_SUCCESS) else { return nil }
16971699
guard let path = String(bytes: try result.output.get(), encoding: .utf8) else { return nil }
16981700
return path.isEmpty ? nil : AbsolutePath(path.spm_chomp())
1701+
#endif
16991702
}
17001703

17011704
func testCompatibilityLibs() throws {

0 commit comments

Comments
 (0)