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