From 002f42875f1f852da092ecdce0a5ae9700ec08ca Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 23 May 2023 11:42:40 +0200 Subject: [PATCH] fix the fuzzer --- milli/examples/fuzz.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/milli/examples/fuzz.rs b/milli/examples/fuzz.rs index 9536f3811..dc79e37b7 100644 --- a/milli/examples/fuzz.rs +++ b/milli/examples/fuzz.rs @@ -50,34 +50,27 @@ enum Operation { } #[derive(Debug, Arbitrary)] -struct Batch([Operation; 2]); +struct Batch([Operation; 5]); fn main() { let mut options = EnvOpenOptions::new(); options.map_size(1024 * 1024 * 1024 * 1024); - let _tempdir = TempDir::new_in("ramdisk").unwrap(); + let _tempdir = TempDir::new().unwrap(); let index = Index::new(options, _tempdir.path()).unwrap(); let indexer_config = IndexerConfig::default(); let index_documents_config = IndexDocumentsConfig::default(); loop { - // let v: Vec = std::iter::repeat_with(|| fastrand::u8(..)).take(1000).collect(); + let v: Vec = std::iter::repeat_with(|| fastrand::u8(..)).take(1000).collect(); - // let data = Unstructured::new(&v); - // let batches = <[Batch; 3]>::arbitrary(&mut data).unwrap(); - let batches = [ - Batch([Operation::AddDoc(Document::Five), Operation::AddDoc(Document::Three)]), - Batch([Operation::DeleteDoc(DocId::One), Operation::AddDoc(Document::Two)]), - Batch([Operation::DeleteDoc(DocId::Zero), Operation::AddDoc(Document::Five)]), - ]; + let mut data = Unstructured::new(&v); + let batches = <[Batch; 5]>::arbitrary(&mut data).unwrap(); dbg!(&batches); let mut wtxn = index.write_txn().unwrap(); for batch in batches { - dbg!(&batch); - let mut builder = IndexDocuments::new( &mut wtxn, &index,