Skip to content

Commit 7e171c7

Browse files
committed
Use env::split_paths/join_paths in runtest
1 parent 8a5409b commit 7e171c7

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/tools/compiletest/src/runtest.rs

+15-16
Original file line numberDiff line numberDiff line change
@@ -3785,10 +3785,13 @@ impl<'test> TestCx<'test> {
37853785
debug!(?support_lib_deps);
37863786
debug!(?support_lib_deps_deps);
37873787

3788-
let mut host_dylib_env_paths = String::new();
3789-
host_dylib_env_paths.push_str(&cwd.join(&self.config.compile_lib_path).to_string_lossy());
3790-
host_dylib_env_paths.push(':');
3791-
host_dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
3788+
let orig_dylib_env_paths =
3789+
Vec::from_iter(env::split_paths(&env::var(dylib_env_var()).unwrap()));
3790+
3791+
let mut host_dylib_env_paths = Vec::new();
3792+
host_dylib_env_paths.push(cwd.join(&self.config.compile_lib_path));
3793+
host_dylib_env_paths.extend(orig_dylib_env_paths.iter().cloned());
3794+
let host_dylib_env_paths = env::join_paths(host_dylib_env_paths).unwrap();
37923795

37933796
let mut cmd = Command::new(&self.config.rustc_path);
37943797
cmd.arg("-o")
@@ -3834,19 +3837,15 @@ impl<'test> TestCx<'test> {
38343837
// Finally, we need to run the recipe binary to build and run the actual tests.
38353838
debug!(?recipe_bin);
38363839

3837-
let mut dylib_env_paths = String::new();
3838-
dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
3839-
dylib_env_paths.push(':');
3840-
dylib_env_paths.push_str(&support_lib_path.parent().unwrap().to_string_lossy());
3841-
dylib_env_paths.push(':');
3842-
dylib_env_paths.push_str(
3843-
&stage_std_path.join("rustlib").join(&self.config.host).join("lib").to_string_lossy(),
3844-
);
3840+
let mut dylib_env_paths = orig_dylib_env_paths.clone();
3841+
dylib_env_paths.push(support_lib_path.parent().unwrap().to_path_buf());
3842+
dylib_env_paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
3843+
let dylib_env_paths = env::join_paths(dylib_env_paths).unwrap();
38453844

3846-
let mut target_rpath_env_path = String::new();
3847-
target_rpath_env_path.push_str(&tmpdir.to_string_lossy());
3848-
target_rpath_env_path.push(':');
3849-
target_rpath_env_path.push_str(&dylib_env_paths);
3845+
let mut target_rpath_env_path = Vec::new();
3846+
target_rpath_env_path.push(&tmpdir);
3847+
target_rpath_env_path.extend(&orig_dylib_env_paths);
3848+
let target_rpath_env_path = env::join_paths(target_rpath_env_path).unwrap();
38503849

38513850
let mut cmd = Command::new(&recipe_bin);
38523851
cmd.current_dir(&self.testpaths.file)

0 commit comments

Comments
 (0)