pub fn oversized_sparse(path: &Path, size_bytes: u64) -> Result<()>Expand description
Write size_bytes to path using set_len, which on most
platforms creates a sparse file (no actual disk space used until
written to).
Useful for testing very large file handling without consuming disk space.
ยงExample
use dev_fixtures::adversarial::oversized_sparse;
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("sparse.bin");
oversized_sparse(&path, 1_000_000).unwrap();
assert_eq!(std::fs::metadata(&path).unwrap().len(), 1_000_000);