@@ -3113,23 +3113,34 @@ impl Step for Bootstrap {
31133113 // Use `python -m unittest` manually if you want to pass arguments.
31143114 check_bootstrap. delay_failure ( ) . run ( builder) ;
31153115
3116- let mut cmd = command ( & builder. initial_cargo ) ;
3117- cmd. arg ( "test" )
3118- . current_dir ( builder. src . join ( "src/bootstrap" ) )
3119- . env ( "RUSTFLAGS" , "--cfg test -Cdebuginfo=2" )
3116+ let mut cargo = tool:: prepare_tool_cargo (
3117+ builder,
3118+ compiler,
3119+ Mode :: ToolBootstrap ,
3120+ host,
3121+ Kind :: Test ,
3122+ "src/bootstrap" ,
3123+ SourceType :: InTree ,
3124+ & [ ] ,
3125+ ) ;
3126+
3127+ cargo
3128+ . rustflag ( "-Cdebuginfo=2" )
31203129 . env ( "CARGO_TARGET_DIR" , builder. out . join ( "bootstrap" ) )
3121- . env ( "RUSTC_BOOTSTRAP" , "1" )
3122- . env ( "RUSTDOC" , builder. rustdoc ( compiler) )
3123- . env ( "RUSTC" , & builder. initial_rustc ) ;
3124- if let Some ( flags) = option_env ! ( "RUSTFLAGS" ) {
3125- // Use the same rustc flags for testing as for "normal" compilation,
3126- // so that Cargo doesn’t recompile the entire dependency graph every time:
3127- // https://github.com/rust-lang/rust/issues/49215
3128- cmd. env ( "RUSTFLAGS" , flags) ;
3129- }
3130+ . env ( "RUSTC_BOOTSTRAP" , "1" ) ;
3131+
31303132 // bootstrap tests are racy on directory creation so just run them one at a time.
31313133 // Since there's not many this shouldn't be a problem.
3132- run_cargo_test ( cmd, & [ "--test-threads=1" ] , & [ ] , "bootstrap" , None , compiler, host, builder) ;
3134+ run_cargo_test (
3135+ cargo,
3136+ & [ "--test-threads=1" ] ,
3137+ & [ ] ,
3138+ "bootstrap" ,
3139+ None ,
3140+ compiler,
3141+ host,
3142+ builder,
3143+ ) ;
31333144 }
31343145
31353146 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
0 commit comments