@@ -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 . equal (
2271
+ " warning: \' miscellaneous_plugins_commandpluginteststub \' : warning: Unable to locate libSwiftScan. Fallback to `swift-frontend` dependency scanner invocation. \n warning: Unable to locate libSwiftScan. Fallback to `swift-frontend` dependency scanner invocation. \n 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,7 @@ 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 )
2294
2296
}
2295
2297
2296
2298
try await runPlugin ( flags: [ ] , diagnostics: [ " print " , " progress " ] ) { stdout, stderr in
@@ -2322,7 +2324,7 @@ final class PackageCommandTests: CommandsTestCase {
2322
2324
2323
2325
try await runPlugin ( flags: [ " -q " ] , diagnostics: [ " print " ] ) { stdout, stderr in
2324
2326
XCTAssertMatch ( stdout, isOnlyPrint)
2325
- XCTAssertMatch ( stderr, isEmpty )
2327
+ XCTAssertMatch ( stderr, hiddenLibSwiftScanWarnPattern )
2326
2328
}
2327
2329
2328
2330
try await runPlugin ( flags: [ " -q " ] , diagnostics: [ " print " , " progress " ] ) { stdout, stderr in
@@ -2461,7 +2463,11 @@ final class PackageCommandTests: CommandsTestCase {
2461
2463
let containsLogtext = StringPattern . contains ( " command plugin: packageManager.build logtext: Building for debugging... " )
2462
2464
2463
2465
// Echoed logs have no prefix
2464
- let containsLogecho = StringPattern . regex ( " ^Building for debugging... \n " )
2466
+ let containsLogecho = StringPattern . contains ( " Building for debugging... \n " )
2467
+
2468
+ // Hides the libSwiftScan library from the driver
2469
+ let hiddenLibSwiftScanWarnPattern = StringPattern . equal (
2470
+ " warning: \' miscellaneous_plugins_commandpluginteststub \' : warning: Unable to locate libSwiftScan. Fallback to `swift-frontend` dependency scanner invocation. \n warning: Unable to locate libSwiftScan. Fallback to `swift-frontend` dependency scanner invocation. \n warning: Unable to locate libSwiftScan. Fallback to `swift-frontend` dependency scanner invocation. " )
2465
2471
2466
2472
// These tests involve building a target, so each test must run with a fresh copy of the fixture
2467
2473
// otherwise the logs may be different in subsequent tests.
@@ -2470,14 +2476,14 @@ final class PackageCommandTests: CommandsTestCase {
2470
2476
try await fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2471
2477
let ( stdout, stderr) = try await SwiftPM . Package. execute ( [ " print-diagnostics " , " build " ] , packagePath: fixturePath, env: [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
2472
2478
XCTAssertMatch ( stdout, isEmpty)
2473
- XCTAssertMatch ( stderr, isEmpty )
2479
+ XCTAssertMatch ( stderr, hiddenLibSwiftScanWarnPattern )
2474
2480
}
2475
2481
2476
2482
// Check that logs are returned to the plugin when echoLogs is false
2477
2483
try await fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2478
2484
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
2485
XCTAssertMatch ( stdout, containsLogtext)
2480
- XCTAssertMatch ( stderr, isEmpty )
2486
+ XCTAssertMatch ( stderr, hiddenLibSwiftScanWarnPattern )
2481
2487
}
2482
2488
2483
2489
// Check that logs echoed to the console (on stderr) when echoLogs is true
0 commit comments