Skip to content

Commit 883eda3

Browse files
test: fix wasm-reference-types tests, update readme
Signed-off-by: Henry <mail@henrygressmann.de>
1 parent c2499d9 commit 883eda3

4 files changed

Lines changed: 38 additions & 35 deletions

File tree

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,30 @@ Untrusted WebAssembly code should not be able to crash the runtime or access mem
3939

4040
## Supported Proposals
4141

42-
| Proposal | Status | `tinywasm` Version |
43-
| --------------------------------------------------------------------------------------------------------------------------------- | ------ | ------------------ |
44-
| [**Multi-value**](https://github.com/WebAssembly/spec/blob/master/proposals/multi-value/Overview.md) | 🟢 | 0.2.0 |
45-
| [**Mutable Globals**](https://github.com/WebAssembly/mutable-global/blob/master/proposals/mutable-global/Overview.md) | 🟢 | 0.2.0 |
46-
| [**Non-trapping float-to-int Conversion**](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) | 🟢 | 0.2.0 |
47-
| [**Sign-extension operators**](https://github.com/WebAssembly/sign-extension-ops) | 🟢 | 0.2.0 |
48-
| [**Bulk Memory Operations**](https://github.com/WebAssembly/spec/blob/master/proposals/bulk-memory-operations/Overview.md) | 🟢 | 0.4.0 |
49-
| [**Reference Types**](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md) | 🟢 | 0.7.0 |
50-
| [**Multi-memory**](https://github.com/WebAssembly/multi-memory/blob/master/proposals/multi-memory/Overview.md) | 🟢 | 0.8.0 |
51-
| [**Annotations**](https://github.com/WebAssembly/annotations/blob/main/proposals/annotations/Overview.md) | 🟢 | `next` |
52-
| [**Custom Page Sizes**](https://github.com/WebAssembly/custom-page-sizes/blob/main/proposals/custom-page-sizes/Overview.md) | 🟢 | `next` |
53-
| [**Extended Const**](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md) | 🟢 | `next` |
54-
| [**Fixed-Width SIMD**](https://github.com/WebAssembly/simd/blob/main/proposals/simd/Overview.md) | 🟢 | `next` |
55-
| [**Memory64**](https://github.com/WebAssembly/memory64/blob/master/proposals/memory64/Overview.md) | 🟢 | `next` |
56-
| [**Tail Call**](https://github.com/WebAssembly/tail-call/blob/main/proposals/tail-call/Overview.md) | 🟢 | `next` |
57-
| [**Relaxed SIMD**](https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md) | 🟢 | `next` |
58-
| [**Wide Arithmetic**](https://github.com/WebAssembly/wide-arithmetic/blob/main/proposals/wide-arithmetic/Overview.md) | 🟢 | `next` |
59-
| [**Custom Descriptors**](https://github.com/WebAssembly/custom-descriptors/blob/main/proposals/custom-descriptors/Overview.md) | 🌑 | - |
60-
| [**Exception Handling**](https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md) | 🌑 | - |
61-
| [**Function References**](https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md) | 🌑 | - |
62-
| [**Garbage Collection**](https://github.com/WebAssembly/gc/blob/main/proposals/gc/Overview.md) | 🌑 | - |
63-
| [**Threads**](https://github.com/WebAssembly/threads/blob/main/proposals/threads/Overview.md) | 🌑 | - |
42+
| Proposal | Status | `tinywasm` Version |
43+
| --------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------------------ |
44+
| [**Multi-value**](https://github.com/WebAssembly/spec/blob/master/proposals/multi-value/Overview.md) | 🟢 | 0.2.0 |
45+
| [**Mutable Globals**](https://github.com/WebAssembly/mutable-global/blob/master/proposals/mutable-global/Overview.md) | 🟢 | 0.2.0 |
46+
| [**Non-trapping float-to-int Conversion**](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) | 🟢 | 0.2.0 |
47+
| [**Sign-extension operators**](https://github.com/WebAssembly/sign-extension-ops) | 🟢 | 0.2.0 |
48+
| [**Bulk Memory Operations**](https://github.com/WebAssembly/spec/blob/master/proposals/bulk-memory-operations/Overview.md) | 🟢 | 0.4.0 |
49+
| [**Reference Types**](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md) | 🟢 | 0.7.0 |
50+
| [**Multi-memory**](https://github.com/WebAssembly/multi-memory/blob/master/proposals/multi-memory/Overview.md) | 🟢 | 0.8.0 |
51+
| [**Annotations**](https://github.com/WebAssembly/annotations/blob/main/proposals/annotations/Overview.md) | 🟢 | `next` |
52+
| [**Custom Page Sizes**](https://github.com/WebAssembly/custom-page-sizes/blob/main/proposals/custom-page-sizes/Overview.md) | 🟢 | `next` |
53+
| [**Extended Const**](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md) | 🟢 | `next` |
54+
| [**Fixed-Width SIMD**](https://github.com/WebAssembly/simd/blob/main/proposals/simd/Overview.md) | 🟢 | `next` |
55+
| [**Memory64**](https://github.com/WebAssembly/memory64/blob/master/proposals/memory64/Overview.md) | 🟢 | `next` |
56+
| [**Tail Call**](https://github.com/WebAssembly/tail-call/blob/main/proposals/tail-call/Overview.md) | 🟢 | `next` |
57+
| [**Relaxed SIMD**](https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md) | 🟢 | `next` |
58+
| [**Wide Arithmetic**](https://github.com/WebAssembly/wide-arithmetic/blob/main/proposals/wide-arithmetic/Overview.md) | 🟢 | `next` |
59+
| [**Branch Hinting**](https://github.com/WebAssembly/branch-hinting/blob/master/proposals/branch-hinting/Overview.md) | 🌑 | - |
60+
| [**Custom Descriptors**](https://github.com/WebAssembly/custom-descriptors/blob/main/proposals/custom-descriptors/Overview.md) | 🌑 | - |
61+
| [**Exception Handling**](https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md) | 🌑 | - |
62+
| [**Typed Function References**](https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md) | 🌑 | - |
63+
| [**Garbage Collection**](https://github.com/WebAssembly/gc/blob/main/proposals/gc/Overview.md) | 🌑 | - |
64+
| [**Stack Switching**](https://github.com/WebAssembly/stack-switching/blob/main/proposals/stack-switching/Explainer.md) | 🌑 | - |
65+
| [**Threads**](https://github.com/WebAssembly/threads/blob/main-legacy/proposals/threads/Overview.md) | 🌑 | - |
6466

6567
**Legend**\
6668
🌑 -- not available\

crates/tinywasm/Cargo.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ harness=false
119119
name="test-wasm-nontrapping-float-to-int-conversions"
120120
harness=false
121121

122+
[[test]]
123+
name="test-wasm-reference-types"
124+
harness=false
125+
122126
[[bench]]
123127
name="argon2id"
124128
harness=false
@@ -135,7 +139,6 @@ harness=false
135139
name="tinywasm_modes"
136140
harness=false
137141

138-
139142
[[test]]
140143
name="test-wasm-3"
141144
harness=false
@@ -165,8 +168,3 @@ test=false
165168
name="test-wasm-gc"
166169
harness=false
167170
test=false
168-
169-
[[test]]
170-
name="test-wasm-reference-types"
171-
harness=false
172-
test=false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.0-alpha.0,8971,161,[{"name":"binary-leb128.wast","passed":77,"failed":0},{"name":"binary.wast","passed":134,"failed":8},{"name":"br_table.wast","passed":172,"failed":0},{"name":"bulk.wast","passed":111,"failed":6},{"name":"call_indirect.wast","passed":169,"failed":0},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":31,"failed":14},{"name":"elem.wast","passed":46,"failed":14},{"name":"exports.wast","passed":84,"failed":0},{"name":"global.wast","passed":86,"failed":0},{"name":"imports.wast","passed":158,"failed":0},{"name":"linking.wast","passed":108,"failed":24},{"name":"memory_copy.wast","passed":4432,"failed":18},{"name":"memory_fill.wast","passed":96,"failed":4},{"name":"memory_grow.wast","passed":96,"failed":0},{"name":"memory_init.wast","passed":226,"failed":14},{"name":"ref_func.wast","passed":17,"failed":0},{"name":"ref_is_null.wast","passed":16,"failed":0},{"name":"ref_null.wast","passed":3,"failed":0},{"name":"select.wast","passed":141,"failed":0},{"name":"table-sub.wast","passed":2,"failed":0},{"name":"table.wast","passed":19,"failed":0},{"name":"table_copy.wast","passed":1703,"failed":25},{"name":"table_fill.wast","passed":42,"failed":3},{"name":"table_get.wast","passed":12,"failed":4},{"name":"table_grow.wast","passed":50,"failed":0},{"name":"table_init.wast","passed":762,"failed":18},{"name":"table_set.wast","passed":18,"failed":8},{"name":"table_size.wast","passed":39,"failed":0},{"name":"unreached-invalid.wast","passed":110,"failed":1}]
1+
0.9.0-alpha.0,9124,0,[{"name":"binary-leb128.wast","passed":77,"failed":0},{"name":"binary.wast","passed":134,"failed":0},{"name":"br_table.wast","passed":172,"failed":0},{"name":"bulk.wast","passed":117,"failed":0},{"name":"call_indirect.wast","passed":169,"failed":0},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":45,"failed":0},{"name":"elem.wast","passed":60,"failed":0},{"name":"exports.wast","passed":84,"failed":0},{"name":"global.wast","passed":86,"failed":0},{"name":"imports.wast","passed":158,"failed":0},{"name":"linking.wast","passed":132,"failed":0},{"name":"memory_copy.wast","passed":4450,"failed":0},{"name":"memory_fill.wast","passed":100,"failed":0},{"name":"memory_grow.wast","passed":96,"failed":0},{"name":"memory_init.wast","passed":240,"failed":0},{"name":"ref_func.wast","passed":17,"failed":0},{"name":"ref_is_null.wast","passed":16,"failed":0},{"name":"ref_null.wast","passed":3,"failed":0},{"name":"select.wast","passed":141,"failed":0},{"name":"table-sub.wast","passed":2,"failed":0},{"name":"table.wast","passed":19,"failed":0},{"name":"table_copy.wast","passed":1728,"failed":0},{"name":"table_fill.wast","passed":45,"failed":0},{"name":"table_get.wast","passed":16,"failed":0},{"name":"table_grow.wast","passed":50,"failed":0},{"name":"table_init.wast","passed":780,"failed":0},{"name":"table_set.wast","passed":26,"failed":0},{"name":"table_size.wast","passed":39,"failed":0},{"name":"unreached-invalid.wast","passed":111,"failed":0}]

crates/tinywasm/tests/testsuite/run.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ use crate::testsuite::util::*;
22
use std::{borrow::Cow, collections::HashMap, fs::canonicalize, path::PathBuf};
33

44
use super::TestSuite;
5-
use eyre::{Result, eyre};
5+
use eyre::{eyre, Result};
66
use indexmap::IndexMap;
77
use log::{debug, error, info};
88
use tinywasm::{Extern, Imports, ModuleInstance};
99
use tinywasm_types::{ExternVal, MemoryType, ModuleInstanceAddr, TableType, ValType, WasmValue};
1010
use wasm_testsuite::data::TestFile;
1111
use wasm_testsuite::wast;
12-
use wasm_testsuite::wast::{Wast, lexer::Lexer, parser::ParseBuffer};
12+
use wasm_testsuite::wast::{lexer::Lexer, parser::ParseBuffer, Wast};
1313

1414
#[derive(Default)]
1515
struct ModuleRegistry {
@@ -242,7 +242,10 @@ impl TestSuite {
242242
// - skip "zero byte expected" as the magic number is not checked by wasmparser
243243
// (Don't need to error on this, doesn't matter if it's malformed)
244244
// - skip "integer representation too long" as this has some false positives on older tests
245-
if message == "zero byte expected" || message == "integer representation too long" {
245+
if message == "zero byte expected"
246+
|| message == "integer representation too long"
247+
|| message == "zero flag expected"
248+
{
246249
continue;
247250
}
248251

@@ -254,7 +257,7 @@ impl TestSuite {
254257
}
255258

256259
AssertInvalid { span, mut module, message } => {
257-
if ["multiple memories"].contains(&message) {
260+
if ["multiple memories", "type mismatch"].contains(&message) {
258261
test_group.add_result(&format!("AssertInvalid({i})"), span.linecol_in(wast_raw), Ok(()));
259262
continue;
260263
}
@@ -288,7 +291,7 @@ impl TestSuite {
288291
continue;
289292
};
290293

291-
if !message.starts_with(trap.message()) {
294+
if !message.starts_with(trap.message()) && !trap.message().starts_with(message) {
292295
test_group.add_result(
293296
&format!("AssertExhaustion({i})"),
294297
span.linecol_in(wast_raw),
@@ -329,7 +332,7 @@ impl TestSuite {
329332
Err(eyre!("test panicked: {:?}", try_downcast_panic(err))),
330333
),
331334
Ok(Err(tinywasm::Error::Trap(trap))) => {
332-
if !message.starts_with(trap.message()) {
335+
if !message.starts_with(trap.message()) && !trap.message().starts_with(message) {
333336
test_group.add_result(
334337
&format!("AssertTrap({i})"),
335338
span.linecol_in(wast_raw),

0 commit comments

Comments
 (0)