diff options
| author | Tom Eccles <tom.eccles@codethink.co.uk> | 2020-05-28 16:27:56 +0100 |
|---|---|---|
| committer | Tom Eccles <tom.eccles@codethink.co.uk> | 2020-06-02 14:00:18 +0100 |
| commit | 1b7ec76c16b18b01acd07f987db488a642492049 (patch) | |
| tree | ed4961c72107e0178397328e865d4c291d79d8e8 /src | |
| parent | eeaf497b2a6bc065874e3d3367b1f3023c5bb3d3 (diff) | |
| download | rust-1b7ec76c16b18b01acd07f987db488a642492049.tar.gz rust-1b7ec76c16b18b01acd07f987db488a642492049.zip | |
tools/remote-test-{server,client}: support RUST_TEST_TMPDIR
Some tests (e.g. ui-fulldeps/create-dir-all-bare.rs) assume that
RUST_TEST_TMPDIR exists on the system running the test. Expand
remote-test-{server,client} such that a tmp directory is created on the
remote runner and this environment variable will point at it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/remote-test-client/src/main.rs | 2 | ||||
| -rw-r--r-- | src/tools/remote-test-server/src/main.rs | 21 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs index 259477e9a1c..efc29163455 100644 --- a/src/tools/remote-test-client/src/main.rs +++ b/src/tools/remote-test-client/src/main.rs @@ -224,7 +224,7 @@ fn run(support_lib_count: usize, exe: String, all_args: Vec<String>) { // by the client. for (k, v) in env::vars() { match &k[..] { - "PATH" | "LD_LIBRARY_PATH" | "PWD" => continue, + "PATH" | "LD_LIBRARY_PATH" | "PWD" | "RUST_TEST_TMPDIR" => continue, _ => {} } t!(client.write_all(k.as_bytes())); diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index e7eff35e557..ce8e52a42f3 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -83,16 +83,19 @@ fn main() { }; let listener = t!(TcpListener::bind(bind_addr)); - let work: PathBuf = if cfg!(target_os = "android") { - "/data/tmp/work".into() + let (work, tmp): (PathBuf, PathBuf) = if cfg!(target_os = "android") { + ("/data/tmp/work".into(), "/data/tmp/work/tmp".into()) } else { - let mut temp_dir = env::temp_dir(); - temp_dir.push("work"); - temp_dir + let mut work_dir = env::temp_dir(); + work_dir.push("work"); + let mut tmp_dir = work_dir.clone(); + tmp_dir.push("tmp"); + (work_dir, tmp_dir) }; println!("listening!"); t!(fs::create_dir_all(&work)); + t!(fs::create_dir_all(&tmp)); let lock = Arc::new(Mutex::new(())); @@ -109,7 +112,8 @@ fn main() { } else if &buf[..] == b"run " { let lock = lock.clone(); let work = work.clone(); - thread::spawn(move || handle_run(socket, &work, &lock)); + let tmp = tmp.clone(); + thread::spawn(move || handle_run(socket, &work, &tmp, &lock)); } else { panic!("unknown command {:?}", buf); } @@ -134,7 +138,7 @@ impl Drop for RemoveOnDrop<'_> { } } -fn handle_run(socket: TcpStream, work: &Path, lock: &Mutex<()>) { +fn handle_run(socket: TcpStream, work: &Path, tmp: &Path, lock: &Mutex<()>) { let mut arg = Vec::new(); let mut reader = BufReader::new(socket); @@ -226,6 +230,9 @@ fn handle_run(socket: TcpStream, work: &Path, lock: &Mutex<()>) { cmd.env("LD_LIBRARY_PATH", format!("{}:{}", work.display(), path.display())); } + // Some tests assume RUST_TEST_TMPDIR exists + cmd.env("RUST_TEST_TMPDIR", tmp.to_owned()); + // Spawn the child and ferry over stdout/stderr to the socket in a framed // fashion (poor man's style) let mut child = |
