From 507414daf9ed9a91ba04e3715f02353e31411a0c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 6 Sep 2013 00:17:14 -0700 Subject: Un-hork the bots by removing intermediate files 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. --- src/libextra/glob.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/libextra') 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); -- cgit 1.4.1-3-g733a5