Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update wasm2js tests
Including by skipping one that is not supported. Also ignore more
unsupported assertions in wasm2js.
  • Loading branch information
tlively committed Aug 20, 2024
commit ea73ed86fa42b49ba4669eaa844d1b6a19605d7a
9 changes: 6 additions & 3 deletions scripts/test/wasm2js.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
wasm2js_tests = shared.get_tests(shared.get_test_dir('wasm2js'), ['.wast'])
assert_tests = ['wasm2js.wast.asserts']
# These tests exercise functionality not supported by wasm2js
wasm2js_blacklist = ['empty_imported_table.wast']
wasm2js_skipped_tests = [
'empty_imported_table.wast',
'br.wast', # depends on multivalue
]


def check_for_stale_files():
Expand All @@ -52,7 +55,7 @@ def test_wasm2js_output():
for opt in (0, 1):
for t in basic_tests + spec_tests + wasm2js_tests:
basename = os.path.basename(t)
if basename in wasm2js_blacklist:
if basename in wasm2js_skipped_tests:
continue

asm = basename.replace('.wast', '.2asm.js')
Expand Down Expand Up @@ -158,7 +161,7 @@ def update_wasm2js_tests():
if not wasm.endswith('.wast'):
continue

if os.path.basename(wasm) in wasm2js_blacklist:
if os.path.basename(wasm) in wasm2js_skipped_tests:
continue

asm = os.path.basename(wasm).replace('.wast', '.2asm.js')
Expand Down
3 changes: 3 additions & 0 deletions src/tools/wasm2js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,9 @@ void AssertionEmitter::emit() {
// Skip other action assertions.
continue;
}
} else if (std::get_if<AssertModule>(assn)) {
// Skip module assertions
continue;
} else {
Fatal() << "unsupported assertion on line " << script[i].line;
}
Expand Down
56 changes: 35 additions & 21 deletions test/wasm2js/i32.2asm.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,65 +116,75 @@ function asmFunc(imports) {
}

function $18(x) {
x = x | 0;
return x << 24 >> 24 | 0;
}

function $19(x) {
x = x | 0;
return x << 16 >> 16 | 0;
}

function $20(x) {
x = x | 0;
return !x | 0;
}

function $19(x, y) {
function $21(x, y) {
x = x | 0;
y = y | 0;
return (x | 0) == (y | 0) | 0;
}

function $20(x, y) {
function $22(x, y) {
x = x | 0;
y = y | 0;
return (x | 0) != (y | 0) | 0;
}

function $21(x, y) {
function $23(x, y) {
x = x | 0;
y = y | 0;
return (x | 0) < (y | 0) | 0;
}

function $22(x, y) {
function $24(x, y) {
x = x | 0;
y = y | 0;
return x >>> 0 < y >>> 0 | 0;
}

function $23(x, y) {
function $25(x, y) {
x = x | 0;
y = y | 0;
return (x | 0) <= (y | 0) | 0;
}

function $24(x, y) {
function $26(x, y) {
x = x | 0;
y = y | 0;
return x >>> 0 <= y >>> 0 | 0;
}

function $25(x, y) {
function $27(x, y) {
x = x | 0;
y = y | 0;
return (x | 0) > (y | 0) | 0;
}

function $26(x, y) {
function $28(x, y) {
x = x | 0;
y = y | 0;
return x >>> 0 > y >>> 0 | 0;
}

function $27(x, y) {
function $29(x, y) {
x = x | 0;
y = y | 0;
return (x | 0) >= (y | 0) | 0;
}

function $28(x, y) {
function $30(x, y) {
x = x | 0;
y = y | 0;
return x >>> 0 >= y >>> 0 | 0;
Expand Down Expand Up @@ -242,17 +252,19 @@ function asmFunc(imports) {
"clz": $15,
"ctz": $16,
"popcnt": $17,
"eqz": $18,
"eq": $19,
"ne": $20,
"lt_s": $21,
"lt_u": $22,
"le_s": $23,
"le_u": $24,
"gt_s": $25,
"gt_u": $26,
"ge_s": $27,
"ge_u": $28
"extend8_s": $18,
"extend16_s": $19,
"eqz": $20,
"eq": $21,
"ne": $22,
"lt_s": $23,
"lt_u": $24,
"le_s": $25,
"le_u": $26,
"gt_s": $27,
"gt_u": $28,
"ge_s": $29,
"ge_u": $30
};
}

Expand All @@ -276,6 +288,8 @@ export var rotr = retasmFunc.rotr;
export var clz = retasmFunc.clz;
export var ctz = retasmFunc.ctz;
export var popcnt = retasmFunc.popcnt;
export var extend8_s = retasmFunc.extend8_s;
export var extend16_s = retasmFunc.extend16_s;
export var eqz = retasmFunc.eqz;
export var eq = retasmFunc.eq;
export var ne = retasmFunc.ne;
Expand Down