File tree 1 file changed +6
-12
lines changed
tests/run-make/remove-dir-all-race
1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 1
- //@ ignore-windows
2
-
3
1
// This test attempts to make sure that running `remove_dir_all`
4
2
// doesn't result in a NotFound error one of the files it
5
3
// is deleting is deleted concurrently.
6
- //
7
- // The windows implementation for `remove_dir_all` is significantly
8
- // more complicated, and has not yet been brought up to par with
9
- // the implementation on other platforms, so this test is marked as
10
- // `ignore-windows` until someone more expirenced with windows can
11
- // sort that out.
12
4
13
5
use std:: fs:: remove_dir_all;
14
6
use std:: path:: Path ;
15
- use std:: thread;
16
7
use std:: time:: Duration ;
8
+ use std:: { io, thread} ;
17
9
18
10
use run_make_support:: rfs:: { create_dir, write} ;
19
11
use run_make_support:: run_in_tmpdir;
@@ -36,8 +28,10 @@ fn main() {
36
28
let t2 = scope. spawn ( || {
37
29
let r1 = remove_dir_all ( "outer/inner" ) ;
38
30
let r2 = remove_dir_all ( "outer/inner.txt" ) ;
39
- if r1. is_ok ( ) && r2. is_err ( ) {
40
- race_happened = true ;
31
+ if let Err ( e) = r2 {
32
+ if r1. is_ok ( ) && e. kind ( ) == io:: ErrorKind :: NotFound {
33
+ race_happened = true ;
34
+ }
41
35
}
42
36
} ) ;
43
37
} ) ;
@@ -49,7 +43,7 @@ fn main() {
49
43
let Err ( err) = remove_dir_all ( "outer" ) else {
50
44
panic ! ( "removing nonexistant dir did not result in an error" ) ;
51
45
} ;
52
- assert_eq ! ( err. kind( ) , std :: io:: ErrorKind :: NotFound ) ;
46
+ assert_eq ! ( err. kind( ) , io:: ErrorKind :: NotFound ) ;
53
47
}
54
48
} ) ;
55
49
if !race_happened {
You can’t perform that action at this time.
0 commit comments