Unverified Commit aae25a1d authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

Turbopack: Add a flag to the fs watch fuzzer to print missing but expected invalidations (#82131)

This can be useful in figuring what should've been invalidated, but wasn't.

`strace` can be used for figuring out what files/directories were actually modified.
parent 7e4c74b9
...@@ -50,6 +50,8 @@ struct FsWatcher { ...@@ -50,6 +50,8 @@ struct FsWatcher {
file_modifications: u32, file_modifications: u32,
#[arg(long, default_value_t = 2)] #[arg(long, default_value_t = 2)]
directory_modifications: u32, directory_modifications: u32,
#[arg(long)]
print_missing_invalidations: bool,
} }
#[tokio::main] #[tokio::main]
...@@ -135,6 +137,19 @@ async fn fuzz_fs_watcher(args: FsWatcher) -> anyhow::Result<()> { ...@@ -135,6 +137,19 @@ async fn fuzz_fs_watcher(args: FsWatcher) -> anyhow::Result<()> {
modified_file_paths.len(), modified_file_paths.len(),
invalidations.len() invalidations.len()
); );
if args.print_missing_invalidations {
let absolute_path_invalidations = invalidations
.iter()
.map(|relative_path| fs_root.join(relative_path))
.collect::<FxHashSet<PathBuf>>();
let mut missing = modified_file_paths
.difference(&absolute_path_invalidations)
.collect::<Vec<_>>();
missing.sort_unstable();
for path in &missing {
println!(" missing {path:?}");
}
}
invalidations.clear(); invalidations.clear();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment