@@ -335,14 +335,13 @@ impl<'test> TestCx<'test> {
335335 . args ( & [ "--target" , & self . config . target ] )
336336 . arg ( "-L" ) . arg ( & aux_dir)
337337 . args ( self . split_maybe_args ( & self . config . target_rustcflags ) )
338- . args ( & self . props . compile_flags ) ;
338+ . args ( & self . props . compile_flags )
339+ . envs ( self . props . exec_env . clone ( ) ) ;
339340
340341 self . compose_and_run ( rustc,
341- self . props . exec_env . clone ( ) ,
342342 self . config . compile_lib_path . to_str ( ) . unwrap ( ) ,
343343 Some ( aux_dir. to_str ( ) . unwrap ( ) ) ,
344- Some ( src) ,
345- None )
344+ Some ( src) )
346345 }
347346
348347 fn compare_source ( & self ,
@@ -642,16 +641,13 @@ actual:\n\
642641 format!( "-command={}" , debugger_script. to_str( ) . unwrap( ) ) ] ;
643642
644643 let mut gdb = Command :: new ( self . config . gdb . as_ref ( ) . unwrap ( ) ) ;
645- gdb. args ( & debugger_opts) ;
646-
647- let environment = vec ! [ ( "PYTHONPATH" . to_owned( ) , rust_pp_module_abs_path) ] ;
644+ gdb. args ( & debugger_opts)
645+ . env ( "PYTHONPATH" , rust_pp_module_abs_path) ;
648646
649647 debugger_run_result =
650648 self . compose_and_run ( gdb,
651- environment,
652649 self . config . run_lib_path . to_str ( ) . unwrap ( ) ,
653650 None ,
654- None ,
655651 None ) ;
656652 }
657653 }
@@ -1203,30 +1199,26 @@ actual:\n\
12031199 }
12041200 let mut test_client = Command :: new (
12051201 self . config . remote_test_client . as_ref ( ) . unwrap ( ) ) ;
1206- test_client. args ( & [ "run" , & prog] ) ;
1207- test_client. args ( args) ;
1202+ test_client
1203+ . args ( & [ "run" , & prog] )
1204+ . args ( args)
1205+ . envs ( env. clone ( ) ) ;
12081206 self . compose_and_run ( test_client,
1209- env,
12101207 self . config . run_lib_path . to_str ( ) . unwrap ( ) ,
12111208 Some ( aux_dir. to_str ( ) . unwrap ( ) ) ,
1212- None ,
12131209 None )
12141210 }
12151211 _ => {
12161212 let aux_dir = self . aux_output_dir_name ( ) ;
1217- let working_dir =
1218- Some ( self . output_base_name ( )
1219- . parent ( ) . unwrap ( )
1220- . to_str ( ) . unwrap ( ) . to_owned ( ) ) ;
12211213 let ProcArgs { prog, args } = self . make_run_args ( ) ;
12221214 let mut program = Command :: new ( & prog) ;
1223- program. args ( args) ;
1215+ program. args ( args)
1216+ . current_dir ( & self . output_base_name ( ) . parent ( ) . unwrap ( ) )
1217+ . envs ( env. clone ( ) ) ;
12241218 self . compose_and_run ( program,
1225- env,
12261219 self . config . run_lib_path . to_str ( ) . unwrap ( ) ,
12271220 Some ( aux_dir. to_str ( ) . unwrap ( ) ) ,
1228- None ,
1229- working_dir)
1221+ None )
12301222 }
12311223 }
12321224 }
@@ -1304,10 +1296,8 @@ actual:\n\
13041296 let mut rustc = Command :: new ( prog) ;
13051297 rustc. args ( & args) ;
13061298 let auxres = aux_cx. compose_and_run ( rustc,
1307- Vec :: new ( ) ,
13081299 aux_cx. config . compile_lib_path . to_str ( ) . unwrap ( ) ,
13091300 Some ( aux_dir. to_str ( ) . unwrap ( ) ) ,
1310- None ,
13111301 None ) ;
13121302 if !auxres. status . success ( ) {
13131303 self . fatal_proc_rec (
@@ -1319,23 +1309,20 @@ actual:\n\
13191309
13201310 let ProcArgs { prog, args } = args;
13211311 let mut rustc = Command :: new ( prog) ;
1322- rustc. args ( args) ;
1312+ rustc. args ( args)
1313+ . envs ( self . props . rustc_env . clone ( ) ) ;
13231314
13241315 self . compose_and_run ( rustc,
1325- self . props . rustc_env . clone ( ) ,
13261316 self . config . compile_lib_path . to_str ( ) . unwrap ( ) ,
13271317 Some ( aux_dir. to_str ( ) . unwrap ( ) ) ,
1328- input,
1329- None )
1318+ input)
13301319 }
13311320
13321321 fn compose_and_run ( & self ,
13331322 mut command : Command ,
1334- procenv : Vec < ( String , String ) > ,
13351323 lib_path : & str ,
13361324 aux_path : Option < & str > ,
1337- input : Option < String > ,
1338- working_dir : Option < String > ) -> ProcRes {
1325+ input : Option < String > ) -> ProcRes {
13391326 let cmdline =
13401327 {
13411328 let cmdline = self . make_cmdline ( & command, lib_path) ;
@@ -1349,12 +1336,6 @@ actual:\n\
13491336 . stdin ( Stdio :: piped ( ) ) ;
13501337
13511338 procsrv:: add_target_env ( & mut command, lib_path, aux_path) ;
1352- for ( key, val) in procenv {
1353- command. env ( & key, & val) ;
1354- }
1355- if let Some ( cwd) = working_dir {
1356- command. current_dir ( cwd) ;
1357- }
13581339
13591340 let mut child = command. spawn ( ) . expect ( & format ! ( "failed to exec `{:?}`" , & command) ) ;
13601341 if let Some ( input) = input {
@@ -1706,10 +1687,9 @@ actual:\n\
17061687 fn check_ir_with_filecheck ( & self ) -> ProcRes {
17071688 let irfile = self . output_base_name ( ) . with_extension ( "ll" ) ;
17081689 let mut filecheck = Command :: new ( self . config . llvm_filecheck . as_ref ( ) . unwrap ( ) ) ;
1709- // FIXME (#9639): This needs to handle non-utf8 paths
1710- filecheck. arg ( & format ! ( "-input-file={}" , irfile. to_str( ) . unwrap( ) ) ) ;
1711- filecheck. arg ( & self . testpaths . file ) ;
1712- self . compose_and_run ( filecheck, Vec :: new ( ) , "" , None , None , None )
1690+ filecheck. arg ( "--input-file" ) . arg ( irfile)
1691+ . arg ( & self . testpaths . file ) ;
1692+ self . compose_and_run ( filecheck, "" , None , None )
17131693 }
17141694
17151695 fn run_codegen_test ( & self ) {
0 commit comments