summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck.py16
-rw-r--r--src/wasm-s-parser.h12
m---------test/experimental0
3 files changed, 26 insertions, 2 deletions
diff --git a/check.py b/check.py
index e64a3460c..d9280f54e 100755
--- a/check.py
+++ b/check.py
@@ -212,6 +212,22 @@ for t in spec_tests:
if actual != expected:
fail(actual, expected)
+print '\n[ checking binaryen-shell experimental testcases... ]\n'
+
+if len(requested) == 0:
+ BLACKLIST = ['call.wast', 'cfg-stackify.wast', 'inline-asm.wast', 'permute.wast', 'switch.wast', 'vtable.wast']
+ experimental_tests = [os.path.join('experimental', 'prototype-wasmate', 'test', 'expected-output', t) for t in sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test', 'expected-output'))) if t not in BLACKLIST]
+else:
+ experimental_tests = requested[:]
+
+for t in experimental_tests:
+ if t.startswith('experimental') and t.endswith('.wast'):
+ print '..', t
+ wast = os.path.join('test', t)
+ proc = subprocess.Popen([os.path.join('bin', 'binaryen-shell'), wast], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ actual, err = proc.communicate()
+ assert proc.returncode == 0, err
+
print '\n[ checking .s testcases... ]\n'
for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test'))):
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index a48f4bd9e..0271370dd 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -237,6 +237,7 @@ public:
functionCounter = 0;
for (unsigned i = 1; i < module.size(); i++) {
preParseFunctionType(*module[i]);
+ preParseImports(*module[i]);
}
functionCounter = 0;
for (unsigned i = 1; i < module.size(); i++) {
@@ -278,12 +279,17 @@ private:
functionTypes[name] = none;
}
+ void preParseImports(Element& curr) {
+ IString id = curr[0]->str();
+ if (id == IMPORT) parseImport(curr);
+ }
+
void parseModuleElement(Element& curr) {
IString id = curr[0]->str();
if (id == FUNC) return parseFunction(curr);
if (id == MEMORY) return parseMemory(curr);
if (id == EXPORT) return parseExport(curr);
- if (id == IMPORT) return parseImport(curr);
+ if (id == IMPORT) return; // already done
if (id == TABLE) return parseTable(curr);
if (id == TYPE) return; // already done
std::cerr << "bad module element " << id.str << '\n';
@@ -889,7 +895,9 @@ private:
}
auto ret = allocator.alloc<Break>();
ret->name = FAKE_RETURN;
- ret->value = parseExpression(s[1]);
+ if (s.size() >= 2) {
+ ret->value = parseExpression(s[1]);
+ }
return ret;
}
diff --git a/test/experimental b/test/experimental
-Subproject 91e35b224e26717696c1df6e6c59e694011a829
+Subproject 66273116b4dbb6465e89f97b0c4a49942ed55a0