Remove always-on logging from fuzz targets (#878)

Now that the `cargo fuzz` tooling is better, it is easier to reproduce failures,
and we don't need to be super paranoid about logging here.
This commit is contained in:
Nick Fitzgerald
2020-01-30 23:46:50 +01:00
committed by GitHub
parent c6438d0d44
commit 84c4d8cc6c
7 changed files with 8 additions and 197 deletions

View File

@@ -1,27 +1,8 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use std::sync::Once;
use wasmtime_fuzzing::{generators::api::ApiCalls, oracles};
fuzz_target!(|api: ApiCalls| {
static INIT_LOGGING: Once = Once::new();
INIT_LOGGING.call_once(|| env_logger::init());
log::debug!(
"If this fuzz test fails, here is a regression tests:
```
#[test]
fn my_regression_test() {{
use wasmtime_fuzzing::generators::{{
api::{{ApiCall::*, ApiCalls}},
WasmOptTtf,
}};
wasmtime_fuzzing::oracles::make_api_calls({:#?});
}}
```",
api
);
oracles::make_api_calls(api);
});

6
fuzz/fuzz_targets/compile.rs Normal file → Executable file
View File

@@ -2,13 +2,13 @@
use libfuzzer_sys::fuzz_target;
use wasmtime::Strategy;
use wasmtime_fuzzing::{oracles, with_log_wasm_test_case};
use wasmtime_fuzzing::oracles;
fuzz_target!(|data: &[u8]| {
with_log_wasm_test_case!(data, |data| oracles::compile(data, Strategy::Cranelift));
oracles::compile(data, Strategy::Cranelift);
});
#[cfg(feature = "lightbeam")]
fuzz_target!(|data: &[u8]| {
with_log_wasm_test_case!(data, |data| oracles::compile(data, Strategy::Lightbeam));
oracles::compile(data, Strategy::Lightbeam);
});

4
fuzz/fuzz_targets/instantiate.rs Normal file → Executable file
View File

@@ -2,8 +2,8 @@
use libfuzzer_sys::fuzz_target;
use wasmtime::Strategy;
use wasmtime_fuzzing::{oracles, with_log_wasm_test_case};
use wasmtime_fuzzing::oracles;
fuzz_target!(|data: &[u8]| {
with_log_wasm_test_case!(data, |data| oracles::instantiate(data, Strategy::Auto,));
oracles::instantiate(data, Strategy::Auto);
});

7
fuzz/fuzz_targets/instantiate_translated.rs Normal file → Executable file
View File

@@ -2,11 +2,8 @@
use libfuzzer_sys::fuzz_target;
use wasmtime::Strategy;
use wasmtime_fuzzing::{generators, oracles, with_log_wasm_test_case};
use wasmtime_fuzzing::{generators, oracles};
fuzz_target!(|data: generators::WasmOptTtf| {
with_log_wasm_test_case!(&data.wasm, |wasm| oracles::instantiate(
wasm,
Strategy::Auto,
));
oracles::instantiate(&data.wasm, Strategy::Auto);
});