cargo fuzz integration (#306)
* added wip translate_module fuzzer * use local binaryen-rs fork (with shim) for fuzzing * minor doc cleanup * check fuzzer integration via CI * switch back to upstream binaryen-rs; add forgotten integration test directive
This commit is contained in:
committed by
Dan Gohman
parent
07c65bab11
commit
1924039713
29
cranelift/fuzz/Cargo.toml
Normal file
29
cranelift/fuzz/Cargo.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[package]
|
||||
name = "cton-wasm-fuzz"
|
||||
version = "0.0.1"
|
||||
authors = ["foote@fastly.com"]
|
||||
publish = false
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies.cargo-fuzz]
|
||||
version = "*"
|
||||
|
||||
[dependencies.binaryen]
|
||||
git = "https://github.com/pepyakin/binaryen-rs.git"
|
||||
version = "*"
|
||||
|
||||
[dependencies.libfuzzer-sys]
|
||||
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
|
||||
|
||||
[dependencies.cretonne-wasm]
|
||||
path = "../lib/wasm"
|
||||
|
||||
# Prevent this from interfering with workspaces
|
||||
[workspace]
|
||||
members = ["."]
|
||||
|
||||
[[bin]]
|
||||
name = "fuzz_translate_module"
|
||||
path = "fuzz_translate_module.rs"
|
||||
Binary file not shown.
15
cranelift/fuzz/fuzz_translate_module.rs
Normal file
15
cranelift/fuzz/fuzz_translate_module.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
#![no_main]
|
||||
#[macro_use]
|
||||
extern crate libfuzzer_sys;
|
||||
extern crate binaryen;
|
||||
extern crate cretonne_wasm;
|
||||
use cretonne_wasm::{translate_module, DummyEnvironment};
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let binaryen_module = binaryen::tools::translate_to_fuzz_mvp(data);
|
||||
|
||||
let wasm = binaryen_module.write();
|
||||
|
||||
let mut dummy_environ = DummyEnvironment::default();
|
||||
translate_module(&wasm, &mut dummy_environ).unwrap();
|
||||
});
|
||||
Reference in New Issue
Block a user