about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-09-13 21:41:28 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-09-13 21:58:00 -0700
commit0af2bd829e6aaab4faf2cc135bd8b01db728417b (patch)
tree3005f9d734e173f60ba589e0808b130a04e93bee /src/libextra
parenta241deb97931b7c993e88c600d2b35912730a7e8 (diff)
downloadrust-0af2bd829e6aaab4faf2cc135bd8b01db728417b.tar.gz
rust-0af2bd829e6aaab4faf2cc135bd8b01db728417b.zip
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).
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/tempfile.rs97
1 files changed, 3 insertions, 94 deletions
diff --git a/src/libextra/tempfile.rs b/src/libextra/tempfile.rs
index cb1bde14056..9044c23ff7a 100644
--- a/src/libextra/tempfile.rs
+++ b/src/libextra/tempfile.rs
@@ -28,97 +28,6 @@ pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> {
     None
 }
 
-#[cfg(test)]
-mod tests {
-
-    use tempfile::mkdtemp;
-
-    use std::os;
-
-    #[test]
-    fn test_mkdtemp() {
-        let p = mkdtemp(&Path("."), "foobar").unwrap();
-        os::remove_dir(&p);
-        assert!(p.to_str().ends_with("foobar"));
-    }
-
-    // Ideally these would be in std::os but then core would need
-    // to depend on std
-    #[test]
-    fn recursive_mkdir_rel() {
-        use std::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
-        use std::os;
-        use std::unstable::change_dir_locked;
-
-        let root = mkdtemp(&os::tmpdir(), "recursive_mkdir_rel").
-            expect("recursive_mkdir_rel");
-        assert!(do change_dir_locked(&root) {
-            let path = Path("frob");
-            debug!("recursive_mkdir_rel: Making: %s in cwd %s [%?]", path.to_str(),
-                   os::getcwd().to_str(),
-                   os::path_exists(&path));
-            assert!(os::mkdir_recursive(&path,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-            assert!(os::path_is_dir(&path));
-            assert!(os::mkdir_recursive(&path,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-            assert!(os::path_is_dir(&path));
-        });
-    }
-
-    #[test]
-    fn recursive_mkdir_dot() {
-        use std::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
-        use std::os;
-
-        let dot = Path(".");
-        assert!(os::mkdir_recursive(&dot,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-        let dotdot = Path("..");
-        assert!(os::mkdir_recursive(&dotdot,  (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-    }
-
-    #[test]
-    fn recursive_mkdir_rel_2() {
-        use std::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
-        use std::os;
-        use std::unstable::change_dir_locked;
-
-        let root = mkdtemp(&os::tmpdir(), "recursive_mkdir_rel_2").
-            expect("recursive_mkdir_rel_2");
-        assert!(do change_dir_locked(&root) {
-            let path = Path("./frob/baz");
-            debug!("recursive_mkdir_rel_2: Making: %s in cwd %s [%?]", path.to_str(),
-                   os::getcwd().to_str(), os::path_exists(&path));
-            assert!(os::mkdir_recursive(&path, (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-                assert!(os::path_is_dir(&path));
-            assert!(os::path_is_dir(&path.pop()));
-            let path2 = Path("quux/blat");
-            debug!("recursive_mkdir_rel_2: Making: %s in cwd %s", path2.to_str(),
-                   os::getcwd().to_str());
-            assert!(os::mkdir_recursive(&path2, (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
-                assert!(os::path_is_dir(&path2));
-            assert!(os::path_is_dir(&path2.pop()));
-        });
-    }
-
-    // Ideally this would be in core, but needs mkdtemp
-    #[test]
-    pub fn test_rmdir_recursive_ok() {
-        use std::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
-        use std::os;
-
-        let rwx = (S_IRUSR | S_IWUSR | S_IXUSR) as i32;
-
-        let tmpdir = mkdtemp(&os::tmpdir(), "test").expect("test_rmdir_recursive_ok: \
-                                            couldn't create temp dir");
-        let root = tmpdir.push("foo");
-
-        debug!("making %s", root.to_str());
-        assert!(os::make_dir(&root, rwx));
-        assert!(os::make_dir(&root.push("foo"), rwx));
-        assert!(os::make_dir(&root.push("foo").push("bar"), rwx));
-        assert!(os::make_dir(&root.push("foo").push("bar").push("blat"), rwx));
-        assert!(os::remove_dir_recursive(&root));
-        assert!(!os::path_exists(&root));
-        assert!(!os::path_exists(&root.push("bar")));
-        assert!(!os::path_exists(&root.push("bar").push("blat")));
-    }
-}
+// the tests for this module need to change the path using change_dir,
+// and this doesn't play nicely with other tests so these unit tests are located
+// in src/test/run-pass/tempfile.rs