Fix test to work with remote-test-server.

remote-test-server does not set the current_dir, and leaves it
as `/`.
This commit is contained in:
Eric Huss 2021-01-17 14:03:23 -08:00
parent fcbcc97576
commit 6e467b74cd

View File

@ -16,8 +16,14 @@ fn main() {
std::process::exit(0);
}
let exe = me.file_name().unwrap();
let cwd = std::env::current_dir().unwrap();
let cwd = me.parent().unwrap();
eprintln!("cwd={:?}", cwd);
// Change directory to where the exectuable is located, since this test
// fundamentally needs to use relative paths. In some cases (like
// remote-test-server), the current_dir can be somewhere else, so make
// sure it is something we can use. We assume we can write to this
// directory.
env::set_current_dir(&cwd).unwrap();
let foo = cwd.join("foo");
let bar = cwd.join("bar");
fs::create_dir_all(&foo).unwrap();