From a072ecbf70eef05f2904031169e493782d65dd37 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Wed, 20 Jan 2021 17:14:15 +0000 Subject: [PATCH 1/2] Don't build remote-test-server with the stage0 toolchain Newly added targets aren't available on the stage0 toolchain. --- src/bootstrap/test.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 335a173100290..ef2790e3f3809 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1932,8 +1932,7 @@ impl Step for RemoteCopyLibs { builder.info(&format!("REMOTE copy libs to emulator ({})", target)); t!(fs::create_dir_all(builder.out.join("tmp"))); - let server = - builder.ensure(tool::RemoteTestServer { compiler: compiler.with_stage(0), target }); + let server = builder.ensure(tool::RemoteTestServer { compiler, target }); // Spawn the emulator and wait for it to come online let tool = builder.tool_exe(Tool::RemoteTestClient); From b5482a8f166b952f397be0432dec062b5b0ca105 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Wed, 20 Jan 2021 18:37:14 +0000 Subject: [PATCH 2/2] Preserve existing LD_LIBRARY_PATH in remote-test-server --- src/tools/remote-test-server/src/main.rs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index d92758eb7474c..cd9d530096496 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -218,25 +218,19 @@ fn handle_run(socket: TcpStream, work: &Path, tmp: &Path, lock: &Mutex<()>, conf cmd.args(args); cmd.envs(env); + // On windows, libraries are just searched in the executable directory, + // system directories, PWD, and PATH, in that order. PATH is the only one + // we can change for this. + let library_path = if cfg!(windows) { "PATH" } else { "LD_LIBRARY_PATH" }; + // Support libraries were uploaded to `work` earlier, so make sure that's // in `LD_LIBRARY_PATH`. Also include our own current dir which may have // had some libs uploaded. - if cfg!(windows) { - // On windows, libraries are just searched in the executable directory, - // system directories, PWD, and PATH, in that order. PATH is the only one - // we can change for this. - cmd.env( - "PATH", - env::join_paths( - std::iter::once(work.to_owned()) - .chain(std::iter::once(path.clone())) - .chain(env::split_paths(&env::var_os("PATH").unwrap())), - ) - .unwrap(), - ); - } else { - cmd.env("LD_LIBRARY_PATH", format!("{}:{}", work.display(), path.display())); + let mut paths = vec![work.to_owned(), path.clone()]; + if let Some(library_path) = env::var_os(library_path) { + paths.extend(env::split_paths(&library_path)); } + cmd.env(library_path, env::join_paths(paths).unwrap()); // Some tests assume RUST_TEST_TMPDIR exists cmd.env("RUST_TEST_TMPDIR", tmp.to_owned());