@@ -3598,7 +3598,7 @@ impl<'test> TestCx<'test> {
35983598 } ;
35993599
36003600 // Calculate the paths of the recipe binary. As previously discussed, this is placed at
3601- // `<base_dir>/<bin_name>` with `bin_name` being `rmake` or `rmake.exe` dependending on
3601+ // `<base_dir>/<bin_name>` with `bin_name` being `rmake` or `rmake.exe` depending on
36023602 // platform.
36033603 let recipe_bin = {
36043604 let mut p = base_dir. join ( "rmake" ) ;
@@ -3611,7 +3611,6 @@ impl<'test> TestCx<'test> {
36113611 // FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc!
36123612 let mut rustc = Command :: new ( & self . config . rustc_path ) ;
36133613 rustc
3614- // Specify output path
36153614 . arg ( "-o" )
36163615 . arg ( & recipe_bin)
36173616 // Specify library search paths for `run_make_support`.
@@ -3622,9 +3621,7 @@ impl<'test> TestCx<'test> {
36223621 // `extern run_make_support;`.
36233622 . arg ( "--extern" )
36243623 . arg ( format ! ( "run_make_support={}" , & support_lib_path. to_string_lossy( ) ) )
3625- // Default to Edition 2021.
36263624 . arg ( "--edition=2021" )
3627- // The recipe file itself.
36283625 . arg ( & self . testpaths . file . join ( "rmake.rs" ) )
36293626 // Provide necessary library search paths for rustc.
36303627 . env ( dylib_env_var ( ) , & env:: join_paths ( host_dylib_search_paths) . unwrap ( ) ) ;
@@ -3696,20 +3693,37 @@ impl<'test> TestCx<'test> {
36963693
36973694 // FIXME(jieyouxu): explain what the hecc we are doing here.
36983695 // FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc!
3696+ // FIXME(jieyouxu): please rename `TARGET_RPATH_ENV`, `HOST_RPATH_DIR` and
3697+ // `TARGET_RPATH_DIR`, it is **extremely** confusing!
36993698 let mut cmd = Command :: new ( & recipe_bin) ;
37003699 cmd. current_dir ( & rmake_out_dir)
37013700 . stdout ( Stdio :: piped ( ) )
37023701 . stderr ( Stdio :: piped ( ) )
3702+ // Provide the target-specific env var that is used to record dylib search paths. For
3703+ // example, this could be `LD_LIBRARY_PATH` on some linux distros but `PATH` on Windows.
37033704 . env ( "LD_LIB_PATH_ENVVAR" , dylib_env_var ( ) )
3704- . env ( "TARGET_RPATH_ENV" , & env :: join_paths ( target_runtime_dylib_search_paths ) . unwrap ( ) )
3705+ // Provide the dylib search paths.
37053706 . env ( dylib_env_var ( ) , & env:: join_paths ( recipe_dylib_search_paths) . unwrap ( ) )
3707+ // Provide runtime dylib search paths.
3708+ . env ( "TARGET_RPATH_ENV" , & env:: join_paths ( target_runtime_dylib_search_paths) . unwrap ( ) )
3709+ // Provide the target.
37063710 . env ( "TARGET" , & self . config . target )
3711+ // Some tests unfortunately still need Python, so provide path to a Python interpreter.
37073712 . env ( "PYTHON" , & self . config . python )
3713+ // Provide path to checkout root. This is the top-level directory containing
3714+ // rust-lang/rust checkout.
37083715 . env ( "SOURCE_ROOT" , & source_root)
3709- . env ( "RUST_BUILD_STAGE" , & self . config . stage_id )
3716+ // Provide path to stage-corresponding rustc.
37103717 . env ( "RUSTC" , & self . config . rustc_path )
3718+ // Provide the directory to libraries that are needed to run the *compiler*. This is not
3719+ // to be confused with `TARGET_RPATH_ENV` or `TARGET_RPATH_DIR`. This is needed if the
3720+ // recipe wants to invoke rustc.
37113721 . env ( "HOST_RPATH_DIR" , & self . config . compile_lib_path )
3722+ // Provide the directory to libraries that might be needed to run compiled binaries
3723+ // (further compiled by the recipe!).
37123724 . env ( "TARGET_RPATH_DIR" , & self . config . run_lib_path )
3725+ // Provide which LLVM components are available (e.g. which LLVM components are provided
3726+ // through a specific CI runner).
37133727 . env ( "LLVM_COMPONENTS" , & self . config . llvm_components ) ;
37143728
37153729 if let Some ( ref rustdoc) = self . config . rustdoc_path {
0 commit comments