Skip to content

Commit 0764248

Browse files
Merge pull request #2028 from cachemeifyoucan/eng/fix-all-gh-actions
2 parents f09b136 + b56ca4d commit 0764248

File tree

4 files changed

+179
-106
lines changed

4 files changed

+179
-106
lines changed

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 45 additions & 15 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
}
@@ -610,6 +612,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
610612
let dependencyGraph = try XCTUnwrap(driver.intermoduleDependencyGraph)
611613

612614
let checkForLinkLibrary = { (info: ModuleInfo, linkName: String, isFramework: Bool, shouldForceLoad: Bool) in
615+
if driver.targetTriple.isWindows && linkName != "swiftCore" {
616+
// Windows only links swiftCore.
617+
return
618+
}
613619
let linkLibraries = try XCTUnwrap(info.linkLibraries)
614620
let linkLibrary = try XCTUnwrap(linkLibraries.first { $0.linkName == linkName })
615621
XCTAssertEqual(linkLibrary.isFramework, isFramework)
@@ -773,6 +779,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
773779
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
774780
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
775781
dependencyGraph: dependencyGraph)
782+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
783+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
784+
dependencyGraph: dependencyGraph)
785+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
786+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
787+
dependencyGraph: dependencyGraph)
776788
} else if hostTriple.isMacOSX,
777789
hostTriple.version(for: .macOS) < Triple.Version(11, 0, 0),
778790
relativeOutputPathFileName.starts(with: "X-") {
@@ -823,7 +835,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
823835
try testInputsPath.appending(component: "ExplicitModuleBuilds")
824836
.appending(component: "Swift")
825837
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
826-
838+
827839
var driver = try Driver(args: ["swiftc",
828840
"-I", cHeadersPath.nativePathString(escaped: true),
829841
"-I", swiftModuleInterfacesPath.nativePathString(escaped: true),
@@ -1135,6 +1147,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
11351147
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
11361148
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
11371149
dependencyGraph: dependencyGraph)
1150+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
1151+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
1152+
dependencyGraph: dependencyGraph)
1153+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
1154+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
1155+
dependencyGraph: dependencyGraph)
11381156
} else {
11391157
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
11401158
}
@@ -1280,6 +1298,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
12801298
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
12811299
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
12821300
dependencyGraph: dependencyGraph)
1301+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
1302+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
1303+
dependencyGraph: dependencyGraph)
1304+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
1305+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
1306+
dependencyGraph: dependencyGraph)
12831307
} else {
12841308
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
12851309
}
@@ -1400,6 +1424,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
14001424
} else if relativeOutputPathFileName.starts(with: "_Builtin_stdint-") {
14011425
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_Builtin_stdint"),
14021426
dependencyGraph: dependencyGraph)
1427+
} else if relativeOutputPathFileName.starts(with: "vcruntime-") {
1428+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("vcruntime"),
1429+
dependencyGraph: dependencyGraph)
1430+
} else if relativeOutputPathFileName.starts(with: "SAL-") {
1431+
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SAL"),
1432+
dependencyGraph: dependencyGraph)
14031433
} else {
14041434
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
14051435
}
@@ -2252,7 +2282,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
22522282
hostTriple.version(for: .macOS) < Triple.Version(11, 0, 0) {
22532283
expectedNumberOfDependencies = 13
22542284
} else if driver.targetTriple.isWindows {
2255-
expectedNumberOfDependencies = 13
2285+
expectedNumberOfDependencies = 14
22562286
} else {
22572287
expectedNumberOfDependencies = 12
22582288
}
@@ -2826,7 +2856,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28262856
main.pathString])
28272857
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
28282858
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2829-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2859+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"))
28302860
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.15")]))
28312861
}
28322862
}
@@ -2856,7 +2886,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28562886
main.pathString])
28572887
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
28582888
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2859-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2889+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"))
28602890
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.12")]))
28612891
}
28622892
}
@@ -2887,7 +2917,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28872917
main.pathString])
28882918
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
28892919
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2890-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2920+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"))
28912921
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.15")]))
28922922
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target-variant"), .flag("x86_64-apple-ios13.1-macabi")]))
28932923
}
@@ -2920,7 +2950,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
29202950
main.pathString])
29212951
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
29222952
let emitModuleJob = try XCTUnwrap(plannedJobs.findJobs(.emitModule).spm_only)
2923-
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-sdk"), .path(.absolute(mockSDKPath))]))
2953+
XCTAssertCommandLineContains(emitModuleJob.commandLine, .flag("-sdk"))
29242954
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("x86_64-apple-macosx10.12")]))
29252955
XCTAssertTrue(emitModuleJob.commandLine.contains(subsequence: [.flag("-clang-target-variant"), .flag("x86_64-apple-ios14.0-macabi")]))
29262956
}

