summaryrefslogtreecommitdiff
path: root/src/tools/execution-results.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-04-12 18:37:48 -0700
committerGitHub <noreply@github.com>2021-04-12 18:37:48 -0700
commitb0af95200a37d76eccf285dcb45b4ed6162212d0 (patch)
tree3633c42ad4935b06f2fe88a8e9901b9d0b08d774 /src/tools/execution-results.h
parentc9aa77c3f6452154526456497731da1bc8e7d896 (diff)
downloadbinaryen-b0af95200a37d76eccf285dcb45b4ed6162212d0.tar.gz
binaryen-b0af95200a37d76eccf285dcb45b4ed6162212d0.tar.bz2
binaryen-b0af95200a37d76eccf285dcb45b4ed6162212d0.zip
Fuzzer: Distinguish traps from host limitations (#3801)
Host limitations are arbitrary and can be modified by optimizations, so ignore them. For example, if the optimizer removes allocations then a host limit on an allocation error may vanish. Or, an optimization that removes recursion and replaces it with a loop may avoid a host limit on call depth (that is not done currently, but might some day). This removes a class of annoying false positives in the fuzzer.
Diffstat (limited to 'src/tools/execution-results.h')
-rw-r--r--src/tools/execution-results.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h
index a183ad93b..50f627baf 100644
--- a/src/tools/execution-results.h
+++ b/src/tools/execution-results.h
@@ -90,6 +90,9 @@ struct ExecutionResults {
std::map<Name, Literals> results;
Loggings loggings;
+ // If set, we should ignore this and not compare it to anything.
+ bool ignore = false;
+
// get results of execution
void get(Module& wasm) {
LoggingExternalInterface interface(loggings);
@@ -176,6 +179,10 @@ struct ExecutionResults {
}
bool operator==(ExecutionResults& other) {
+ if (ignore || other.ignore) {
+ std::cout << "ignoring comparison of ExecutionResults!\n";
+ return true;
+ }
for (auto& iter : other.results) {
auto name = iter.first;
if (results.find(name) == results.end()) {
@@ -231,6 +238,11 @@ struct ExecutionResults {
return instance.callFunction(func->name, arguments);
} catch (const TrapException&) {
return {};
+ } catch (const HostLimitException&) {
+ // This should be ignored and not compared with, as optimizations can
+ // change whether a host limit is reached.
+ ignore = true;
+ return {};
}
}
};