Skip to content

Commit 7ad4649

Browse files
committed
Dependency Scanning test: correctly reflect that the expected number of dependencies is OS-version dependent.
1 parent 33a314b commit 7ad4649

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,16 @@ final class ExplicitModuleBuildTests: XCTestCase {
559559
// Here purely to dump diagnostic output in a reasonable fashion when things go wrong.
560560
let lock = NSLock()
561561

562+
// Module `X` is only imported when:
563+
// #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000
564+
let expectedNumberOfDependencies: Int
565+
if driver.targetTriple.isMacOSX,
566+
driver.targetTriple.version(for: .macOS) < Triple.Version(11, 0, 0) {
567+
expectedNumberOfDependencies = 12
568+
} else {
569+
expectedNumberOfDependencies = 11
570+
}
571+
562572
// Dispatch several iterations in parallel
563573
DispatchQueue.concurrentPerform(iterations: 20) { index in
564574
// Give the main modules different names
@@ -567,15 +577,15 @@ final class ExplicitModuleBuildTests: XCTestCase {
567577
let dependencyGraph =
568578
try! dependencyOracle.getDependencies(workingDirectory: path,
569579
commandLine: iterationCommand)
570-
if (dependencyGraph.modules.count != 11) {
580+
if (dependencyGraph.modules.count != expectedNumberOfDependencies) {
571581
lock.lock()
572582
print("Unexpected Dependency Scanning Result (\(dependencyGraph.modules.count) modules):")
573583
dependencyGraph.modules.forEach {
574584
print($0.key.moduleName)
575585
}
576586
lock.unlock()
577587
}
578-
XCTAssertTrue(dependencyGraph.modules.count == 11)
588+
XCTAssertTrue(dependencyGraph.modules.count == expectedNumberOfDependencies)
579589
}
580590
}
581591
}

0 commit comments

Comments
 (0)