@@ -2267,6 +2267,8 @@ final class PackageCommandTests: CommandsTestCase {
2267
2267
let containsRemark = StringPattern . contains ( " command plugin: Diagnostics.remark " )
2268
2268
let containsWarning = StringPattern . contains ( " command plugin: Diagnostics.warning " )
2269
2269
let containsError = StringPattern . contains ( " command plugin: Diagnostics.error " )
2270
+ let hiddenLibSwiftScanWarnPattern = StringPattern . contains (
2271
+ " warning: Unable to locate libSwiftScan. Fallback to `swift-frontend` dependency scanner invocation " )
2270
2272
2271
2273
try await fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2272
2274
func runPlugin( flags: [ String ] , diagnostics: [ String ] , completion: ( String , String ) -> Void ) async throws {
@@ -2290,7 +2292,8 @@ final class PackageCommandTests: CommandsTestCase {
2290
2292
2291
2293
try await runPlugin ( flags: [ ] , diagnostics: [ " print " ] ) { stdout, stderr in
2292
2294
XCTAssertMatch ( stdout, isOnlyPrint)
2293
- XCTAssertMatch ( stderr, isEmpty)
2295
+ XCTAssertMatch ( stderr, hiddenLibSwiftScanWarnPattern)
2296
+ XCTAssertFalse ( stderr. contains ( " error: " ) )
2294
2297
}
2295
2298
2296
2299
try await runPlugin ( flags: [ ] , diagnostics: [ " print " , " progress " ] ) { stdout, stderr in
@@ -2322,7 +2325,8 @@ final class PackageCommandTests: CommandsTestCase {
2322
2325
2323
2326
try await runPlugin ( flags: [ " -q " ] , diagnostics: [ " print " ] ) { stdout, stderr in
2324
2327
XCTAssertMatch ( stdout, isOnlyPrint)
2325
- XCTAssertMatch ( stderr, isEmpty)
2328
+ XCTAssertMatch ( stderr, hiddenLibSwiftScanWarnPattern)
2329
+ XCTAssertFalse ( stderr. contains ( " error: " ) )
2326
2330
}
2327
2331
2328
2332
try await runPlugin ( flags: [ " -q " ] , diagnostics: [ " print " , " progress " ] ) { stdout, stderr in
@@ -2461,7 +2465,11 @@ final class PackageCommandTests: CommandsTestCase {
2461
2465
let containsLogtext = StringPattern . contains ( " command plugin: packageManager.build logtext: Building for debugging... " )
2462
2466
2463
2467
// Echoed logs have no prefix
2464
- let containsLogecho = StringPattern . regex ( " ^Building for debugging... \n " )
2468
+ let containsLogecho = StringPattern . contains ( " Building for debugging... \n " )
2469
+
2470
+ // Hides the libSwiftScan library from the driver
2471
+ let hiddenLibSwiftScanWarnPattern = StringPattern . contains (
2472
+ " warning: Unable to locate libSwiftScan. Fallback to `swift-frontend` dependency scanner invocation " )
2465
2473
2466
2474
// These tests involve building a target, so each test must run with a fresh copy of the fixture
2467
2475
// otherwise the logs may be different in subsequent tests.
@@ -2470,14 +2478,16 @@ final class PackageCommandTests: CommandsTestCase {
2470
2478
try await fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2471
2479
let ( stdout, stderr) = try await SwiftPM . Package. execute ( [ " print-diagnostics " , " build " ] , packagePath: fixturePath, env: [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
2472
2480
XCTAssertMatch ( stdout, isEmpty)
2473
- XCTAssertMatch ( stderr, isEmpty)
2481
+ XCTAssertMatch ( stderr, hiddenLibSwiftScanWarnPattern)
2482
+ XCTAssertFalse ( stderr. contains ( " error: " ) )
2474
2483
}
2475
2484
2476
2485
// Check that logs are returned to the plugin when echoLogs is false
2477
2486
try await fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2478
2487
let ( stdout, stderr) = try await SwiftPM . Package. execute ( [ " print-diagnostics " , " build " , " printlogs " ] , packagePath: fixturePath, env: [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
2479
2488
XCTAssertMatch ( stdout, containsLogtext)
2480
- XCTAssertMatch ( stderr, isEmpty)
2489
+ XCTAssertMatch ( stderr, hiddenLibSwiftScanWarnPattern)
2490
+ XCTAssertFalse ( stderr. contains ( " error: " ) )
2481
2491
}
2482
2492
2483
2493
// Check that logs echoed to the console (on stderr) when echoLogs is true
@@ -2784,14 +2794,14 @@ final class PackageCommandTests: CommandsTestCase {
2784
2794
do {
2785
2795
let ( stdout, stderr) = try await SwiftPM . Package. execute ( [ " plugin " , " MyPlugin " , " --foo " , " --help " , " --version " , " --verbose " ] , packagePath: packageDir, env: [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
2786
2796
XCTAssertMatch ( stdout, . contains( " success " ) )
2787
- XCTAssertEqual ( stderr, " " )
2797
+ XCTAssertFalse ( stderr. contains ( " error: " ) )
2788
2798
}
2789
2799
2790
2800
// Check default command arguments
2791
2801
do {
2792
2802
let ( stdout, stderr) = try await SwiftPM . Package. execute ( [ " MyPlugin " , " --foo " , " --help " , " --version " , " --verbose " ] , packagePath: packageDir, env: [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
2793
2803
XCTAssertMatch ( stdout, . contains( " success " ) )
2794
- XCTAssertEqual ( stderr, " " )
2804
+ XCTAssertFalse ( stderr. contains ( " error: " ) )
2795
2805
}
2796
2806
}
2797
2807
}
0 commit comments