Skip to content

Commit 507414d

Browse files
committed
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.
1 parent 5efe1e5 commit 507414d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

mk/clean.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ clean-misc:
5050
$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
5151
$(Q)rm -Rf $(DOCS)
5252
$(Q)rm -Rf $(GENERATED)
53-
$(Q)rm -f tmp/*
53+
$(Q)rm -Rf tmp/*
5454
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist
5555
$(Q)rm -Rf $(foreach ext, \
5656
html aux cp fn ky log pdf pg toc tp vr cps, \

src/libextra/glob.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,21 @@ impl MatchOptions {
448448
#[cfg(test)]
449449
mod test {
450450
use std::{io, os, unstable};
451+
use std::unstable::finally::Finally;
451452
use super::*;
453+
use tempfile;
452454
453455
#[test]
454456
fn test_relative_pattern() {
455457
458+
fn change_then_remove(p: &Path, f: &fn()) {
459+
do (|| {
460+
unstable::change_dir_locked(p, || f());
461+
}).finally {
462+
os::remove_dir_recursive(p);
463+
}
464+
}
465+
456466
fn mk_file(path: &str, directory: bool) {
457467
if directory {
458468
os::make_dir(&Path(path), 0xFFFF);
@@ -469,10 +479,10 @@ mod test {
469479
glob(pattern).collect()
470480
}
471481
472-
mk_file("tmp", true);
473-
mk_file("tmp/glob-tests", true);
482+
let root = tempfile::mkdtemp(&os::tmpdir(), "glob-tests");
483+
let root = root.expect("Should have created a temp directory");
474484
475-
do unstable::change_dir_locked(&Path("tmp/glob-tests")) {
485+
do change_then_remove(&root) {
476486
477487
mk_file("aaa", true);
478488
mk_file("aaa/apple", true);

0 commit comments

Comments
 (0)