diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/emit-js-wrapper=a.js.wast.js | 53 | ||||
-rw-r--r-- | test/passes/fuzz-exec.txt | 13 | ||||
-rw-r--r-- | test/passes/fuzz-exec_O.txt | 15 | ||||
-rw-r--r-- | test/passes/ssa_fuzz-exec.txt | 5 | ||||
-rw-r--r-- | test/reduce/imports.wast.txt | 7 |
5 files changed, 55 insertions, 38 deletions
diff --git a/test/passes/emit-js-wrapper=a.js.wast.js b/test/passes/emit-js-wrapper=a.js.wast.js index f2e828c2b..9e8578781 100644 --- a/test/passes/emit-js-wrapper=a.js.wast.js +++ b/test/passes/emit-js-wrapper=a.js.wast.js @@ -20,12 +20,26 @@ if (typeof process === 'object' && typeof require === 'function' /* node.js dete binary = read(args[0], 'binary'); } } +function literal(x, type) { + var ret = type + '.const '; + switch (type) { + case 'i32': ret += (x | 0); break; + case 'f32': + case 'f64': { + if (x == 0 && (1 / x) < 0) ret += '-'; + ret += x; + break; + } + default: throw 'what?'; + } + return ret; +} var instance = new WebAssembly.Instance(new WebAssembly.Module(binary), { 'fuzzing-support': { - 'log-i32': function(x) { console.log('i32: ' + x) }, - 'log-i64': function(x, y) { console.log('i64: ' + x + ', ' + y) }, - 'log-f32': function(x) { console.log('f32: ' + x) }, - 'log-f64': function(x) { console.log('f64: ' + x) } + 'log-i32': function(x) { console.log('[LoggingExternalInterface logging ' + literal(x, 'i32') + ']') }, + 'log-i64': function(x, y) { console.log('[LoggingExternalInterface logging ' + literal(x, 'i32') + ' ' + literal(y, 'i32') + ']') }, + 'log-f32': function(x) { console.log('[LoggingExternalInterface logging ' + literal(x, 'f64') + ']') }, + 'log-f64': function(x) { console.log('[LoggingExternalInterface logging ' + literal(x, 'f64') + ']') }, }, 'env': { 'setTempRet0': function(x) { tempRet0 = x }, @@ -34,37 +48,36 @@ var instance = new WebAssembly.Instance(new WebAssembly.Module(binary), { }); if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer(); try { - console.log('calling: add'); - console.log(' result: ' + instance.exports.add(0, 0)); + console.log('[fuzz-exec] calling $add'); + console.log('[fuzz-exec] note result: $add => ' + literal(instance.exports.add(0, 0), 'i32')); } catch (e) { - console.log(' exception: ' + e); + console.log('exception: ' + e); } if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer(); try { - console.log('calling: no_return'); -instance.exports.no_return(0); + console.log('[fuzz-exec] calling $no_return'); + instance.exports.no_return(0); } catch (e) { - console.log(' exception: ' + e); + console.log('exception: ' + e); } if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer(); try { - console.log('calling: types'); -instance.exports.types(0, 0, 0, 0, 0); + console.log('[fuzz-exec] calling $types'); + instance.exports.types(0, 0, 0, 0, 0); } catch (e) { - console.log(' exception: ' + e); + console.log('exception: ' + e); } if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer(); try { - console.log('calling: types2'); -instance.exports.types2(0, 0, 0); + console.log('[fuzz-exec] calling $types2'); + instance.exports.types2(0, 0, 0); } catch (e) { - console.log(' exception: ' + e); + console.log('exception: ' + e); } if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer(); try { - console.log('calling: types3'); - console.log(' result: ' + instance.exports.types3(0, 0, 0)); + console.log('[fuzz-exec] calling $types3'); + console.log('[fuzz-exec] note result: $types3 => ' + literal(instance.exports.types3(0, 0, 0), 'i32')); } catch (e) { - console.log(' exception: ' + e); + console.log('exception: ' + e); } -console.log('done.') diff --git a/test/passes/fuzz-exec.txt b/test/passes/fuzz-exec.txt index 0c1186bc7..409f93181 100644 --- a/test/passes/fuzz-exec.txt +++ b/test/passes/fuzz-exec.txt @@ -1,9 +1,13 @@ +[fuzz-exec] calling $a [fuzz-exec] note result: $a => i32.const -69 +[fuzz-exec] calling $b [fuzz-exec] note result: $b => i32.const -31768 +[fuzz-exec] calling $c [fuzz-exec] note result: $c => i64.const -69 +[fuzz-exec] calling $d [fuzz-exec] note result: $d => i64.const -31768 +[fuzz-exec] calling $e [fuzz-exec] note result: $e => i64.const -2146649112 -[fuzz-exec] 5 results noted (module (type $0 (func (result i32))) (type $1 (func (result i64))) @@ -38,15 +42,18 @@ ) ) ) +[fuzz-exec] calling $a [fuzz-exec] note result: $a => i32.const -69 +[fuzz-exec] calling $b [fuzz-exec] note result: $b => i32.const -31768 +[fuzz-exec] calling $c [fuzz-exec] note result: $c => i64.const -69 +[fuzz-exec] calling $d [fuzz-exec] note result: $d => i64.const -31768 +[fuzz-exec] calling $e [fuzz-exec] note result: $e => i64.const -2146649112 -[fuzz-exec] 5 results noted [fuzz-exec] comparing $a [fuzz-exec] comparing $b [fuzz-exec] comparing $c [fuzz-exec] comparing $d [fuzz-exec] comparing $e -[fuzz-exec] 5 results match diff --git a/test/passes/fuzz-exec_O.txt b/test/passes/fuzz-exec_O.txt index 76141fcc5..6f6e50674 100644 --- a/test/passes/fuzz-exec_O.txt +++ b/test/passes/fuzz-exec_O.txt @@ -1,6 +1,7 @@ -[fuzz-exec] note result: $func_0 => none.const ? -[fuzz-exec] note result: $func_1 => none.const ? -[fuzz-exec] 2 results noted +[fuzz-exec] calling $func_0 +[trap final > memory: 18446744073709551615 > 65514] +[fuzz-exec] calling $func_1 +[trap final > memory: 18446744073709551615 > 65514] (module (type $0 (func (result i64))) (type $1 (func (result i32))) @@ -23,9 +24,9 @@ ) ) ) -[fuzz-exec] note result: $func_0 => none.const ? -[fuzz-exec] note result: $func_1 => none.const ? -[fuzz-exec] 2 results noted +[fuzz-exec] calling $func_0 +[trap final > memory: 18446744073709551615 > 65514] +[fuzz-exec] calling $func_1 +[trap final > memory: 18446744073709551615 > 65514] [fuzz-exec] comparing $func_0 [fuzz-exec] comparing $func_1 -[fuzz-exec] 2 results match diff --git a/test/passes/ssa_fuzz-exec.txt b/test/passes/ssa_fuzz-exec.txt index ca7d6af2d..b15ae5775 100644 --- a/test/passes/ssa_fuzz-exec.txt +++ b/test/passes/ssa_fuzz-exec.txt @@ -1,5 +1,5 @@ +[fuzz-exec] calling $func_0 [fuzz-exec] note result: $func_0 => i32.const 16384 -[fuzz-exec] 1 results noted (module (type $0 (func (result i32))) (type $1 (func)) @@ -127,7 +127,6 @@ ) ) ) +[fuzz-exec] calling $func_0 [fuzz-exec] note result: $func_0 => i32.const 16384 -[fuzz-exec] 1 results noted [fuzz-exec] comparing $func_0 -[fuzz-exec] 1 results match diff --git a/test/reduce/imports.wast.txt b/test/reduce/imports.wast.txt index 6807ffd26..adfd5ff04 100644 --- a/test/reduce/imports.wast.txt +++ b/test/reduce/imports.wast.txt @@ -1,10 +1,7 @@ (module - (type $0 (func)) - (type $1 (func (result i32))) - (import "env" "func" (func $fimport$0)) + (type $0 (func (result i32))) (export "x" (func $0)) - (func $0 (; 1 ;) (type $1) (result i32) - (call $fimport$0) + (func $0 (; 0 ;) (type $0) (result i32) (i32.const 5678) ) ) |