about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-06 00:36:07 -0700
committerbors <bors@rust-lang.org>2013-09-06 00:36:07 -0700
commitb650da1673370b58d648fb99708e9dfcbbf79689 (patch)
treeca5b07c84bf3ba240a03dce7a1091b4a6115f78e /src
parent5efe1e536575b61d0e8022a71c3f10d993fa1d00 (diff)
parent507414daf9ed9a91ba04e3715f02353e31411a0c (diff)
downloadrust-b650da1673370b58d648fb99708e9dfcbbf79689.tar.gz
rust-b650da1673370b58d648fb99708e9dfcbbf79689.zip
auto merge of #9018 : alexcrichton/rust/fix-bots, r=huonw
The new glob tests created tmp/glob-tests as a directory, but the never removed
it. The `make clean` target then attempted to `rm -f` on this, but it couldn't
remove the directory. This both changes the clean target to `rm -rf` tmp files,
and also alters the tests to delete the directory that all the files are added
into.
Diffstat (limited to 'src')
-rw-r--r--src/libextra/glob.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libextra/glob.rs b/src/libextra/glob.rs
index 75980497374..6f58102e00a 100644
--- a/src/libextra/glob.rs
+++ b/src/libextra/glob.rs
@@ -448,11 +448,21 @@ impl MatchOptions {
 #[cfg(test)]
 mod test {
     use std::{io, os, unstable};
+    use std::unstable::finally::Finally;
     use super::*;
+    use tempfile;
 
     #[test]
     fn test_relative_pattern() {
 
+        fn change_then_remove(p: &Path, f: &fn()) {
+            do (|| {
+                unstable::change_dir_locked(p, || f());
+            }).finally {
+                os::remove_dir_recursive(p);
+            }
+        }
+
         fn mk_file(path: &str, directory: bool) {
             if directory {
                 os::make_dir(&Path(path), 0xFFFF);
@@ -469,10 +479,10 @@ mod test {
             glob(pattern).collect()
         }
 
-        mk_file("tmp", true);
-        mk_file("tmp/glob-tests", true);
+        let root = tempfile::mkdtemp(&os::tmpdir(), "glob-tests");
+        let root = root.expect("Should have created a temp directory");
 
-        do unstable::change_dir_locked(&Path("tmp/glob-tests")) {
+        do change_then_remove(&root) {
 
             mk_file("aaa", true);
             mk_file("aaa/apple", true);