@@ -674,38 +674,42 @@ final class CachingBuildTests: XCTestCase {
674674 // FIXME: We need to differentiate the scanning action hash,
675675 // though the module-name above should be sufficient.
676676 " -I/tmp/foo/bar/ \( index) " ]
677- let dependencyGraph =
678- try ! dependencyOracle. getDependencies ( workingDirectory: path,
679- commandLine: iterationCommand)
680-
681- // The _Concurrency and _StringProcessing modules are automatically
682- // imported in newer versions of the Swift compiler. If they happened to
683- // be provided, adjust our expectations accordingly.
684- let hasConcurrencyModule = dependencyGraph. modules. keys. contains {
685- $0. moduleName == " _Concurrency "
686- }
687- let hasConcurrencyShimsModule = dependencyGraph. modules. keys. contains {
688- $0. moduleName == " _SwiftConcurrencyShims "
689- }
690- let hasStringProcessingModule = dependencyGraph. modules. keys. contains {
691- $0. moduleName == " _StringProcessing "
692- }
693- let adjustedExpectedNumberOfDependencies =
694- expectedNumberOfDependencies +
695- ( hasConcurrencyModule ? 1 : 0 ) +
696- ( hasConcurrencyShimsModule ? 1 : 0 ) +
697- ( hasStringProcessingModule ? 1 : 0 )
698-
699- if ( dependencyGraph. modules. count != adjustedExpectedNumberOfDependencies) {
700- lock. lock ( )
701- print ( " Unexpected Dependency Scanning Result ( \( dependencyGraph. modules. count) modules): " )
702- dependencyGraph. modules. forEach {
703- print ( $0. key. moduleName)
677+ do {
678+ let dependencyGraph =
679+ try dependencyOracle. getDependencies ( workingDirectory: path,
680+ commandLine: iterationCommand)
681+
682+ // The _Concurrency and _StringProcessing modules are automatically
683+ // imported in newer versions of the Swift compiler. If they happened to
684+ // be provided, adjust our expectations accordingly.
685+ let hasConcurrencyModule = dependencyGraph. modules. keys. contains {
686+ $0. moduleName == " _Concurrency "
687+ }
688+ let hasConcurrencyShimsModule = dependencyGraph. modules. keys. contains {
689+ $0. moduleName == " _SwiftConcurrencyShims "
690+ }
691+ let hasStringProcessingModule = dependencyGraph. modules. keys. contains {
692+ $0. moduleName == " _StringProcessing "
693+ }
694+ let adjustedExpectedNumberOfDependencies =
695+ expectedNumberOfDependencies +
696+ ( hasConcurrencyModule ? 1 : 0 ) +
697+ ( hasConcurrencyShimsModule ? 1 : 0 ) +
698+ ( hasStringProcessingModule ? 1 : 0 )
699+
700+ if ( dependencyGraph. modules. count != adjustedExpectedNumberOfDependencies) {
701+ lock. lock ( )
702+ print ( " Unexpected Dependency Scanning Result ( \( dependencyGraph. modules. count) modules): " )
703+ dependencyGraph. modules. forEach {
704+ print ( $0. key. moduleName)
705+ }
706+ lock. unlock ( )
704707 }
705- lock. unlock ( )
708+ XCTAssertTrue ( dependencyGraph. modules. count ==
709+ adjustedExpectedNumberOfDependencies)
710+ } catch {
711+ XCTFail ( " Unexpected error: \( error) " )
706712 }
707- XCTAssertTrue ( dependencyGraph. modules. count ==
708- adjustedExpectedNumberOfDependencies)
709713 }
710714
711715 // Change CAS path is an error.
0 commit comments