Skip to content

Commit

Permalink
Enable remove-dir-all-race test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Sep 1, 2024
1 parent bb9d5c4 commit fca4020
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions tests/run-make/remove-dir-all-race/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
//@ ignore-windows

// This test attempts to make sure that running `remove_dir_all`
// doesn't result in a NotFound error one of the files it
// is deleting is deleted concurrently.
//
// The windows implementation for `remove_dir_all` is significantly
// more complicated, and has not yet been brought up to par with
// the implementation on other platforms, so this test is marked as
// `ignore-windows` until someone more expirenced with windows can
// sort that out.

use std::fs::remove_dir_all;
use std::path::Path;
use std::thread;
use std::time::Duration;
use std::{io, thread};

use run_make_support::rfs::{create_dir, write};
use run_make_support::run_in_tmpdir;
Expand All @@ -36,8 +28,10 @@ fn main() {
let t2 = scope.spawn(|| {
let r1 = remove_dir_all("outer/inner");
let r2 = remove_dir_all("outer/inner.txt");
if r1.is_ok() && r2.is_err() {
race_happened = true;
if let Err(e) = r2 {
if r1.is_ok() && e.kind() == io::ErrorKind::NotFound {
race_happened = true;
}
}
});
});
Expand All @@ -49,7 +43,7 @@ fn main() {
let Err(err) = remove_dir_all("outer") else {
panic!("removing nonexistant dir did not result in an error");
};
assert_eq!(err.kind(), std::io::ErrorKind::NotFound);
assert_eq!(err.kind(), io::ErrorKind::NotFound);
}
});
if !race_happened {
Expand Down

0 comments on commit fca4020

Please sign in to comment.