@@ -829,15 +829,27 @@ final class CachingBuildTests: XCTestCase {
829
829
" -cas-path " , casPath2. nativePathString ( escaped: true ) ,
830
830
]
831
831
var scanDiagnostics : [ ScannerDiagnosticPayload ] = [ ]
832
- XCTAssertThrowsError ( try dependencyOracle. getDependencies ( workingDirectory: path,
833
- commandLine: command,
834
- diagnostics: & scanDiagnostics) ) {
835
- XCTAssertTrue ( $0 is DependencyScanningError )
836
- }
837
- let diags = try XCTUnwrap ( dependencyOracle. getScannerDiagnostics ( ) )
838
- XCTAssertEqual ( diags. count, 1 )
839
- XCTAssertEqual ( diags [ 0 ] . severity, . error)
840
- XCTAssertEqual ( diags [ 0 ] . message, " CAS error encountered: conflicting CAS options used in scanning service " )
832
+ do {
833
+ let _ = try dependencyOracle. getDependencies ( workingDirectory: path,
834
+ commandLine: command,
835
+ diagnostics: & scanDiagnostics)
836
+ } catch let error {
837
+ XCTAssertTrue ( error is DependencyScanningError )
838
+ }
839
+
840
+ let testDiagnostics : [ ScannerDiagnosticPayload ]
841
+ if try dependencyOracle. supportsPerScanDiagnostics ( ) ,
842
+ !scanDiagnostics. isEmpty {
843
+ testDiagnostics = scanDiagnostics
844
+ print ( " Using Per-Scan diagnostics " )
845
+ } else {
846
+ testDiagnostics = try XCTUnwrap ( dependencyOracle. getScannerDiagnostics ( ) )
847
+ print ( " Using Scanner-Global diagnostics " )
848
+ }
849
+
850
+ XCTAssertEqual ( testDiagnostics. count, 1 )
851
+ XCTAssertEqual ( testDiagnostics [ 0 ] . severity, . error)
852
+ XCTAssertEqual ( testDiagnostics [ 0 ] . message, " CAS error encountered: conflicting CAS options used in scanning service " )
841
853
}
842
854
}
843
855
0 commit comments