summaryrefslogtreecommitdiff
path: root/test/unit/input/bysyncify.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-07-01 17:45:53 -0700
committerGitHub <noreply@github.com>2019-07-01 17:45:53 -0700
commitbe3135ca8db88ed7445dc2dd12ea78f55d963c7d (patch)
treeda93646517a457876c2803ae237d8c6906685a9b /test/unit/input/bysyncify.js
parentab34a779552ea4a8747e7729433d8c7f89c458c0 (diff)
downloadbinaryen-be3135ca8db88ed7445dc2dd12ea78f55d963c7d.tar.gz
binaryen-be3135ca8db88ed7445dc2dd12ea78f55d963c7d.tar.bz2
binaryen-be3135ca8db88ed7445dc2dd12ea78f55d963c7d.zip
Bysyncify: Fuzzing (#2192)
Gets fuzzing support for Bysyncify working. * Add the python to run the fuzzing on bysyncify. * Add a JS script to load and run a testcase with bysyncify support. The code has all the runtime support for sleep/resume etc., which it does on calls to imports at random in a deterministic manner. * Export memory from fuzzer so JS can access it. * Fix tiny builder bug with makeExport.
Diffstat (limited to 'test/unit/input/bysyncify.js')
-rw-r--r--test/unit/input/bysyncify.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/unit/input/bysyncify.js b/test/unit/input/bysyncify.js
index 4fd6f4b84..2e1bb4895 100644
--- a/test/unit/input/bysyncify.js
+++ b/test/unit/input/bysyncify.js
@@ -28,14 +28,14 @@ function sleepTests() {
// We are called in order to start a sleep/unwind.
console.log('sleep...');
sleeps++;
+ sleeping = true;
// Unwinding.
- exports.bysyncify_start_unwind(DATA_ADDR);
// Fill in the data structure. The first value has the stack location,
// which for simplicity we can start right after the data structure itself.
view[DATA_ADDR >> 2] = DATA_ADDR + 8;
// The end of the stack will not be reached here anyhow.
view[DATA_ADDR + 4 >> 2] = 1024;
- sleeping = true;
+ exports.bysyncify_start_unwind(DATA_ADDR);
} else {
// We are called as part of a resume/rewind. Stop sleeping.
console.log('resume...');
@@ -77,7 +77,7 @@ function sleepTests() {
if (expectedSleeps > 0) {
assert(!result, 'results during sleep are meaningless, just 0');
- exports.bysyncify_stop_unwind(DATA_ADDR);
+ exports.bysyncify_stop_unwind();
for (var i = 0; i < expectedSleeps - 1; i++) {
console.log('rewind, run until the next sleep');
@@ -85,7 +85,7 @@ function sleepTests() {
result = exports[name](); // no need for params on later times
assert(!result, 'results during sleep are meaningless, just 0');
logMemory();
- exports.bysyncify_stop_unwind(DATA_ADDR);
+ exports.bysyncify_stop_unwind();
}
console.log('rewind and run til the end.');