1 //! Fuzzing infrastructure for Wasmtime. 2 3 #![deny(missing_docs)] 4 5 pub use wasm_smith; 6 pub mod generators; 7 pub mod oracles; 8 9 /// One time start up initialization for fuzzing: 10 /// 11 /// * Enables `env_logger`. 12 /// 13 /// * Restricts `rayon` to a single thread in its thread pool, for more 14 /// deterministic executions. 15 /// 16 /// If a fuzz target is taking raw input bytes from the fuzzer, it is fine to 17 /// call this function in the fuzz target's oracle or in the fuzz target 18 /// itself. However, if the fuzz target takes an `Arbitrary` type, and the 19 /// `Arbitrary` implementation is not derived and does interesting things, then 20 /// the `Arbitrary` implementation should call this function, since it runs 21 /// before the fuzz target itself. 22 pub(crate) fn init_fuzzing() { 23 static INIT: std::sync::Once = std::sync::Once::new(); 24 25 INIT.call_once(|| { 26 let _ = env_logger::try_init(); 27 28 let _ = rayon::ThreadPoolBuilder::new() 29 .num_threads(1) 30 .build_global(); 31 }) 32 } 33