Fix fuzz (#35)
* Add checking for fuzz. * Use wabt's validation instead of wasm2wat. Fixes #16 Fixes #34 * Check fuzz with nightly. * Install nightly toolchain * Travis Driven Development #1 * Travis Driven Development #2
This commit is contained in:
parent
106ac7afdb
commit
eda488233f
|
@ -11,12 +11,19 @@ addons:
|
|||
- gcc-6
|
||||
- g++-6
|
||||
- cmake
|
||||
env:
|
||||
- NIGHTLY_TOOLCHAIN=nightly-2018-02-05
|
||||
|
||||
install:
|
||||
# Install `cargo-deadlinks` unless it is currently installed.
|
||||
- command -v cargo-deadlinks &> /dev/null || cargo install cargo-deadlinks
|
||||
# Install nightly toolchain.
|
||||
- rustup toolchain install $NIGHTLY_TOOLCHAIN
|
||||
script:
|
||||
- export CC=/usr/bin/gcc-6
|
||||
- export CXX=/usr/bin/g++-6
|
||||
# Make sure fuzz targets are not broken.
|
||||
- rustup run $NIGHTLY_TOOLCHAIN cargo check --tests --manifest-path=fuzz/Cargo.toml
|
||||
- ./test.sh
|
||||
- ./doc.sh
|
||||
after_success: |
|
||||
|
|
2
doc.sh
2
doc.sh
|
@ -4,7 +4,7 @@ set -eux
|
|||
|
||||
cd $(dirname $0)
|
||||
|
||||
cargo doc
|
||||
rustup run $NIGHTLY_TOOLCHAIN cargo doc
|
||||
|
||||
# cargo-deadlinks will check any links in docs generated by `cargo doc`.
|
||||
# This is useful as rustdoc uses raw links which are error prone.
|
||||
|
|
|
@ -10,7 +10,7 @@ cargo-fuzz = true
|
|||
|
||||
[dependencies]
|
||||
wasmi = { path = ".." }
|
||||
wabt = "0.1.6"
|
||||
wabt = "0.1.7"
|
||||
|
||||
[dependencies.libfuzzer-sys]
|
||||
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#![no_main]
|
||||
#[macro_use] extern crate libfuzzer_sys;
|
||||
extern crate wasmi;
|
||||
#[macro_use]
|
||||
extern crate libfuzzer_sys;
|
||||
extern crate wabt;
|
||||
extern crate wasmi;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let wasmi_result = wasmi::load_from_buffer(data);
|
||||
|
||||
// TODO: Do validation only! https://github.com/pepyakin/wasmi/issues/16
|
||||
let wabt_result = wabt::wasm2wat(data);
|
||||
let wasmi_result = wasmi::Module::from_buffer(data);
|
||||
let wabt_result =
|
||||
wabt::Module::read_binary(data, &Default::default()).and_then(|m| m.validate());
|
||||
|
||||
assert_eq!(wasmi_result.is_ok(), wabt_result.is_ok());
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue