Use env::split_paths/join_paths in runtest

This commit is contained in:
Josh Stone 2024-04-11 15:33:44 -07:00
parent 8a5409bbdb
commit 7e171c72cb

View File

@ -3785,10 +3785,13 @@ fn run_rmake_v2_test(&self) {
debug!(?support_lib_deps); debug!(?support_lib_deps);
debug!(?support_lib_deps_deps); debug!(?support_lib_deps_deps);
let mut host_dylib_env_paths = String::new(); let orig_dylib_env_paths =
host_dylib_env_paths.push_str(&cwd.join(&self.config.compile_lib_path).to_string_lossy()); Vec::from_iter(env::split_paths(&env::var(dylib_env_var()).unwrap()));
host_dylib_env_paths.push(':');
host_dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap()); let mut host_dylib_env_paths = Vec::new();
host_dylib_env_paths.push(cwd.join(&self.config.compile_lib_path));
host_dylib_env_paths.extend(orig_dylib_env_paths.iter().cloned());
let host_dylib_env_paths = env::join_paths(host_dylib_env_paths).unwrap();
let mut cmd = Command::new(&self.config.rustc_path); let mut cmd = Command::new(&self.config.rustc_path);
cmd.arg("-o") cmd.arg("-o")
@ -3834,19 +3837,15 @@ fn run_rmake_v2_test(&self) {
// Finally, we need to run the recipe binary to build and run the actual tests. // Finally, we need to run the recipe binary to build and run the actual tests.
debug!(?recipe_bin); debug!(?recipe_bin);
let mut dylib_env_paths = String::new(); let mut dylib_env_paths = orig_dylib_env_paths.clone();
dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap()); dylib_env_paths.push(support_lib_path.parent().unwrap().to_path_buf());
dylib_env_paths.push(':'); dylib_env_paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
dylib_env_paths.push_str(&support_lib_path.parent().unwrap().to_string_lossy()); let dylib_env_paths = env::join_paths(dylib_env_paths).unwrap();
dylib_env_paths.push(':');
dylib_env_paths.push_str(
&stage_std_path.join("rustlib").join(&self.config.host).join("lib").to_string_lossy(),
);
let mut target_rpath_env_path = String::new(); let mut target_rpath_env_path = Vec::new();
target_rpath_env_path.push_str(&tmpdir.to_string_lossy()); target_rpath_env_path.push(&tmpdir);
target_rpath_env_path.push(':'); target_rpath_env_path.extend(&orig_dylib_env_paths);
target_rpath_env_path.push_str(&dylib_env_paths); let target_rpath_env_path = env::join_paths(target_rpath_env_path).unwrap();
let mut cmd = Command::new(&recipe_bin); let mut cmd = Command::new(&recipe_bin);
cmd.current_dir(&self.testpaths.file) cmd.current_dir(&self.testpaths.file)