pub struct Config {
pub wasmtime: WasmtimeConfig,
pub module_config: ModuleConfig,
}Expand description
Configuration for wasmtime::Config and generated modules for a session of
fuzzing.
This configuration guides what modules are generated, how wasmtime
configuration is generated, and is typically itself generated through a call
to Arbitrary which allows for a form of “swarm testing”.
Fields§
§wasmtime: WasmtimeConfigConfiguration related to the wasmtime::Config.
module_config: ModuleConfigConfiguration related to generated modules.
Implementations§
Source§impl Config
impl Config
Sourcepub fn set_differential_config(&mut self)
pub fn set_differential_config(&mut self)
Indicates that this configuration is being used for differential execution.
The purpose of this function is to update the configuration which was generated to be compatible with execution in multiple engines. The goal is to produce the exact same result in all engines so we need to paper over things like nan differences and memory/table behavior differences.
Sourcepub fn generate(
&self,
input: &mut Unstructured<'_>,
default_fuel: Option<u32>,
) -> Result<Module>
pub fn generate( &self, input: &mut Unstructured<'_>, default_fuel: Option<u32>, ) -> Result<Module>
Uses this configuration and the supplied source of data to generate a wasm module.
If a default_fuel is provided, the resulting module will be configured
to ensure termination; as doing so will add an additional global to the module,
the pooling allocator, if configured, will also have its globals limit updated.
Sourcepub fn make_wast_test_compliant(&mut self, test: &WastTest) -> WastConfig
pub fn make_wast_test_compliant(&mut self, test: &WastTest) -> WastConfig
Updates this configuration to be able to run the test specified.
This primarily updates self.module_config to ensure that it enables
all features and proposals necessary to execute the test specified.
This will additionally update limits in the pooling allocator to be able
to execute all tests.
Sourcepub fn to_wasmtime(&self) -> Config
pub fn to_wasmtime(&self) -> Config
Converts this to a wasmtime::Config object
Sourcepub fn to_store(&self) -> Store<StoreLimits>
pub fn to_store(&self) -> Store<StoreLimits>
Convenience function for generating a Store<T> using this
configuration.
Sourcepub fn configure_store(&self, store: &mut Store<StoreLimits>)
pub fn configure_store(&self, store: &mut Store<StoreLimits>)
Configures a store based on this configuration.
Sourcepub fn configure_store_epoch_and_fuel<T>(&self, store: &mut Store<T>)
pub fn configure_store_epoch_and_fuel<T>(&self, store: &mut Store<T>)
Configures everything unrelated to T in a store, such as epochs and
fuel.
Sourcepub fn generate_timeout(&mut self, u: &mut Unstructured<'_>) -> Result<Timeout>
pub fn generate_timeout(&mut self, u: &mut Unstructured<'_>) -> Result<Timeout>
Generates an arbitrary method of timing out an instance, ensuring that this configuration supports the returned timeout.
Sourcepub fn compile(&self, engine: &Engine, wasm: &[u8]) -> Result<Module>
pub fn compile(&self, engine: &Engine, wasm: &[u8]) -> Result<Module>
Compiles the wasm within the engine provided.
This notably will use Module::{serialize,deserialize_file} to
round-trip if configured in the fuzzer.
Sourcepub fn enable_async(&mut self, u: &mut Unstructured<'_>) -> Result<()>
pub fn enable_async(&mut self, u: &mut Unstructured<'_>) -> Result<()>
Updates this configuration to forcibly enable async support. Only useful in fuzzers which do async calls.
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for Config
impl<'a> Arbitrary<'a> for Config
Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreAuto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more