@@ -145,15 +145,7 @@ fileprivate struct BuildOperationTests: CoreBasedTests {
145145 try await tester. checkBuild ( runDestination: destination, signableTargets: Set ( provisioningInputs. keys) , signableTargetInputs: provisioningInputs) { results in
146146 results. checkNoErrors ( )
147147
148- let toolchain = try #require( core. toolchainRegistry. defaultToolchain)
149- let environment : Environment
150- if destination. imageFormat ( core) == . elf {
151- environment = [ " LD_LIBRARY_PATH " : toolchain. path. join ( " usr/lib/swift/ \( destination. platform) " ) . str]
152- } else {
153- environment = . init( )
154- }
155-
156- let executionResult = try await Process . getOutput ( url: URL ( fileURLWithPath: projectDir. join ( " build " ) . join ( " Debug \( destination. builtProductsDirSuffix) " ) . join ( core. hostOperatingSystem. imageFormat. executableName ( basename: " tool " ) ) . str) , arguments: [ ] , environment: environment)
148+ let executionResult = try await Process . getOutput ( url: URL ( fileURLWithPath: projectDir. join ( " build " ) . join ( " Debug \( destination. builtProductsDirSuffix) " ) . join ( core. hostOperatingSystem. imageFormat. executableName ( basename: " tool " ) ) . str) , arguments: [ ] , environment: destination. hostRuntimeEnvironment ( core) )
157149 #expect( executionResult. exitStatus == . exit( 0 ) )
158150 if core. hostOperatingSystem == . windows {
159151 #expect( String ( decoding: executionResult. stdout, as: UTF8 . self) == " Hello world \r \n " )
@@ -378,15 +370,7 @@ fileprivate struct BuildOperationTests: CoreBasedTests {
378370 }
379371 }
380372
381- let toolchain = try #require( try await getCore ( ) . toolchainRegistry. defaultToolchain)
382- let environment : Environment
383- if destination. platform == " linux " {
384- environment = [ " LD_LIBRARY_PATH " : toolchain. path. join ( " usr/lib/swift/linux " ) . str]
385- } else {
386- environment = . init( )
387- }
388-
389- let executionResult = try await Process . getOutput ( url: URL ( fileURLWithPath: projectDir. join ( " build " ) . join ( " Debug \( destination. builtProductsDirSuffix) " ) . join ( core. hostOperatingSystem. imageFormat. executableName ( basename: " tool " ) ) . str) , arguments: [ ] , environment: environment)
373+ let executionResult = try await Process . getOutput ( url: URL ( fileURLWithPath: projectDir. join ( " build " ) . join ( " Debug \( destination. builtProductsDirSuffix) " ) . join ( core. hostOperatingSystem. imageFormat. executableName ( basename: " tool " ) ) . str) , arguments: [ ] , environment: destination. hostRuntimeEnvironment ( core) )
390374 #expect( executionResult. exitStatus == . exit( 0 ) )
391375 if core. hostOperatingSystem == . windows {
392376 #expect( String ( decoding: executionResult. stdout, as: UTF8 . self) == " Hello world \r \n " )
@@ -508,13 +492,7 @@ fileprivate struct BuildOperationTests: CoreBasedTests {
508492 try await tester. checkBuild ( runDestination: destination, persistent: true ) { results in
509493 results. checkNoErrors ( )
510494
511- let toolchain = try #require( try await getCore ( ) . toolchainRegistry. defaultToolchain)
512- let environment : Environment
513- if destination. platform == " linux " {
514- environment = [ " LD_LIBRARY_PATH " : " \( toolchain. path. join ( " usr/lib/swift/linux " ) . str) : \( projectDir. join ( " build " ) . join ( " Debug \( destination. builtProductsDirSuffix) " ) ) " ]
515- } else {
516- environment = . init( )
517- }
495+ let environment = destination. hostRuntimeEnvironment ( core)
518496
519497 do {
520498 let executionResult = try await Process . getOutput ( url: URL ( fileURLWithPath: projectDir. join ( " build " ) . join ( " Debug \( destination. builtProductsDirSuffix) " ) . join ( core. hostOperatingSystem. imageFormat. executableName ( basename: " UnitTestRunner " ) ) . str) , arguments: [ ] , environment: environment)
0 commit comments