Tests/SwiftDriverTests/IncrementalCompilationTests.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ final class IncrementalCompilationTests: XCTestCase {
116116
}
117117
var extraExplicitBuildArgs: [String] = []
118118

119-
override func setUp() {
119+
override func setUpWithError() throws {
120+
try super.setUpWithError()
121+
120122
self.tempDir = try! withTemporaryDirectory(removeTreeOnDeinit: false) {$0}
121123
try! localFileSystem.createDirectory(explicitModuleCacheDir)
122124
try! localFileSystem.createDirectory(derivedDataPath)
@@ -154,6 +156,9 @@ final class IncrementalCompilationTests: XCTestCase {
154156
if driver.isFrontendArgSupported(.moduleLoadMode) {
155157
self.extraExplicitBuildArgs = ["-Xfrontend", "-module-load-mode", "-Xfrontend", "prefer-interface"]
156158
}
159+
160+
// Disable incremental tests on windows due to very different module setup.
161+
try XCTSkipIf(driver.targetTriple.isWindows, "https://github.com/swiftlang/swift-driver/issues/2029")
157162
}
158163

159164
deinit {
@@ -360,7 +365,7 @@ extension IncrementalCompilationTests {
360365
XCTAssertFalse(mandatoryJobInputs.contains("other.swift"))
361366
}
362367

363-
// External deps timestamp updated but contents are the same, and file-hashing is explicitly disabled
368+
// External deps timestamp updated but contents are the same, and file-hashing is explicitly disabled
364369
func testExplicitIncrementalBuildExternalDepsWithoutHashing() throws {
365370
replace(contentsOf: "other", with: "import E;let bar = foo")
366371
try buildInitialState(extraArguments: ["-disable-incremental-file-hashing"], explicitModuleBuild: true)
@@ -372,7 +377,7 @@ extension IncrementalCompilationTests {
372377
XCTAssertTrue(mandatoryJobInputs.contains("main.swift"))
373378
}
374379

375-
// Source file timestamps updated but contents are the same, and file-hashing is explicitly disabled
380+
// Source file timestamps updated but contents are the same, and file-hashing is explicitly disabled
376381
func testExplicitIncrementalBuildSourceFilesWithoutHashing() throws {
377382
try buildInitialState(extraArguments: ["-disable-incremental-file-hashing"], explicitModuleBuild: true)
378383
touch("main")
@@ -1043,7 +1048,7 @@ extension IncrementalCompilationTests {
10431048
}
10441049

10451050
private func testRemoval(_ options: RemovalTestOptions) throws {
1046-
setUp() // clear derived data, restore output file map
1051+
try setUpWithError() // clear derived data, restore output file map
10471052
print("\n*** testRemoval \(options) ***", to: &stderrStream); stderrStream.flush()
10481053

10491054
let newInput = "another"

Tests/SwiftDriverTests/JobExecutorTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ final class JobExecutorTests: XCTestCase {
528528
let outputPath = path.appending(component: "finalOutput")
529529
var driver = try Driver(args: ["swiftc", main.pathString,
530530
"-save-temps",
531+
"-sil-output-dir", path.pathString,
532+
"-ir-output-dir", path.pathString,
531533
"-driver-filelist-threshold", "0",
532534
"-o", outputPath.pathString] + getHostToolchainSdkArg(executor),
533535
envBlock: ProcessEnv.block,

0 commit comments

Comments
 (0)