Skip to content

Commit 2100d82

Browse files
Fix windows explicit module planning jobs
1 parent 37f4358 commit 2100d82

File tree

1 file changed

+40
-14
lines changed

1 file changed

+40
-14
lines changed

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,18 @@ final class ExplicitModuleBuildTests: XCTestCase {
485485

486486
let linkJob = try jobs.findJob(.link)
487487
if driver.targetTriple.isDarwin {
488-
XCTAssertTrue(linkJob.commandLine.contains("-possible-lswiftCore"))
489-
XCTAssertTrue(linkJob.commandLine.contains("-possible-lswift_StringProcessing"))
490-
XCTAssertTrue(linkJob.commandLine.contains("-possible-lobjc"))
491-
XCTAssertTrue(linkJob.commandLine.contains("-possible-lswift_Concurrency"))
492-
XCTAssertTrue(linkJob.commandLine.contains("-possible-lswiftSwiftOnoneSupport"))
488+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-possible-lswiftCore"))
489+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-possible-lswift_StringProcessing"))
490+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-possible-lobjc"))
491+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-possible-lswift_Concurrency"))
492+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-possible-lswiftSwiftOnoneSupport"))
493+
} else if driver.targetTriple.isWindows {
494+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-lswiftCore"))
493495
} else {
494-
XCTAssertTrue(linkJob.commandLine.contains("-lswiftCore"))
495-
XCTAssertTrue(linkJob.commandLine.contains("-lswift_StringProcessing"))
496-
XCTAssertTrue(linkJob.commandLine.contains("-lswift_Concurrency"))
497-
XCTAssertTrue(linkJob.commandLine.contains("-lswiftSwiftOnoneSupport"))
496+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-lswiftCore"))
497+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-lswift_StringProcessing"))
498+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-lswift_Concurrency"))
499+
XCTAssertCommandLineContains(linkJob.commandLine, .flag("-lswiftSwiftOnoneSupport"))
498500
}
499501
}
500502
}
@@ -773,6 +775,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
773775
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
774776
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
775777
dependencyGraph: dependencyGraph)
778+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
779+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
780+
dependencyGraph: dependencyGraph)
781+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
782+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
783+
dependencyGraph: dependencyGraph)
776784
} else if hostTriple.isMacOSX,
777785
hostTriple.version(for: .macOS) < Triple.Version(11, 0, 0),
778786
relativeOutputPathFileName.starts(with: "X-") {
@@ -1059,6 +1067,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
10591067
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
10601068
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
10611069
dependencyGraph: dependencyGraph)
1070+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
1071+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
1072+
dependencyGraph: dependencyGraph)
1073+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
1074+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
1075+
dependencyGraph: dependencyGraph)
10621076
} else {
10631077
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
10641078
}
@@ -1190,6 +1204,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
11901204
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
11911205
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
11921206
dependencyGraph: dependencyGraph)
1207+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
1208+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
1209+
dependencyGraph: dependencyGraph)
1210+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
1211+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
1212+
dependencyGraph: dependencyGraph)
11931213
} else {
11941214
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
11951215
}
@@ -1310,6 +1330,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
13101330
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
13111331
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
13121332
dependencyGraph: dependencyGraph)
1333+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
1334+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
1335+
dependencyGraph: dependencyGraph)
1336+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
1337+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
1338+
dependencyGraph: dependencyGraph)
13131339
} else {
13141340
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
13151341
}
@@ -2710,7 +2736,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
27102736
try testInputsPath.appending(component: "ExplicitModuleBuilds")
27112737
.appending(component: "Swift")
27122738
let mockSDKPath: AbsolutePath =
2713-
try testInputsPath.appending(component: "mock-sdk.sdk")
2739+
try AbsolutePath(validating: testInputsPath.appending(component: "mock-sdk.sdk").nativePathString(escaped: true))
27142740

27152741
// Only '-target' is specified, the driver infers '-clang-target' from SDK deployment target
27162742
do {
@@ -2736,7 +2762,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
27362762
main.pathString])
27372763
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
27382764
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2739-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2765+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"), .path(.absolute(mockSDKPath)))
27402766
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.15")]))
27412767
}
27422768
}
@@ -2766,7 +2792,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
27662792
main.pathString])
27672793
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
27682794
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2769-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2795+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"), .path(.absolute(mockSDKPath)))
27702796
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.12")]))
27712797
}
27722798
}
@@ -2797,7 +2823,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
27972823
main.pathString])
27982824
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
27992825
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2800-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2826+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"), .path(.absolute(mockSDKPath)))
28012827
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.15")]))
28022828
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target-variant"), .flag("x86_64-apple-ios13.1-macabi")]))
28032829
}
@@ -2830,7 +2856,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28302856
main.pathString])
28312857
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
28322858
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2833-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2859+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"), .path(.absolute(mockSDKPath)))
28342860
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.12")]))
28352861
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target-variant"), .flag("x86_64-apple-ios14.0-macabi")]))
28362862
}

0 commit comments

Comments
 (0)