refactor: rename DifferentialWasmiModuleConfig to SingleFunctionModuleConfig

Since we plan to reuse this configuration, we rename it and ensure it
has at least 1 type (this resulted in invalid modules).
This commit is contained in:
Andrew Brown
2021-07-28 13:19:09 -07:00
parent ddb80d2d14
commit f3955fa62a
2 changed files with 10 additions and 5 deletions

View File

@@ -563,15 +563,20 @@ pub fn table_ops(
} }
/// Configuration options for wasm-smith such that generated modules always /// Configuration options for wasm-smith such that generated modules always
/// conform to certain specifications. /// conform to certain specifications: one exported function, one exported
/// memory.
#[derive(Default, Debug, Arbitrary, Clone)] #[derive(Default, Debug, Arbitrary, Clone)]
pub struct DifferentialWasmiModuleConfig; pub struct SingleFunctionModuleConfig;
impl wasm_smith::Config for DifferentialWasmiModuleConfig { impl wasm_smith::Config for SingleFunctionModuleConfig {
fn allow_start_export(&self) -> bool { fn allow_start_export(&self) -> bool {
false false
} }
fn min_types(&self) -> usize {
1
}
fn min_funcs(&self) -> usize { fn min_funcs(&self) -> usize {
1 1
} }
@@ -609,7 +614,7 @@ impl wasm_smith::Config for DifferentialWasmiModuleConfig {
/// resulting memory image when execution terminates. This relies on the /// resulting memory image when execution terminates. This relies on the
/// module-under-test to be instrumented to bound the execution time. Invoke /// module-under-test to be instrumented to bound the execution time. Invoke
/// with a module generated by `wasm-smith` using the /// with a module generated by `wasm-smith` using the
/// `DiferentialWasmiModuleConfig` configuration type for best results. /// `SingleFunctionModuleConfig` configuration type for best results.
/// ///
/// May return `None` if we early-out due to a rejected fuzz config; these /// May return `None` if we early-out due to a rejected fuzz config; these
/// should be rare if modules are generated appropriately. /// should be rare if modules are generated appropriately.

View File

@@ -5,7 +5,7 @@ use wasmtime_fuzzing::{generators, oracles};
fuzz_target!(|data: ( fuzz_target!(|data: (
generators::Config, generators::Config,
wasm_smith::ConfiguredModule<oracles::DifferentialWasmiModuleConfig> wasm_smith::ConfiguredModule<oracles::SingleFunctionModuleConfig>
)| { )| {
let (config, mut wasm) = data; let (config, mut wasm) = data;
wasm.ensure_termination(1000); wasm.ensure_termination(1000);