Skip to content

Adjust tests to Swift compiler's new implicit dependency import #1256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SwiftShims"),
dependencyGraph: dependencyGraph)
}
else if relativeOutputPathFileName.starts(with: "_SwiftConcurrencyShims-") {
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_SwiftConcurrencyShims"),
dependencyGraph: dependencyGraph)
}
else {
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
}
Expand Down Expand Up @@ -441,6 +445,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("SwiftShims"),
dependencyGraph: dependencyGraph)
}
else if relativeOutputPathFileName.starts(with: "_SwiftConcurrencyShims-") {
try checkExplicitModuleBuildJob(job: job, moduleId: .clang("_SwiftConcurrencyShims"),
dependencyGraph: dependencyGraph)
}
else {
XCTFail("Unexpected module dependency build job output: \(outputFilePath)")
}
Expand Down Expand Up @@ -977,10 +985,13 @@ final class ExplicitModuleBuildTests: XCTestCase {
let expectedImports2 = ["C", "E", "G", "Swift", "SwiftOnoneSupport", "_Concurrency"]
// Dependnig on how recent the platform we are running on, the _StringProcessing module may or may not be present.
let expectedImports3 = ["C", "E", "G", "Swift", "SwiftOnoneSupport", "_Concurrency", "_StringProcessing"]
// Dependnig on how recent the platform we are running on, the _SwiftConcurrencyShims module may or may not be present.
let expectedImports4 = ["C", "E", "G", "Swift", "SwiftOnoneSupport", "_Concurrency", "_StringProcessing", "_SwiftConcurrencyShims"]
XCTAssertTrue(
Set(imports.imports) == Set(expectedImports) ||
Set(imports.imports) == Set(expectedImports2) ||
Set(imports.imports) == Set(expectedImports3))
Set(imports.imports) == Set(expectedImports3) ||
Set(imports.imports) == Set(expectedImports4))
}
}

Expand Down Expand Up @@ -1168,11 +1179,16 @@ final class ExplicitModuleBuildTests: XCTestCase {
let hasConcurrencyModule = dependencyGraph.modules.keys.contains {
$0.moduleName == "_Concurrency"
}
let hasConcurrencyShimsModule = dependencyGraph.modules.keys.contains {
$0.moduleName == "_SwiftConcurrencyShims"
}
let hasStringProcessingModule = dependencyGraph.modules.keys.contains {
$0.moduleName == "_StringProcessing"
}
let adjustedExpectedNumberOfDependencies =
expectedNumberOfDependencies + (hasConcurrencyModule ? 1 : 0) +
expectedNumberOfDependencies +
(hasConcurrencyModule ? 1 : 0) +
(hasConcurrencyShimsModule ? 1 : 0) +
(hasStringProcessingModule ? 1 : 0)

if (dependencyGraph.modules.count != adjustedExpectedNumberOfDependencies) {
Expand Down