Switch from hashmap_core to hashbrown.
As suggested [here](https://github.com/Amanieu/hashmap_core/pull/10#issuecomment-455866083). This also allows us to re-enable the basic compile fuzz target.
This commit is contained in:
3
fuzz/.gitignore
vendored
3
fuzz/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
target
|
||||
corpus
|
||||
artifacts
|
||||
BIN
fuzz/corpus/compile/1340712d77d3db3c79b4b0c1494df18615485480
Normal file
BIN
fuzz/corpus/compile/1340712d77d3db3c79b4b0c1494df18615485480
Normal file
Binary file not shown.
@@ -10,7 +10,7 @@ extern crate wasmtime_jit;
|
||||
|
||||
use cranelift_codegen::settings;
|
||||
use wasmparser::validate;
|
||||
use wasmtime_environ::{Module, ModuleEnvironment};
|
||||
use wasmtime_jit::{CompiledModule, Compiler, NullResolver};
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if !validate(data, None) {
|
||||
@@ -21,14 +21,9 @@ fuzz_target!(|data: &[u8]| {
|
||||
panic!("host machine is not a supported target");
|
||||
});
|
||||
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
||||
let mut module = Module::new();
|
||||
let environment = ModuleEnvironment::new(&*isa, &mut module);
|
||||
let translation = match environment.translate(data) {
|
||||
Ok(translation) => translation,
|
||||
Err(_) => return,
|
||||
};
|
||||
let imports_resolver = |_env: &str, _function: &str| None;
|
||||
let _exec = match wasmtime_jit::compile_and_link_module(&*isa, &translation, imports_resolver) {
|
||||
let mut compiler = Compiler::new(isa);
|
||||
let mut resolver = NullResolver {};
|
||||
let _compiled = match CompiledModule::new(&mut compiler, data, &mut resolver) {
|
||||
Ok(x) => x,
|
||||
Err(_) => return,
|
||||
};
|
||||
|
||||
@@ -18,12 +18,12 @@ cranelift-wasm = "0.26.0"
|
||||
cast = { version = "0.2.2", default-features = false }
|
||||
failure = { version = "0.1.3", default-features = false }
|
||||
failure_derive = { version = "0.1.3", default-features = false }
|
||||
hashmap_core = { version = "0.1.9", optional = true }
|
||||
hashbrown = { version = "0.1.8", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
|
||||
core = ["hashmap_core", "cranelift-codegen/core", "cranelift-wasm/core"]
|
||||
core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core"]
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "experimental" }
|
||||
|
||||
@@ -35,7 +35,7 @@ extern crate alloc as std;
|
||||
extern crate std;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use hashmap_core::HashMap;
|
||||
use hashbrown::HashMap;
|
||||
#[cfg(feature = "std")]
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ region = "1.0.0"
|
||||
failure = { version = "0.1.3", default-features = false }
|
||||
failure_derive = { version = "0.1.3", default-features = false }
|
||||
target-lexicon = { version = "0.2.0", default-features = false }
|
||||
hashmap_core = { version = "0.1.9", optional = true }
|
||||
hashbrown = { version = "0.1.8", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["cranelift-codegen/std", "cranelift-wasm/std"]
|
||||
core = ["hashmap_core", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"]
|
||||
core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core", "wasmtime-environ/core"]
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "experimental" }
|
||||
|
||||
@@ -32,7 +32,7 @@ extern crate alloc as std;
|
||||
extern crate std;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use hashmap_core::{map as hash_map, HashMap};
|
||||
use hashbrown::{map as hash_map, HashMap};
|
||||
#[cfg(feature = "std")]
|
||||
use std::collections::{hash_map, HashMap};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ extern crate alloc as std;
|
||||
extern crate std;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use hashmap_core::{map as hash_map, HashMap};
|
||||
use hashbrown::{map as hash_map, HashMap};
|
||||
#[cfg(feature = "std")]
|
||||
use std::collections::{hash_map, HashMap};
|
||||
|
||||
|
||||
11
test-all.sh
11
test-all.sh
@@ -62,13 +62,10 @@ if rustup toolchain list | grep -q nightly; then
|
||||
cargo +nightly install cargo-fuzz
|
||||
fi
|
||||
|
||||
echo "Fuzz check temporarily disabled until "
|
||||
echo "https://github.com/Amanieu/hashmap_core/pull/8"
|
||||
echo "is merged."
|
||||
#fuzz_module="8f0d725b20dcea52335cf521a5bb083833a5241f"
|
||||
#ASAN_OPTIONS=detect_leaks=0 \
|
||||
#cargo +nightly fuzz run compile \
|
||||
# "$topdir/fuzz/corpus/compile/$fuzz_module"
|
||||
fuzz_module="1340712d77d3db3c79b4b0c1494df18615485480"
|
||||
ASAN_OPTIONS=detect_leaks=0 \
|
||||
cargo +nightly fuzz run compile \
|
||||
"$topdir/fuzz/corpus/compile/$fuzz_module"
|
||||
else
|
||||
echo "nightly toolchain not found, skipping fuzz target integration test"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user