Relocate wasm tests and actually add them to the test runner
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Nov 2016 02:25:48 +0000 (02:25 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Nov 2016 02:25:48 +0000 (02:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164668

Reviewed by Yusuke Suzuki.

This moves the Wasm tests from their current location down a level.
Without relocating, the tests cannot properly be run by the wasm test runner.

* wasm.yaml:
* wasm/Builder.js: Fix typos, yay lazy synatx checking!
* wasm/LowLevelBinary.js: Fix typos, yay lazy synatx checking!
(export.default.LowLevelBinary.prototype.get return):
* wasm/function-tests/add-12.js: Renamed from JSTests/wasm/js-api/function-tests/add-12.js.
* wasm/function-tests/br-if-loop-less-than.js: Renamed from JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js.
* wasm/function-tests/brTableAsIf.js: Renamed from JSTests/wasm/js-api/function-tests/brTableAsIf.js.
* wasm/function-tests/brTableManyValues.js: Renamed from JSTests/wasm/js-api/function-tests/brTableManyValues.js.
* wasm/function-tests/brTableWithLoop.js: Renamed from JSTests/wasm/js-api/function-tests/brTableWithLoop.js.
* wasm/function-tests/dumb-eq-if-then-else.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js.
* wasm/function-tests/dumb-less-than-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js.
* wasm/function-tests/dumb-less-than-ite.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js.
* wasm/function-tests/factorial.js: Renamed from JSTests/wasm/js-api/function-tests/factorial.js.
* wasm/function-tests/float-sub.js: Renamed from JSTests/wasm/js-api/function-tests/float-sub.js.
* wasm/function-tests/i32-load.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load.js.
* wasm/function-tests/i32-load8-s.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load8-s.js.
* wasm/function-tests/if-then-else-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js.
* wasm/function-tests/if-then-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-fallthrough.js.
* wasm/function-tests/loop-mult.js: Renamed from JSTests/wasm/js-api/function-tests/loop-mult.js.
* wasm/function-tests/loop-sum.js: Renamed from JSTests/wasm/js-api/function-tests/loop-sum.js.
* wasm/function-tests/ret5.js: Renamed from JSTests/wasm/js-api/function-tests/ret5.js.
* wasm/self-test/test_BuilderJSON.js: Rebasline

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208634 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
JSTests/ChangeLog
JSTests/wasm.yaml
JSTests/wasm/Builder.js
JSTests/wasm/LowLevelBinary.js
JSTests/wasm/function-tests/add-12.js [moved from JSTests/wasm/js-api/function-tests/add-12.js with 98% similarity]
JSTests/wasm/function-tests/br-if-loop-less-than.js [moved from JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js with 95% similarity]
JSTests/wasm/function-tests/brTableAsIf.js [moved from JSTests/wasm/js-api/function-tests/brTableAsIf.js with 91% similarity]
JSTests/wasm/function-tests/brTableManyValues.js [moved from JSTests/wasm/js-api/function-tests/brTableManyValues.js with 95% similarity]
JSTests/wasm/function-tests/brTableWithLoop.js [moved from JSTests/wasm/js-api/function-tests/brTableWithLoop.js with 89% similarity]
JSTests/wasm/function-tests/dumb-eq-if-then-else.js [moved from JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js with 95% similarity]
JSTests/wasm/function-tests/dumb-less-than-fallthrough.js [moved from JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js with 95% similarity]
JSTests/wasm/function-tests/dumb-less-than-ite.js [moved from JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js with 95% similarity]
JSTests/wasm/function-tests/factorial.js [moved from JSTests/wasm/js-api/function-tests/factorial.js with 91% similarity]
JSTests/wasm/function-tests/float-sub.js [moved from JSTests/wasm/js-api/function-tests/float-sub.js with 93% similarity]
JSTests/wasm/function-tests/i32-load.js [moved from JSTests/wasm/js-api/function-tests/i32-load.js with 90% similarity]
JSTests/wasm/function-tests/i32-load8-s.js [moved from JSTests/wasm/js-api/function-tests/i32-load8-s.js with 90% similarity]
JSTests/wasm/function-tests/if-then-else-fallthrough.js [moved from JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js with 88% similarity]
JSTests/wasm/function-tests/if-then-fallthrough.js [moved from JSTests/wasm/js-api/function-tests/if-then-fallthrough.js with 88% similarity]
JSTests/wasm/function-tests/loop-mult.js [moved from JSTests/wasm/js-api/function-tests/loop-mult.js with 92% similarity]
JSTests/wasm/function-tests/loop-sum.js [moved from JSTests/wasm/js-api/function-tests/loop-sum.js with 92% similarity]
JSTests/wasm/function-tests/ret5.js [moved from JSTests/wasm/js-api/function-tests/ret5.js with 86% similarity]
JSTests/wasm/self-test/test_BuilderJSON.js

index b93f3dc..1ae8b83 100644 (file)
@@ -1,5 +1,38 @@
 2016-11-11  Keith Miller  <keith_miller@apple.com>
 
+        Relocate wasm tests and actually add them to the test runner
+        https://bugs.webkit.org/show_bug.cgi?id=164668
+
+        Reviewed by Yusuke Suzuki.
+
+        This moves the Wasm tests from their current location down a level.
+        Without relocating, the tests cannot properly be run by the wasm test runner.
+
+        * wasm.yaml:
+        * wasm/Builder.js: Fix typos, yay lazy synatx checking!
+        * wasm/LowLevelBinary.js: Fix typos, yay lazy synatx checking!
+        (export.default.LowLevelBinary.prototype.get return):
+        * wasm/function-tests/add-12.js: Renamed from JSTests/wasm/js-api/function-tests/add-12.js.
+        * wasm/function-tests/br-if-loop-less-than.js: Renamed from JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js.
+        * wasm/function-tests/brTableAsIf.js: Renamed from JSTests/wasm/js-api/function-tests/brTableAsIf.js.
+        * wasm/function-tests/brTableManyValues.js: Renamed from JSTests/wasm/js-api/function-tests/brTableManyValues.js.
+        * wasm/function-tests/brTableWithLoop.js: Renamed from JSTests/wasm/js-api/function-tests/brTableWithLoop.js.
+        * wasm/function-tests/dumb-eq-if-then-else.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js.
+        * wasm/function-tests/dumb-less-than-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js.
+        * wasm/function-tests/dumb-less-than-ite.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js.
+        * wasm/function-tests/factorial.js: Renamed from JSTests/wasm/js-api/function-tests/factorial.js.
+        * wasm/function-tests/float-sub.js: Renamed from JSTests/wasm/js-api/function-tests/float-sub.js.
+        * wasm/function-tests/i32-load.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load.js.
+        * wasm/function-tests/i32-load8-s.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load8-s.js.
+        * wasm/function-tests/if-then-else-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js.
+        * wasm/function-tests/if-then-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-fallthrough.js.
+        * wasm/function-tests/loop-mult.js: Renamed from JSTests/wasm/js-api/function-tests/loop-mult.js.
+        * wasm/function-tests/loop-sum.js: Renamed from JSTests/wasm/js-api/function-tests/loop-sum.js.
+        * wasm/function-tests/ret5.js: Renamed from JSTests/wasm/js-api/function-tests/ret5.js.
+        * wasm/self-test/test_BuilderJSON.js: Rebasline
+
+2016-11-11  Keith Miller  <keith_miller@apple.com>
+
         Move Wasm tests to JS
         https://bugs.webkit.org/show_bug.cgi?id=164611
 
index 8f4a86e..725fe45 100644 (file)
@@ -25,3 +25,5 @@
   cmd: runWebAssembly
 - path: wasm/js-api/
   cmd: runWebAssembly
+- path: wasm/function-tests
+  cmd: runWebAssembly
\ No newline at end of file
index 76f97b4..c39db5f 100644 (file)
@@ -155,7 +155,7 @@ const _exportFunctionContinuation = (builder, section, nextBuilder) => {
 };
 
 const _checkStackArgs = (op, param) => {
-    for (let expect of paramn) {
+    for (let expect of param) {
         if (WASM.isValidValueType(expect)) {
             // FIXME implement stack checks for arguments. https://bugs.webkit.org/show_bug.cgi?id=163421
         } else {
@@ -195,7 +195,7 @@ const _checkStackReturn = (op, ret) => {
     }
 };
 
-const _checkImms = (op, imms, expectedImms) => {
+const _checkImms = (op, imms, expectedImms, ret) => {
     assert.eq(imms.length, expectedImms.length, `"${op}" expects ${expectedImms.length} immediates, got ${imms.length}`);
     for (let idx = 0; idx !== expectedImms.length; ++idx) {
         const got = imms[idx];
@@ -257,7 +257,7 @@ const _createFunctionBuilder = (func, builder, previousBuilder) => {
             const continuation = args[args.length - 1];
             const hasContinuation = typeof(continuation) === "function";
             const imms = hasContinuation ? args.slice(0, -1) : args; // FIXME: allow passing in stack values, as-if code were a stack machine. Just check for a builder to this function, and drop. https://bugs.webkit.org/show_bug.cgi?id=163422
-            checkImms(op, imms, imm);
+            checkImms(op, imms, imm, ret);
             checkStackArgs(op, param);
             checkStackReturn(op, ret);
             const stackArgs = []; // FIXME https://bugs.webkit.org/show_bug.cgi?id=162706
index ba21af1..e43b346 100644 (file)
@@ -80,7 +80,6 @@ export default class LowLevelBinary {
     trim() { this._buf = this._buf.slice(0, this._used); }
 
     hexdump() { return _hexdump(this._buf, this._used); }
-    trim() { this._buf = this._buf.slice(0, this._used); }
     _maybeGrow(bytes) {
         const allocated = this._buf.length;
         if (allocated - this._used < bytes) {
similarity index 98%
rename from JSTests/wasm/js-api/function-tests/add-12.js
rename to JSTests/wasm/function-tests/add-12.js
index a73cf4b..4d751db 100644 (file)
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
similarity index 91%
rename from JSTests/wasm/js-api/function-tests/factorial.js
rename to JSTests/wasm/function-tests/factorial.js
index ce0b325..1136698 100644 (file)
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
similarity index 93%
rename from JSTests/wasm/js-api/function-tests/float-sub.js
rename to JSTests/wasm/function-tests/float-sub.js
index 81587f2..03fa475 100644 (file)
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
similarity index 90%
rename from JSTests/wasm/js-api/function-tests/i32-load.js
rename to JSTests/wasm/function-tests/i32-load.js
index 72d8f60..d2dbf50 100644 (file)
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
similarity index 92%
rename from JSTests/wasm/js-api/function-tests/loop-mult.js
rename to JSTests/wasm/function-tests/loop-mult.js
index a8b7b7f..46010d5 100644 (file)
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
similarity index 92%
rename from JSTests/wasm/js-api/function-tests/loop-sum.js
rename to JSTests/wasm/function-tests/loop-sum.js
index a8b7b7f..46010d5 100644 (file)
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
similarity index 86%
rename from JSTests/wasm/js-api/function-tests/ret5.js
rename to JSTests/wasm/function-tests/ret5.js
index 493f6b2..02a26bc 100644 (file)
@@ -1,4 +1,4 @@
-import Builder from '../../Builder.js'
+import Builder from '../Builder.js'
 
 const b = new Builder();
 b.setChecked(false);
index eec3be9..472f5ed 100644 (file)
@@ -140,12 +140,12 @@ const assertOpThrows = (opFn, message) => {
 
 (function ImportFunctionWithoutTypeSection() {
     const i = (new Builder()).Import();
-    assert.throws(() => i.Function("foo", "bar", 0), Error, `Shouldn't be undefined: Can't use type 0 if a type section isn't present`);
+    assert.throws(() => i.Function("foo", "bar", 0), Error, `Shouldn't be undefined: Can not use type 0 if a type section is not present`);
 })();
 
 (function ImportFunctionWithInvalidType() {
     const i = (new Builder()).Type().End().Import();
-    assert.throws(() => i.Function("foo", "bar", 0), Error, `Shouldn't be undefined: Type 0 doesn't exist in type section`);
+    assert.throws(() => i.Function("foo", "bar", 0), Error, `Shouldn't be undefined: Type 0 does not exist in type section`);
 })();
 
 (function ImportFunction() {
@@ -211,12 +211,12 @@ const assertOpThrows = (opFn, message) => {
 
 (function ExportFunctionWithoutTypeSection() {
     const e = (new Builder()).Export();
-    assert.throws(() => e.Function("foo", 0, 0), Error, `Shouldn't be undefined: Can't use type 0 if a type section isn't present`);
+    assert.throws(() => e.Function("foo", 0, 0), Error, `Shouldn't be undefined: Can not use type 0 if a type section is not present`);
 })();
 
 (function ExportFunctionWithInvalidType() {
     const e = (new Builder()).Type().End().Export();
-    assert.throws(() => e.Function("foo", 0, 0), Error, `Shouldn't be undefined: Type 0 doesn't exist in type section`);
+    assert.throws(() => e.Function("foo", 0, 0), Error, `Shouldn't be undefined: Type 0 does not exist in type section`);
 })();
 
 (function ExportAnImport() {