File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
tests/run-make/remove-dir-all-race Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 1- //@ ignore-windows
2-
31// This test attempts to make sure that running `remove_dir_all`
42// doesn't result in a NotFound error one of the files it
53// 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.
124
135use std:: fs:: remove_dir_all;
146use std:: path:: Path ;
15- use std:: thread;
167use std:: time:: Duration ;
8+ use std:: { io, thread} ;
179
1810use run_make_support:: rfs:: { create_dir, write} ;
1911use run_make_support:: run_in_tmpdir;
@@ -36,8 +28,10 @@ fn main() {
3628 let t2 = scope. spawn ( || {
3729 let r1 = remove_dir_all ( "outer/inner" ) ;
3830 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+ }
4135 }
4236 } ) ;
4337 } ) ;
@@ -49,7 +43,7 @@ fn main() {
4943 let Err ( err) = remove_dir_all ( "outer" ) else {
5044 panic ! ( "removing nonexistant dir did not result in an error" ) ;
5145 } ;
52- assert_eq ! ( err. kind( ) , std :: io:: ErrorKind :: NotFound ) ;
46+ assert_eq ! ( err. kind( ) , io:: ErrorKind :: NotFound ) ;
5347 }
5448 } ) ;
5549 if !race_happened {
You can’t perform that action at this time.
0 commit comments