From ffd8f4863e3693956494572ce8f6bd6c37a38978 Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 20 Jul 2025 21:59:51 +0200 Subject: [PATCH 1/2] add Wasmi specific local.tee test case --- crates/wast/tests/local/local-tee.wast | 22 ++++++++++++++++++++++ crates/wast/tests/mod.rs | 7 +++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 crates/wast/tests/local/local-tee.wast diff --git a/crates/wast/tests/local/local-tee.wast b/crates/wast/tests/local/local-tee.wast new file mode 100644 index 0000000000..c4200c835b --- /dev/null +++ b/crates/wast/tests/local/local-tee.wast @@ -0,0 +1,22 @@ +(module + (func (export "local.tee.same") (param i32) (result i32) + (local.tee 0 (local.get 0)) + ) + (func (export "local.tee.same.drop") (param i32) + (drop (local.tee 0 (local.get 0))) + ) +) + +(assert_return + (invoke "local.tee.same" (i32.const 0)) (i32.const 0) +) +(assert_return + (invoke "local.tee.same" (i32.const 1)) (i32.const 1) +) + +(assert_return + (invoke "local.tee.same.drop" (i32.const 0)) +) +(assert_return + (invoke "local.tee.same.drop" (i32.const 1)) +) diff --git a/crates/wast/tests/mod.rs b/crates/wast/tests/mod.rs index 73a62e87ec..a1413e988a 100644 --- a/crates/wast/tests/mod.rs +++ b/crates/wast/tests/mod.rs @@ -197,8 +197,11 @@ macro_rules! expand_tests { fn wasm_utf8_import_module("utf8-import-module"); fn wasm_utf8_invalid_encoding("utf8-invalid-encoding"); fn wasm_wide_arithmetic("proposals/wide-arithmetic/wide-arithmetic"); - fn wasm_wide_arithmetic_local("../../local/wide-arithmetic"); - fn wasm_replace_result("../../local/replace-result"); + + // Wasmi specific test cases + fn wasmi_wide_arithmetic("../../local/wide-arithmetic"); + fn wasmi_replace_result("../../local/replace-result"); + fn wasmi_local_tee("../../local/local-tee"); // Wasm `simd` tests fn wasm_simd_address("simd_address"); From 11531f5eddd5955e5e9b34614cf705dc11aab7fe Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Mon, 21 Jul 2025 10:32:46 +0200 Subject: [PATCH 2/2] add Wasmi specific if.wast test case --- crates/wast/tests/local/if.wast | 10 ++++++++++ crates/wast/tests/mod.rs | 1 + 2 files changed, 11 insertions(+) create mode 100644 crates/wast/tests/local/if.wast diff --git a/crates/wast/tests/local/if.wast b/crates/wast/tests/local/if.wast new file mode 100644 index 0000000000..eaf65c4303 --- /dev/null +++ b/crates/wast/tests/local/if.wast @@ -0,0 +1,10 @@ +(module + (func (export "if.only-then.diverging") + (if + (i32.const 0) ;; false + (then + (br 0) + ) + ) + ) +) diff --git a/crates/wast/tests/mod.rs b/crates/wast/tests/mod.rs index a1413e988a..7786791597 100644 --- a/crates/wast/tests/mod.rs +++ b/crates/wast/tests/mod.rs @@ -202,6 +202,7 @@ macro_rules! expand_tests { fn wasmi_wide_arithmetic("../../local/wide-arithmetic"); fn wasmi_replace_result("../../local/replace-result"); fn wasmi_local_tee("../../local/local-tee"); + fn wasmi_if("../../local/if"); // Wasm `simd` tests fn wasm_simd_address("simd_address");