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.
This commit is contained in:
bors 2013-09-06 00:36:07 -07:00
commit b650da1673
2 changed files with 14 additions and 4 deletions

View File

@ -50,7 +50,7 @@ clean-misc:
$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF) $(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
$(Q)rm -Rf $(DOCS) $(Q)rm -Rf $(DOCS)
$(Q)rm -Rf $(GENERATED) $(Q)rm -Rf $(GENERATED)
$(Q)rm -f tmp/* $(Q)rm -Rf tmp/*
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist $(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist
$(Q)rm -Rf $(foreach ext, \ $(Q)rm -Rf $(foreach ext, \
html aux cp fn ky log pdf pg toc tp vr cps, \ html aux cp fn ky log pdf pg toc tp vr cps, \

View File

@ -448,11 +448,21 @@ impl MatchOptions {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::{io, os, unstable}; use std::{io, os, unstable};
use std::unstable::finally::Finally;
use super::*; use super::*;
use tempfile;
#[test] #[test]
fn test_relative_pattern() { 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) { fn mk_file(path: &str, directory: bool) {
if directory { if directory {
os::make_dir(&Path(path), 0xFFFF); os::make_dir(&Path(path), 0xFFFF);
@ -469,10 +479,10 @@ mod test {
glob(pattern).collect() glob(pattern).collect()
} }
mk_file("tmp", true); let root = tempfile::mkdtemp(&os::tmpdir(), "glob-tests");
mk_file("tmp/glob-tests", true); 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", true);
mk_file("aaa/apple", true); mk_file("aaa/apple", true);