Skip to content

Commit 6e467b7

Browse files
committed
Fix test to work with remote-test-server.
remote-test-server does not set the current_dir, and leaves it as `/`.
1 parent fcbcc97 commit 6e467b7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: src/test/ui/command/command-current-dir.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ fn main() {
1616
std::process::exit(0);
1717
}
1818
let exe = me.file_name().unwrap();
19-
let cwd = std::env::current_dir().unwrap();
19+
let cwd = me.parent().unwrap();
2020
eprintln!("cwd={:?}", cwd);
21+
// Change directory to where the exectuable is located, since this test
22+
// fundamentally needs to use relative paths. In some cases (like
23+
// remote-test-server), the current_dir can be somewhere else, so make
24+
// sure it is something we can use. We assume we can write to this
25+
// directory.
26+
env::set_current_dir(&cwd).unwrap();
2127
let foo = cwd.join("foo");
2228
let bar = cwd.join("bar");
2329
fs::create_dir_all(&foo).unwrap();

0 commit comments

Comments
 (0)