Skip to content

Commit b1ed23b

Browse files
authored
Merge pull request #1115 from bnbarham/cherry-string-processing-fix
[5.7] Handle _StringProcessing module in ExplicitModuleBuildTests
2 parents 87773b8 + a0f8330 commit b1ed23b

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ final class ExplicitModuleBuildTests: XCTestCase {
207207
moduleId: .swift("_Concurrency"),
208208
dependencyGraph: moduleDependencyGraph,
209209
pcmFileEncoder: pcmFileEncoder)
210+
case .relative(RelativePath("_StringProcessing.swiftmodule")):
211+
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgs,
212+
moduleId: .swift("_StringProcessing"),
213+
dependencyGraph: moduleDependencyGraph,
214+
pcmFileEncoder: pcmFileEncoder)
210215
case .relative(RelativePath("SwiftOnoneSupport.swiftmodule")):
211216
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgs,
212217
moduleId: .swift("SwiftOnoneSupport"),
@@ -376,6 +381,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
376381
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_Concurrency"),
377382
dependencyGraph: dependencyGraph,
378383
pcmFileEncoder: pcmFileEncoder)
384+
} else if pathMatchesSwiftModule(path: outputFilePath, "_StringProcessing") {
385+
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_StringProcessing"),
386+
dependencyGraph: dependencyGraph,
387+
pcmFileEncoder: pcmFileEncoder)
379388
} else if pathMatchesSwiftModule(path: outputFilePath, "SwiftOnoneSupport") {
380389
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("SwiftOnoneSupport"),
381390
dependencyGraph: dependencyGraph,
@@ -528,6 +537,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
528537
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_Concurrency"),
529538
dependencyGraph: dependencyGraph,
530539
pcmFileEncoder: pcmFileEncoder)
540+
} else if pathMatchesSwiftModule(path: outputFilePath, "_StringProcessing") {
541+
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_StringProcessing"),
542+
dependencyGraph: dependencyGraph,
543+
pcmFileEncoder: pcmFileEncoder)
531544
} else if pathMatchesSwiftModule(path: outputFilePath, "SwiftOnoneSupport") {
532545
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("SwiftOnoneSupport"),
533546
dependencyGraph: dependencyGraph,
@@ -1028,9 +1041,14 @@ final class ExplicitModuleBuildTests: XCTestCase {
10281041
try! dependencyOracle.getImports(workingDirectory: path,
10291042
commandLine: scannerCommand)
10301043
let expectedImports = ["C", "E", "G", "Swift", "SwiftOnoneSupport"]
1031-
// Dependnig on how recent the platform we are running on, the Concurrency module may or may not be present.
1044+
// Dependnig on how recent the platform we are running on, the _Concurrency module may or may not be present.
10321045
let expectedImports2 = ["C", "E", "G", "Swift", "SwiftOnoneSupport", "_Concurrency"]
1033-
XCTAssertTrue(Set(imports.imports) == Set(expectedImports) || Set(imports.imports) == Set(expectedImports2))
1046+
// Dependnig on how recent the platform we are running on, the _StringProcessing module may or may not be present.
1047+
let expectedImports3 = ["C", "E", "G", "Swift", "SwiftOnoneSupport", "_Concurrency", "_StringProcessing"]
1048+
XCTAssertTrue(
1049+
Set(imports.imports) == Set(expectedImports) ||
1050+
Set(imports.imports) == Set(expectedImports2) ||
1051+
Set(imports.imports) == Set(expectedImports3))
10341052
}
10351053
}
10361054

@@ -1139,14 +1157,18 @@ final class ExplicitModuleBuildTests: XCTestCase {
11391157
try! dependencyOracle.getDependencies(workingDirectory: path,
11401158
commandLine: iterationCommand)
11411159

1142-
// The _Concurrency module is automatically imported in newer versions
1143-
// of the Swift compiler. If it happened to be provided, adjust
1144-
// our expectations accordingly.
1160+
// The _Concurrency and _StringProcessing modules are automatically
1161+
// imported in newer versions of the Swift compiler. If they happened to
1162+
// be provided, adjust our expectations accordingly.
11451163
let hasConcurrencyModule = dependencyGraph.modules.keys.contains {
11461164
$0.moduleName == "_Concurrency"
11471165
}
1166+
let hasStringProcessingModule = dependencyGraph.modules.keys.contains {
1167+
$0.moduleName == "_StringProcessing"
1168+
}
11481169
let adjustedExpectedNumberOfDependencies =
1149-
expectedNumberOfDependencies + (hasConcurrencyModule ? 1 : 0)
1170+
expectedNumberOfDependencies + (hasConcurrencyModule ? 1 : 0) +
1171+
(hasStringProcessingModule ? 1 : 0)
11501172

11511173
if (dependencyGraph.modules.count != adjustedExpectedNumberOfDependencies) {
11521174
lock.lock()

0 commit comments

Comments
 (0)