Commit 5b239cce authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm] Delete old bulk-memory spec tests

By having the proposal tests now as part of the wasm-spec-tests, we do
not need them here anymore.

R=clemensh@chromium.org
CC=binji@chromium.org

Change-Id: I2530a4d2e2e8caa6fe8ef4d7e7b8b6da550a5134
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1706475Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62778}
parent cd34523b
This directory contains the bulk-memory proposal tests, converted to JS using
the reference interpreter using the following shell command:
```
for f in *.wast; do wasm $f -o $f.js; done
```
Where `wasm` is the reference interpreter compiled from the bulk memory
proposal (https://github.com/WebAssembly/bulk-memory-operations).
This only includes the tests that are different than the spec repo. The
testsuite repo (https://github.com/WebAssembly/testsuite) has a tool which
calculates this, see
https://github.com/WebAssembly/testsuite/tree/master/proposals/bulk-memory-operations
The contents are copied from the following revisions:
WebAssembly/testsuite: 2a2099d52103215962707fbe9f44cd51fd146636
WebAssembly/bulk-memory-operations: 47b4ae718b42081a220ac7f405bed1391661a635
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
(module binary
"\00asm" "\01\00\00\00"
"\00\24\10" "a custom section" "this is the payload"
"\00\20\10" "a custom section" "this is payload"
"\00\11\10" "a custom section" ""
"\00\10\00" "" "this is payload"
"\00\01\00" "" ""
"\00\24\10" "\00\00custom sectio\00" "this is the payload"
"\00\24\10" "\ef\bb\bfa custom sect" "this is the payload"
"\00\24\10" "a custom sect\e2\8c\a3" "this is the payload"
"\00\1f\16" "module within a module" "\00asm" "\01\00\00\00"
)
(module binary
"\00asm" "\01\00\00\00"
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\01\01\00" ;; type section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\02\01\00" ;; import section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\03\01\00" ;; function section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\04\01\00" ;; table section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\05\01\00" ;; memory section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\06\01\00" ;; global section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\07\01\00" ;; export section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\09\01\00" ;; element section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\0a\01\00" ;; code section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\0b\01\00" ;; data section
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
)
(module binary
"\00asm" "\01\00\00\00"
"\01\07\01\60\02\7f\7f\01\7f" ;; type section
"\00\1a\06" "custom" "this is the payload" ;; custom section
"\03\02\01\00" ;; function section
"\07\0a\01\06\61\64\64\54\77\6f\00\00" ;; export section
"\0a\09\01\07\00\20\00\20\01\6a\0b" ;; code section
"\00\1b\07" "custom2" "this is the payload" ;; custom section
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\00"
)
"unexpected end"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\00\00"
)
"unexpected end"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\00\00\00\05\01\00\07\00\00"
)
"unexpected end"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\00\26\10" "a custom section" "this is the payload"
)
"unexpected end"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\00\25\10" "a custom section" "this is the payload"
"\00\24\10" "a custom section" "this is the payload"
)
"invalid section id"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01\07\01\60\02\7f\7f\01\7f" ;; type section
"\00\25\10" "a custom section" "this is the payload" ;; invalid length!
"\03\02\01\00" ;; function section
"\0a\09\01\07\00\20\00\20\01\6a\0b" ;; code section
"\00\1b\07" "custom2" "this is the payload" ;; custom section
)
"function and code section have inconsistent lengths"
)
;; Test concatenated modules.
(assert_malformed
(module binary
"\00asm\01\00\00\00"
"\00asm\01\00\00\00"
)
"length out of bounds"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\03\01\00\01" ;; memory section
"\0c\01\02" ;; data count section (2 segments)
"\0b\06\01\00\41\00\0b\00" ;; data section (1 segment)
)
"data count and data section have inconsistent lengths"
)
'use strict';
let spectest = {
print: console.log.bind(console),
print_i32: console.log.bind(console),
print_i32_f32: console.log.bind(console),
print_f64_f64: console.log.bind(console),
print_f32: console.log.bind(console),
print_f64: console.log.bind(console),
global_i32: 666,
global_f32: 666,
global_f64: 666,
table: new WebAssembly.Table({initial: 10, maximum: 20, element: 'anyfunc'}),
memory: new WebAssembly.Memory({initial: 1, maximum: 2})
};
let handler = {
get(target, prop) {
return (prop in target) ? target[prop] : {};
}
};
let registry = new Proxy({spectest}, handler);
function register(name, instance) {
registry[name] = instance.exports;
}
function module(bytes, valid = true) {
let buffer = new ArrayBuffer(bytes.length);
let view = new Uint8Array(buffer);
for (let i = 0; i < bytes.length; ++i) {
view[i] = bytes.charCodeAt(i);
}
let validated;
try {
validated = WebAssembly.validate(buffer);
} catch (e) {
throw new Error("Wasm validate throws");
}
if (validated !== valid) {
throw new Error("Wasm validate failure" + (valid ? "" : " expected"));
}
return new WebAssembly.Module(buffer);
}
function instance(bytes, imports = registry) {
return new WebAssembly.Instance(module(bytes), imports);
}
function call(instance, name, args) {
return instance.exports[name](...args);
}
function get(instance, name) {
let v = instance.exports[name];
return (v instanceof WebAssembly.Global) ? v.value : v;
}
function exports(name, instance) {
return {[name]: instance.exports};
}
function run(action) {
action();
}
function assert_malformed(bytes) {
try { module(bytes, false) } catch (e) {
if (e instanceof WebAssembly.CompileError) return;
}
throw new Error("Wasm decoding failure expected");
}
function assert_invalid(bytes) {
try { module(bytes, false) } catch (e) {
if (e instanceof WebAssembly.CompileError) return;
}
throw new Error("Wasm validation failure expected");
}
function assert_unlinkable(bytes) {
let mod = module(bytes);
try { new WebAssembly.Instance(mod, registry) } catch (e) {
if (e instanceof WebAssembly.LinkError) return;
}
throw new Error("Wasm linking failure expected");
}
function assert_uninstantiable(bytes) {
let mod = module(bytes);
try { new WebAssembly.Instance(mod, registry) } catch (e) {
if (e instanceof WebAssembly.RuntimeError) return;
}
throw new Error("Wasm trap expected");
}
function assert_trap(action) {
try { action() } catch (e) {
if (e instanceof WebAssembly.RuntimeError) return;
}
throw new Error("Wasm trap expected");
}
let StackOverflow;
try { (function f() { 1 + f() })() } catch (e) { StackOverflow = e.constructor }
function assert_exhaustion(action) {
try { action() } catch (e) {
if (e instanceof StackOverflow) return;
}
throw new Error("Wasm resource exhaustion expected");
}
function assert_return(action, expected) {
let actual = action();
if (!Object.is(actual, expected)) {
throw new Error("Wasm return value " + expected + " expected, got " + actual);
};
}
function assert_return_canonical_nan(action) {
let actual = action();
// Note that JS can't reliably distinguish different NaN values,
// so there's no good way to test that it's a canonical NaN.
if (!Number.isNaN(actual)) {
throw new Error("Wasm return value NaN expected, got " + actual);
};
}
function assert_return_arithmetic_nan(action) {
// Note that JS can't reliably distinguish different NaN values,
// so there's no good way to test for specific bitpatterns here.
let actual = action();
if (!Number.isNaN(actual)) {
throw new Error("Wasm return value NaN expected, got " + actual);
};
}
// custom.wast:1
let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x24\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x20\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x11\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x00\x10\x00\x74\x68\x69\x73\x20\x69\x73\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x01\x00\x00\x24\x10\x00\x00\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x00\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x24\x10\xef\xbb\xbf\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x24\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\xe2\x8c\xa3\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x1f\x16\x6d\x6f\x64\x75\x6c\x65\x20\x77\x69\x74\x68\x69\x6e\x20\x61\x20\x6d\x6f\x64\x75\x6c\x65\x00\x61\x73\x6d\x01\x00\x00\x00");
// custom.wast:14
let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x01\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x02\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x03\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x04\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x05\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x06\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x07\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x09\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x0a\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x0b\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64");
// custom.wast:50
let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x07\x01\x60\x02\x7f\x7f\x01\x7f\x00\x1a\x06\x63\x75\x73\x74\x6f\x6d\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x03\x02\x01\x00\x07\x0a\x01\x06\x61\x64\x64\x54\x77\x6f\x00\x00\x0a\x09\x01\x07\x00\x20\x00\x20\x01\x6a\x0b\x00\x1b\x07\x63\x75\x73\x74\x6f\x6d\x32\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64");
// custom.wast:60
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00");
// custom.wast:68
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x00");
// custom.wast:76
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x00\x00\x05\x01\x00\x07\x00\x00");
// custom.wast:84
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x26\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64");
// custom.wast:92
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x25\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x24\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64");
// custom.wast:101
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x07\x01\x60\x02\x7f\x7f\x01\x7f\x00\x25\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x03\x02\x01\x00\x0a\x09\x01\x07\x00\x20\x00\x20\x01\x6a\x0b\x00\x1b\x07\x63\x75\x73\x74\x6f\x6d\x32\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64");
// custom.wast:114
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x61\x73\x6d\x01\x00\x00\x00");
// custom.wast:122
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x03\x01\x00\x01\x0c\x01\x02\x0b\x06\x01\x00\x41\x00\x0b\x00");
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment