Skip to content

Commit 3aa3923

Browse files
Exceptions: add basic support for fuzzing. (#11511)
* Enable use of exceptions in our fuzz module generator. This patch was provided by Alex in #11505; it is thus Co-authored-by: Alex Crichton <alex@alexcrichton.com> * Add ExnRef comparison to differential result checking. --------- Co-authored-by: Alex Crichton <alex@alexcrichton.com>
1 parent 2974ca4 commit 3aa3923

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

crates/fuzzing/src/generators/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ impl WasmtimeConfig {
662662
config.config.gc_enabled = false;
663663
config.config.tail_call_enabled = false;
664664
config.config.reference_types_enabled = false;
665+
config.config.exceptions_enabled = false;
665666
config.function_references_enabled = false;
666667

667668
// Winch's SIMD implementations require AVX and AVX2.

crates/fuzzing/src/generators/module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<'a> Arbitrary<'a> for ModuleConfig {
4848
let _ = config.tail_call_enabled;
4949
let _ = config.extended_const_enabled;
5050
let _ = config.gc_enabled;
51-
config.exceptions_enabled = false;
51+
let _ = config.exceptions_enabled;
5252
config.custom_page_sizes_enabled = u.arbitrary()?;
5353
config.wide_arithmetic_enabled = u.arbitrary()?;
5454
config.memory64_enabled = u.ratio(1, 20)?;

crates/fuzzing/src/generators/value.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ impl PartialEq for DiffValue {
272272
(Self::FuncRef { null: a }, Self::FuncRef { null: b }) => a == b,
273273
(Self::ExternRef { null: a }, Self::ExternRef { null: b }) => a == b,
274274
(Self::AnyRef { null: a }, Self::AnyRef { null: b }) => a == b,
275+
(Self::ExnRef { null: a }, Self::ExnRef { null: b }) => a == b,
275276
_ => false,
276277
}
277278
}

crates/fuzzing/src/oracles.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,8 @@ mod tests {
14171417
| WasmFeatures::GC
14181418
| WasmFeatures::GC_TYPES
14191419
| WasmFeatures::CUSTOM_PAGE_SIZES
1420-
| WasmFeatures::EXTENDED_CONST;
1420+
| WasmFeatures::EXTENDED_CONST
1421+
| WasmFeatures::EXCEPTIONS;
14211422

14221423
// All other features that wasmparser supports, which is presumably a
14231424
// superset of the features that wasm-smith supports, are listed here as

crates/fuzzing/src/oracles/diff_spec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ impl SpecInterpreter {
2828
config.custom_page_sizes_enabled = false;
2929
config.wide_arithmetic_enabled = false;
3030
config.extended_const_enabled = false;
31+
config.exceptions_enabled = false;
3132

3233
Self
3334
}

0 commit comments

Comments
 (0)