Skip to content

Commit 7f45dc9

Browse files
committed
Add a random number string to the end of the issue-15149 test's child directory's name, and remove the directory after a successful test.
1 parent 918dd34 commit 7f45dc9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/test/run-pass/issue-15149.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::path::BytesContainer;
1211
use std::io::{Command, fs, USER_RWX};
1312
use std::os;
13+
use std::path::BytesContainer;
14+
use std::rand::random;
1415

1516
fn main() {
1617
// If we're the child, make sure we were invoked correctly
@@ -28,8 +29,10 @@ fn test() {
2829
let my_path = os::self_exe_name().unwrap();
2930
let my_dir = my_path.dir_path();
3031

31-
let child_dir = Path::new(my_dir.join("issue-15149-child"));
32-
drop(fs::mkdir(&child_dir, USER_RWX));
32+
let random_u32: u32 = random();
33+
let child_dir = Path::new(my_dir.join(format!("issue-15149-child-{}",
34+
random_u32)));
35+
fs::mkdir(&child_dir, USER_RWX).unwrap();
3336

3437
let child_path = child_dir.join(format!("mytest{}",
3538
os::consts::EXE_SUFFIX));
@@ -48,4 +51,7 @@ fn test() {
4851
format!("child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
4952
child_output.output.container_as_str().unwrap(),
5053
child_output.error.container_as_str().unwrap()));
54+
55+
fs::rmdir_recursive(&child_dir).unwrap();
56+
5157
}

0 commit comments

Comments
 (0)