You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
801 B

[package]
name = "wasmtime-fuzz"
version = "0.7.0"
authors = ["The Wasmtime Project Developers"]
edition = "2018"
publish = false
[package.metadata]
cargo-fuzz = true
[dependencies]
arbitrary = "0.2.0"
env_logger = "0.7.1"
log = "0.4.8"
Fuzzing: Add test case logging and regression test template When the test case that causes the failure can successfully be disassembled to WAT, we get logs like this: ``` [2019-11-26T18:48:46Z INFO wasmtime_fuzzing] Wrote WAT disassembly to: /home/fitzgen/wasmtime/crates/fuzzing/target/scratch/8437-0.wat [2019-11-26T18:48:46Z INFO wasmtime_fuzzing] If this fuzz test fails, copy `/home/fitzgen/wasmtime/crates/fuzzing/target/scratch/8437-0.wat` to `wasmtime/crates/fuzzing/tests/regressions/my-regression.wat` and add the following test to `wasmtime/crates/fuzzing/tests/regressions.rs`: ``` #[test] fn my_fuzzing_regression_test() { let data = wat::parse_str( include_str!("./regressions/my-regression.wat") ).unwrap(); oracles::instantiate(data, CompilationStrategy::Auto) } ``` ``` If the test case cannot be disassembled to WAT, then we get logs like this: ``` [2019-11-26T18:48:46Z INFO wasmtime_fuzzing] Wrote Wasm test case to: /home/fitzgen/wasmtime/crates/fuzzing/target/scratch/8437-0.wasm [2019-11-26T18:48:46Z INFO wasmtime_fuzzing] Failed to disassemble Wasm into WAT: Bad magic number (at offset 0) Stack backtrace: Run with RUST_LIB_BACKTRACE=1 env variable to display a backtrace [2019-11-26T18:48:46Z INFO wasmtime_fuzzing] If this fuzz test fails, copy `/home/fitzgen/wasmtime/crates/fuzzing/target/scratch/8437-0.wasm` to `wasmtime/crates/fuzzing/tests/regressions/my-regression.wasm` and add the following test to `wasmtime/crates/fuzzing/tests/regressions.rs`: ``` #[test] fn my_fuzzing_regression_test() { let data = include_bytes!("./regressions/my-regression.wasm"); oracles::instantiate(data, CompilationStrategy::Auto) } ``` ```
5 years ago
wasmtime-fuzzing = { path = "../crates/fuzzing", features = ["env_logger"] }
wasmtime-jit = { path = "../crates/jit" }
wasmtime = { path = "../crates/api" }
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
[[bin]]
name = "compile"
path = "fuzz_targets/compile.rs"
test = false
[[bin]]
name = "instantiate"
path = "fuzz_targets/instantiate.rs"
test = false
[[bin]]
name = "instantiate_translated"
path = "fuzz_targets/instantiate_translated.rs"
test = false
[[bin]]
name = "api_calls"
path = "fuzz_targets/api_calls.rs"
test = false