Unverified Commit 46586eea authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

test(turbopack): remove filesystem fuzzer unit tests (#99089)

### What?

Remove the eight unit tests added to the manual filesystem-watcher
fuzzer by #98982 and #98983.

### Why?

This follows up on bgw's review feedback in
[#98982](https://github.com/vercel/next.js/pull/98982#discussion_r4075847283)
and
[#98983](https://github.com/vercel/next.js/pull/98983#discussion_r4076126033)
that unit tests are overkill for this stress-testing CLI. Its supported
behavior is exercised by running the fuzzer itself.

### How?

Remove only the fuzzer's `#[cfg(test)]` module. Both production fixes
from the original PRs remain unchanged.

Verified with:

- `cargo fmt -- --check`
- `cargo check -p turbo-tasks-fuzz`
- `cargo clippy -p turbo-tasks-fuzz --all-targets -- -D warnings -A
deprecated`
- `cargo build --release -p turbo-tasks-fuzz`
- 30-second manual smoke runs for normal reads, tracked read/writes, and
directory symlinks (443 total iterations; no panics or terminal errors)

<!-- NEXT_JS_LLM -->


<!-- fleet 6488265d-2685-49d3-b632-6511b4b47690 -->
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
Co-authored-by: 's avatarBenjamin Woodruff ‮ <180404+bgw@users.noreply.github.com>
parent e725f8f7
...@@ -624,112 +624,3 @@ impl Drop for FsCleanup<'_> { ...@@ -624,112 +624,3 @@ impl Drop for FsCleanup<'_> {
std::fs::remove_dir_all(self.path).unwrap(); std::fs::remove_dir_all(self.path).unwrap();
} }
} }
#[cfg(test)]
mod tests {
use std::path::{Path, PathBuf};
use rustc_hash::FxHashSet;
use crate::fs_watcher::{
FILE_SENTINEL_PREFIX, read_derived_content, remove_unchanged_symlink_paths,
};
#[test]
fn prefixes_external_content() {
assert_eq!(
read_derived_content(Some(b"external")),
[FILE_SENTINEL_PREFIX, b"external"].concat()
);
}
#[test]
fn preserves_already_derived_content() {
let content = [FILE_SENTINEL_PREFIX, b"external"].concat();
assert_eq!(read_derived_content(Some(&content)), content);
}
#[test]
fn distinct_external_content_produces_distinct_writes() {
assert_ne!(
read_derived_content(Some(b"first")),
read_derived_content(Some(b"second"))
);
}
#[test]
fn handles_empty_and_missing_content_deterministically() {
assert_eq!(read_derived_content(Some(b"")), FILE_SENTINEL_PREFIX);
assert_eq!(read_derived_content(None), FILE_SENTINEL_PREFIX);
}
#[test]
fn retains_symlinks_with_a_net_target_change() {
let root = Path::new("/root");
let symlink = root.join("_symlinks/0");
let mut modified = FxHashSet::from_iter([symlink.clone()]);
remove_unchanged_symlink_paths(
&mut modified,
root,
&[PathBuf::from("old")],
&[PathBuf::from("new")],
);
assert_eq!(modified, FxHashSet::from_iter([symlink]));
}
#[test]
fn retains_symlinks_changed_multiple_times_to_a_different_target() {
let root = Path::new("/root");
let symlink = root.join("_symlinks/0");
let mut modified = FxHashSet::from_iter([symlink.clone()]);
// Intermediate targets are intentionally absent: only the iteration boundaries determine
// whether the dependent operation observes a net value change.
remove_unchanged_symlink_paths(
&mut modified,
root,
&[PathBuf::from("start")],
&[PathBuf::from("final")],
);
assert_eq!(modified, FxHashSet::from_iter([symlink]));
}
#[test]
fn removes_symlinks_restored_to_their_starting_target() {
let root = Path::new("/root");
let symlink = root.join("_symlinks/0");
let unrelated = root.join("file");
let mut modified = FxHashSet::from_iter([symlink, unrelated.clone()]);
// The link may have taken any number of intermediate targets. Only its starting and final
// observable values matter to the dependent Turbo Tasks operation.
remove_unchanged_symlink_paths(
&mut modified,
root,
&[PathBuf::from("same")],
&[PathBuf::from("same")],
);
assert_eq!(modified, FxHashSet::from_iter([unrelated]));
}
#[test]
fn leaves_untouched_symlinks_and_unrelated_paths_alone() {
let root = Path::new("/root");
let unrelated = root.join("file");
let changed_symlink = root.join("_symlinks/1");
let mut modified = FxHashSet::from_iter([unrelated.clone(), changed_symlink.clone()]);
remove_unchanged_symlink_paths(
&mut modified,
root,
&[PathBuf::from("unchanged"), PathBuf::from("old")],
&[PathBuf::from("unchanged"), PathBuf::from("new")],
);
assert_eq!(modified, FxHashSet::from_iter([unrelated, changed_symlink]));
}
}
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