Skip to content

Commit 907bfe7

Browse files
committed
Make sure test directory exists
1 parent ab56479 commit 907bfe7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/support/paths.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::fs;
33
use std::io::prelude::*;
44
use std::io::{self, ErrorKind};
55
use std::path::{Path, PathBuf};
6+
use std::sync::{Once, ONCE_INIT};
67
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
78

89
static CARGO_INTEGRATION_TEST_DIR : &'static str = "cit";
@@ -101,6 +102,10 @@ impl CargoPathExt for Path {
101102
/// Ensure required test directories exist and are empty
102103
pub fn setup() {
103104
debug!("path setup; root={}; home={}", root().display(), home().display());
105+
static INIT: Once = ONCE_INIT;
106+
INIT.call_once(|| {
107+
root().parent().unwrap().mkdir_p().unwrap();
108+
});
104109
root().rm_rf().unwrap();
105110
home().mkdir_p().unwrap();
106111
}

0 commit comments

Comments
 (0)