| 1 | use onestore::{Reference, Store}; |
| 2 | use std::{collections::BTreeSet, fs}; |
| 3 | |
| 4 | #[test] |
| 5 | #[ignore = "Generates the local fuzz corpus"] |
| 6 | fn seed_property_fuzzer() { |
| 7 | let bytes = |
| 8 | fs::read("../../corpus/native/20260905-05/snapshots/07-table/notebook/synthetic.one") |
| 9 | .unwrap(); |
| 10 | let store = Store::parse(&bytes).unwrap(); |
| 11 | let mut seeds = BTreeSet::new(); |
| 12 | for node in store.lists.values().flat_map(|list| &list.nodes) { |
| 13 | if matches!(node.id, 0xa4 | 0xa5 | 0xc4 | 0xc5) |
| 14 | && let Some(Reference::Data(chunk)) = node.reference |
| 15 | { |
| 16 | let start = usize::try_from(chunk.offset).unwrap(); |
| 17 | let end = start + usize::try_from(chunk.length).unwrap(); |
| 18 | seeds.insert(&bytes[start..end]); |
| 19 | } |
| 20 | } |
| 21 | fs::create_dir_all("../../fuzz/corpus/properties").unwrap(); |
| 22 | for (index, seed) in seeds.iter().enumerate() { |
| 23 | fs::write(format!("../../fuzz/corpus/properties/native-{index}"), seed).unwrap(); |
| 24 | } |
| 25 | } |