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