Speed up mdtests (#13832)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Micha Reiser 2024-10-21 21:06:41 +02:00 committed by GitHub
parent fa7626160b
commit 9e3cf14dde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 16 deletions

View file

@ -351,6 +351,17 @@ impl MemoryFileSystem {
Ok(ReadDirectory::new(collected))
}
/// Removes all files and directories except the current working directory.
pub fn remove_all(&self) {
self.inner.virtual_files.write().unwrap().clear();
self.inner
.by_path
.write()
.unwrap()
.retain(|key, _| key == self.inner.cwd.as_utf8_path());
}
}
impl Default for MemoryFileSystem {