Skip to content

Commit 2898eee

Browse files
committed
Fix CI: enable component_model_map in fuzzing and handle map in arbitrary_val
The fuzzer's component_api oracle was generating map types but the engine didn't have the map feature enabled, and arbitrary_val had no arm for Type::Map. Enable component_model_map in the store helper (matching how component_model_async is forced on) and implement arbitrary value generation for map types.
1 parent b94eac8 commit 2898eee

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

crates/fuzzing/src/oracles/component_api.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,23 @@ fn arbitrary_val(ty: &component::Type, input: &mut Unstructured) -> arbitrary::R
118118
.collect::<arbitrary::Result<_>>()?,
119119
),
120120

121-
// Resources, futures, streams, error contexts, and maps aren't fuzzed at this time.
121+
Type::Map(map) => {
122+
let mut pairs = Vec::new();
123+
input.arbitrary_loop(Some(MIN_LIST_LENGTH), Some(MAX_LIST_LENGTH), |input| {
124+
let key = arbitrary_val(&map.key(), input)?;
125+
let value = arbitrary_val(&map.value(), input)?;
126+
pairs.push((key, value));
127+
Ok(ControlFlow::Continue(()))
128+
})?;
129+
Val::Map(pairs)
130+
}
131+
132+
// Resources, futures, streams, and error contexts aren't fuzzed at this time.
122133
Type::Own(_)
123134
| Type::Borrow(_)
124135
| Type::Future(_)
125136
| Type::Stream(_)
126-
| Type::ErrorContext
127-
| Type::Map(_) => {
137+
| Type::ErrorContext => {
128138
unreachable!()
129139
}
130140
})
@@ -140,6 +150,7 @@ fn store<T>(input: &mut Unstructured<'_>, val: T) -> arbitrary::Result<Store<T>>
140150
config.module_config.config.max_memories = 2;
141151
config.module_config.component_model_async = true;
142152
config.module_config.component_model_async_stackful = true;
153+
config.module_config.component_model_map = true;
143154
if config.wasmtime.compiler_strategy == CompilerStrategy::Winch {
144155
config.wasmtime.compiler_strategy = CompilerStrategy::CraneliftNative;
145156
}

0 commit comments

Comments
 (0)