From b54cc81dad6704f1d5d6a1f40282eb340bf6cf6b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 28 Sep 2022 07:38:09 -0700 Subject: [PATCH 1/4] Update spec test repo Our submodule was accidentally reverted to an older commit as part of #4271 and while it could be updated to as it was before I went ahead and updated it to `main`. --- crates/wast/src/wast.rs | 6 +++--- tests/spec_testsuite | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/wast/src/wast.rs b/crates/wast/src/wast.rs index 6980a0317d65..a8460ab2c508 100644 --- a/crates/wast/src/wast.rs +++ b/crates/wast/src/wast.rs @@ -476,9 +476,6 @@ impl WastContext { fn is_matching_assert_invalid_error_message(expected: &str, actual: &str) -> bool { actual.contains(expected) - // `elem.wast` and `proposals/bulk-memory-operations/elem.wast` disagree - // on the expected error message for the same error. - || (expected.contains("out of bounds") && actual.contains("does not fit")) // slight difference in error messages || (expected.contains("unknown elem segment") && actual.contains("unknown element segment")) // The same test here is asserted to have one error message in @@ -486,4 +483,7 @@ fn is_matching_assert_invalid_error_message(expected: &str, actual: &str) -> boo // `memory64/memory.wast`, so we equate these two error messages to get // the memory64 tests to pass. || (expected.contains("memory size must be at most 65536 pages") && actual.contains("invalid u32 number")) + // the spec test suite asserts a different error message than we print + // for this scenario + || (expected == "unknown global" && actual.contains("global.get of locally defined global")) } diff --git a/tests/spec_testsuite b/tests/spec_testsuite index 4fd2339b5e97..4f77306bb631 160000 --- a/tests/spec_testsuite +++ b/tests/spec_testsuite @@ -1 +1 @@ -Subproject commit 4fd2339b5e9709e74b326797f69a88b13eac4d47 +Subproject commit 4f77306bb63151631d84f58dedf67958eb9911b9 From 30b0d00c8df3b27efde0bebbc2f1b8b41a2fa279 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 28 Sep 2022 08:29:25 -0700 Subject: [PATCH 2/4] Update ignore directives and test multi-memory --- build.rs | 33 +++++++++++++-------------------- tests/all/wast.rs | 4 +--- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/build.rs b/build.rs index 4baa936c3277..713122e4cf2f 100644 --- a/build.rs +++ b/build.rs @@ -38,6 +38,11 @@ fn main() -> anyhow::Result<()> { // out. if spec_tests > 0 { test_directory_module(out, "tests/spec_testsuite/proposals/memory64", strategy)?; + test_directory_module( + out, + "tests/spec_testsuite/proposals/multi-memory", + strategy, + )?; } else { println!( "cargo:warning=The spec testsuite is disabled. To enable, run `git submodule \ @@ -167,26 +172,14 @@ fn write_testsuite_tests( /// Ignore tests that aren't supported yet. fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { - match strategy { - "Cranelift" => match (testsuite, testname) { + assert_eq!(strategy, "Cranelift"); + drop(testsuite); + match env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() { + "s390x" => { // FIXME: These tests fail under qemu due to a qemu bug. - (_, "simd_f32x4_pmin_pmax") if platform_is_s390x() => return true, - (_, "simd_f64x2_pmin_pmax") if platform_is_s390x() => return true, - // riscv64 backend does not yet have a fully complete SIMD backend. - ("simd", _) if platform_is_riscv64() => return true, - ("memory64", "simd") if platform_is_riscv64() => return true, - _ => {} - }, - _ => panic!("unrecognized strategy"), + testname == "simd_f32x4_pmin_pmax" || testname == "simd_f64x2_pmin_pmax" + } + "riscv64" => testname.contains("simd"), + _ => false, } - - false -} - -fn platform_is_s390x() -> bool { - env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "s390x" -} - -fn platform_is_riscv64() -> bool { - env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "riscv64" } diff --git a/tests/all/wast.rs b/tests/all/wast.rs index e59b290e79eb..280c68779648 100644 --- a/tests/all/wast.rs +++ b/tests/all/wast.rs @@ -21,14 +21,12 @@ fn run_wast(wast: &str, strategy: Strategy, pooling: bool) -> anyhow::Result<()> } let wast = Path::new(wast); - let simd = feature_found(wast, "simd"); let memory64 = feature_found(wast, "memory64"); let multi_memory = feature_found(wast, "multi-memory"); let threads = feature_found(wast, "threads"); let mut cfg = Config::new(); - cfg.wasm_simd(simd) - .wasm_multi_memory(multi_memory) + cfg.wasm_multi_memory(multi_memory) .wasm_threads(threads) .wasm_memory64(memory64) .cranelift_debug_verifier(true); From 0d7a9b3b7ff69473fbb8d84964f6d470f595ebf5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 28 Sep 2022 08:38:27 -0700 Subject: [PATCH 3/4] Update riscv ignores --- build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 713122e4cf2f..2fa87d11c7bc 100644 --- a/build.rs +++ b/build.rs @@ -179,7 +179,11 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { // FIXME: These tests fail under qemu due to a qemu bug. testname == "simd_f32x4_pmin_pmax" || testname == "simd_f64x2_pmin_pmax" } - "riscv64" => testname.contains("simd"), + + // Currently the simd wasm proposal is not implemented in the riscv64 + // backend so skip all tests which could use simd. + "riscv64" => testname.contains("simd") || testname.contains("memory_multi"), + _ => false, } } From f752d5f3d79e2ee9a7aaffe57af585cf6f808a26 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 28 Sep 2022 09:21:34 -0700 Subject: [PATCH 4/4] More riscv updates --- build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 2fa87d11c7bc..91d834221b6f 100644 --- a/build.rs +++ b/build.rs @@ -173,7 +173,6 @@ fn write_testsuite_tests( /// Ignore tests that aren't supported yet. fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { assert_eq!(strategy, "Cranelift"); - drop(testsuite); match env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() { "s390x" => { // FIXME: These tests fail under qemu due to a qemu bug. @@ -182,7 +181,9 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { // Currently the simd wasm proposal is not implemented in the riscv64 // backend so skip all tests which could use simd. - "riscv64" => testname.contains("simd") || testname.contains("memory_multi"), + "riscv64" => { + testsuite == "simd" || testname.contains("simd") || testname.contains("memory_multi") + } _ => false, }