@@ -1953,13 +1953,13 @@ final class PackageCommandTests: CommandsTestCase {
1953
1953
1954
1954
try fixture ( name: " Miscellaneous/Plugins/CommandPluginTestStub " ) { fixturePath in
1955
1955
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 " ] )
1957
1957
completion ( stdout, stderr)
1958
1958
}
1959
1959
1960
1960
// Diagnostics.error causes SwiftPM to return a non-zero exit code, but we still need to check stdout and stderr
1961
1961
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
1963
1963
guard case SwiftPMError . executionFailure( _, let stdout, let stderr) = error else {
1964
1964
return XCTFail ( " invalid error \( error) " )
1965
1965
}
@@ -2151,28 +2151,28 @@ final class PackageCommandTests: CommandsTestCase {
2151
2151
2152
2152
// Check than nothing is echoed when echoLogs is false
2153
2153
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 " ] )
2155
2155
XCTAssertMatch ( stdout, isEmpty)
2156
2156
XCTAssertMatch ( stderr, isEmpty)
2157
2157
}
2158
2158
2159
2159
// Check that logs are returned to the plugin when echoLogs is false
2160
2160
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 " ] )
2162
2162
XCTAssertMatch ( stdout, containsLogtext)
2163
2163
XCTAssertMatch ( stderr, isEmpty)
2164
2164
}
2165
2165
2166
2166
// Check that logs echoed to the console (on stderr) when echoLogs is true
2167
2167
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 " ] )
2169
2169
XCTAssertMatch ( stdout, isEmpty)
2170
2170
XCTAssertMatch ( stderr, containsLogecho)
2171
2171
}
2172
2172
2173
2173
// Check that logs are returned to the plugin and echoed to the console (on stderr) when echoLogs is true
2174
2174
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 " ] )
2176
2176
XCTAssertMatch ( stdout, containsLogtext)
2177
2177
XCTAssertMatch ( stderr, containsLogecho)
2178
2178
}
@@ -2465,14 +2465,14 @@ final class PackageCommandTests: CommandsTestCase {
2465
2465
2466
2466
// Check arguments
2467
2467
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 " ] )
2469
2469
XCTAssertMatch ( stdout, . contains( " success " ) )
2470
2470
XCTAssertEqual ( stderr, " " )
2471
2471
}
2472
2472
2473
2473
// Check default command arguments
2474
2474
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 " ] )
2476
2476
XCTAssertMatch ( stdout, . contains( " success " ) )
2477
2477
XCTAssertEqual ( stderr, " " )
2478
2478
}
0 commit comments