Remove all usage of change_dir_locked

While usage of change_dir_locked is synchronized against itself, it's not
synchronized against other relative path usage, so I'm of the opinion that it
just really doesn't help in running tests. In order to prevent the problems that
have been cropping up, this completely removes the function.

All existing tests (except one) using it have been moved to run-pass tests where
they get their own process and don't need to be synchronized with anyone else.

There is one now-ignored rustpkg test because when I moved it to a run-pass test
apparently run-pass isn't set up to have 'extern mod rustc' (it ends up having
linkage failures).
This commit is contained in:
Alex Crichton 2013-09-13 21:41:28 -07:00
parent a241deb979
commit 0af2bd829e
7 changed files with 119 additions and 178 deletions

View file

@ -819,26 +819,25 @@ fn rust_path_test() {
}
#[test]
#[ignore] // FIXME(#9184) tests can't change the cwd (other tests are sad then)
fn rust_path_contents() {
use std::unstable::change_dir_locked;
let dir = mkdtemp(&os::tmpdir(), "rust_path").expect("rust_path_contents failed");
let abc = &dir.push("A").push("B").push("C");
assert!(os::mkdir_recursive(&abc.push(".rust"), U_RWX));
assert!(os::mkdir_recursive(&abc.pop().push(".rust"), U_RWX));
assert!(os::mkdir_recursive(&abc.pop().pop().push(".rust"), U_RWX));
assert!(do change_dir_locked(&dir.push("A").push("B").push("C")) {
let p = rust_path();
let cwd = os::getcwd().push(".rust");
let parent = cwd.pop().pop().push(".rust");
let grandparent = cwd.pop().pop().pop().push(".rust");
assert!(p.contains(&cwd));
assert!(p.contains(&parent));
assert!(p.contains(&grandparent));
for a_path in p.iter() {
assert!(!a_path.components.is_empty());
}
});
assert!(os::change_dir(abc));
let p = rust_path();
let cwd = os::getcwd().push(".rust");
let parent = cwd.pop().pop().push(".rust");
let grandparent = cwd.pop().pop().pop().push(".rust");
assert!(p.contains(&cwd));
assert!(p.contains(&parent));
assert!(p.contains(&grandparent));
for a_path in p.iter() {
assert!(!a_path.components.is_empty());
}
}
#[test]