@@ -1953,13 +1953,13 @@ final class PackageCommandTests: CommandsTestCase {
19531953
19541954 try fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
19551955 func runPlugin( flags: [ String ] , diagnostics: [ String ] , completion: ( String , String ) -> Void ) throws {
1956- let ( stdout, stderr) = try SwiftPM . Package. execute ( flags + [ " print-diagnostics " ] + diagnostics, packagePath: fixturePath)
1956+ let ( stdout, stderr) = try SwiftPM . Package. execute ( flags + [ " print-diagnostics " ] + diagnostics, packagePath: fixturePath, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
19571957 completion ( stdout, stderr)
19581958 }
19591959
19601960 // Diagnostics.error causes SwiftPM to return a non-zero exit code, but we still need to check stdout and stderr
19611961 func runPluginWithError( flags: [ String ] , diagnostics: [ String ] , completion: ( String , String ) -> Void ) throws {
1962- XCTAssertThrowsError ( try SwiftPM . Package. execute ( flags + [ " print-diagnostics " ] + diagnostics, packagePath: fixturePath) ) { error in
1962+ XCTAssertThrowsError ( try SwiftPM . Package. execute ( flags + [ " print-diagnostics " ] + diagnostics, packagePath: fixturePath, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] ) ) { error in
19631963 guard case SwiftPMError . executionFailure( _, let stdout, let stderr) = error else {
19641964 return XCTFail ( " invalid error \( error) " )
19651965 }
@@ -2151,28 +2151,28 @@ final class PackageCommandTests: CommandsTestCase {
21512151
21522152 // Check than nothing is echoed when echoLogs is false
21532153 try fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2154- let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " ] , packagePath: fixturePath)
2154+ let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " ] , packagePath: fixturePath, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
21552155 XCTAssertMatch ( stdout, isEmpty)
21562156 XCTAssertMatch ( stderr, isEmpty)
21572157 }
21582158
21592159 // Check that logs are returned to the plugin when echoLogs is false
21602160 try fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2161- let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " , " printlogs " ] , packagePath: fixturePath)
2161+ let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " , " printlogs " ] , packagePath: fixturePath, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
21622162 XCTAssertMatch ( stdout, containsLogtext)
21632163 XCTAssertMatch ( stderr, isEmpty)
21642164 }
21652165
21662166 // Check that logs echoed to the console (on stderr) when echoLogs is true
21672167 try fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2168- let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " , " echologs " ] , packagePath: fixturePath)
2168+ let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " , " echologs " ] , packagePath: fixturePath, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
21692169 XCTAssertMatch ( stdout, isEmpty)
21702170 XCTAssertMatch ( stderr, containsLogecho)
21712171 }
21722172
21732173 // Check that logs are returned to the plugin and echoed to the console (on stderr) when echoLogs is true
21742174 try fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
2175- let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " , " printlogs " , " echologs " ] , packagePath: fixturePath)
2175+ let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " print-diagnostics " , " build " , " printlogs " , " echologs " ] , packagePath: fixturePath, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
21762176 XCTAssertMatch ( stdout, containsLogtext)
21772177 XCTAssertMatch ( stderr, containsLogecho)
21782178 }
@@ -2465,14 +2465,14 @@ final class PackageCommandTests: CommandsTestCase {
24652465
24662466 // Check arguments
24672467 do {
2468- let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " plugin " , " MyPlugin " , " --foo " , " --help " , " --version " , " --verbose " ] , packagePath: packageDir)
2468+ let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " plugin " , " MyPlugin " , " --foo " , " --help " , " --version " , " --verbose " ] , packagePath: packageDir, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
24692469 XCTAssertMatch ( stdout, . contains( " success " ) )
24702470 XCTAssertEqual ( stderr, " " )
24712471 }
24722472
24732473 // Check default command arguments
24742474 do {
2475- let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " MyPlugin " , " --foo " , " --help " , " --version " , " --verbose " ] , packagePath: packageDir)
2475+ let ( stdout, stderr) = try SwiftPM . Package. execute ( [ " MyPlugin " , " --foo " , " --help " , " --version " , " --verbose " ] , packagePath: packageDir, env : [ " SWIFT_DRIVER_SWIFTSCAN_LIB " : " /this/is/a/bad/path " ] )
24762476 XCTAssertMatch ( stdout, . contains( " success " ) )
24772477 XCTAssertEqual ( stderr, " " )
24782478 }
0 commit comments