diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-04 20:25:33 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-04 20:25:33 -0800 |
commit | 9b50ed1c8702c1e9236ae146a31c79be443f6c84 (patch) | |
tree | 70ed02102b89fefe19147f8d6605130398f3b7e9 /src | |
parent | 1b693d221566b017b63e002526bfbe724522e679 (diff) | |
download | binaryen-9b50ed1c8702c1e9236ae146a31c79be443f6c84.tar.gz binaryen-9b50ed1c8702c1e9236ae146a31c79be443f6c84.tar.bz2 binaryen-9b50ed1c8702c1e9236ae146a31c79be443f6c84.zip |
verify return values
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-shell.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp index 4d16a8d3b..f5762807d 100644 --- a/src/wasm-shell.cpp +++ b/src/wasm-shell.cpp @@ -156,12 +156,21 @@ int main(int argc, char **argv) { arguments.push_back(argument->dyn_cast<Const>()->value); } bool trapped = false; + Literal result; if (setjmp(interface->trapState) == 0) { - instance->callFunction(name, arguments); + result = instance->callFunction(name, arguments); } else { trapped = true; } - if (id == ASSERT_RETURN) assert(!trapped); + if (id == ASSERT_RETURN) { + assert(!trapped); + Literal expected; + if (curr.size() >= 3) { + expected = builder.parseExpression(*curr[2])->dyn_cast<Const>()->value; + } + std::cerr << "seen " << result << ", expected " << expected << '\n'; + assert(expected == result); + } if (id == ASSERT_TRAP) assert(trapped); i++; } |