summaryrefslogtreecommitdiff
path: root/crates/cli/src
diff options
context:
space:
mode:
authorHenry <mail@henrygressmann.de>2026-08-23 14:41:39 +0200
committerHenry <mail@henrygressmann.de>2026-08-23 14:41:39 +0200
commit8df4ef0bf05ff5aa1b587f3fabe4fdcbf3e69e78 (patch)
tree838f3b8a530186d1d99b2374249e04560d199fa0 /crates/cli/src
parent41b1072bc7fcda3b30cda942c4d801bec30ad6e0 (diff)
chore: ensure 'type mismatch' tests are executed
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/cli/src')
-rw-r--r--crates/cli/src/wast_runner.rs22
1 files changed, 8 insertions, 14 deletions
diff --git a/crates/cli/src/wast_runner.rs b/crates/cli/src/wast_runner.rs
index 1b8ae9c..023c959 100644
--- a/crates/cli/src/wast_runner.rs
+++ b/crates/cli/src/wast_runner.rs
@@ -16,6 +16,10 @@ use wast::{QuoteWat, core::AbstractHeapType};
const TEST_TIME_SLICE: Duration = Duration::from_millis(20);
const TEST_MAX_SUSPENSIONS: u32 = 1000;
+// Older suites classify encodings that wasmparser accepts with the latest feature set as malformed.
+const ACCEPTED_MALFORMED_MESSAGES: &[&str] =
+ &["integer representation too long", "zero byte expected", "zero flag expected"];
+const ACCEPTED_INVALID_MESSAGES: &[&str] = &["multiple memories"];
#[derive(Default)]
struct ModuleRegistry {
@@ -307,24 +311,13 @@ impl WastRunner {
&format!("AssertMalformed({i})"),
span.linecol_in(wast_raw),
match res {
- Ok(_) => {
- if message == "zero byte expected"
- || message == "integer representation too long"
- || message == "zero flag expected"
- {
- continue;
- }
- Err(anyhow!("expected module to be malformed: {message}"))
- }
+ Ok(_) if ACCEPTED_MALFORMED_MESSAGES.contains(&message) => Ok(()),
+ Ok(_) => Err(anyhow!("expected module to be malformed: {message}")),
Err(_) => Ok(()),
},
);
}
AssertInvalid { span, mut module, message } => {
- if ["multiple memories", "type mismatch"].contains(&message) {
- test_group.add_result(&format!("AssertInvalid({i})"), span.linecol_in(wast_raw), Ok(()));
- continue;
- }
let res = catch_unwind_silent(move || parse_module_bytes(&module.encode().unwrap()))
.map_err(|e| anyhow!("failed to parse module (invalid): {}", try_downcast_panic(e)))
.and_then(|res| res);
@@ -332,7 +325,8 @@ impl WastRunner {
&format!("AssertInvalid({i})"),
span.linecol_in(wast_raw),
match res {
- Ok(_) => Err(anyhow!("expected module to be invalid")),
+ Ok(_) if ACCEPTED_INVALID_MESSAGES.contains(&message) => Ok(()),
+ Ok(_) => Err(anyhow!("expected module to be invalid: {message}")),
Err(_) => Ok(()),
},
);