mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1645784 - Guard test cases properly for fuzzing. r=rhunt
A grab bag of missing test guards for fuzzing-safe runs: * The ARM test case should be guarded on the API used. * The import/export test case is specifically for non-fuzzing and so is guarded on a function that is absent in fuzzing-safe mode; we introduce a predicate to abstract this. * The uses of the non-fuzzing-safe streaming function can be adapted to test for this function first, so as to allow fuzz testing of streaming in general. Differential Revision: https://phabricator.services.mozilla.com/D79680
This commit is contained in:
parent
c4e97ddace
commit
36f6b5c9bc
@ -344,3 +344,7 @@ WasmHelpers.assertEqPreciseStacks = (observed, expectedStacks) => {
|
||||
Expected one of:
|
||||
${expectedStacks.map(stacks => stacks.join("/")).join('\n')}`);
|
||||
}
|
||||
|
||||
function fuzzingSafe() {
|
||||
return typeof getErrorNotes == 'undefined';
|
||||
}
|
||||
|
@ -3049,7 +3049,9 @@ drainJobQueue();
|
||||
|
||||
const bytecode = os.file.readFile(scriptdir + 'wasm_box2d.wasm', 'binary');
|
||||
|
||||
setBufferStreamParams(/* delayMillis = */ 1, /* chunkSize = */ 1000);
|
||||
if (typeof setBufferStreamParams == 'function') {
|
||||
setBufferStreamParams(/* delayMillis = */ 1, /* chunkSize = */ 1000);
|
||||
}
|
||||
const cacheEntry = streamCacheEntry(bytecode);
|
||||
|
||||
runBox2d(cacheEntry);
|
||||
|
@ -1,3 +1,5 @@
|
||||
// |jit-test| skip-if: fuzzingSafe()
|
||||
|
||||
// Tests that function imports and function exports descriptors have
|
||||
// signatures, in the test mode only, for fuzzers.
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// |jit-test| skip-if: !this.setARMHwCapFlags
|
||||
|
||||
setARMHwCapFlags('vfp');
|
||||
|
||||
if (typeof WebAssembly !== "undefined") {
|
||||
|
@ -68,22 +68,25 @@ text += ` (func (export "run") (result i32) call 100)\n`;
|
||||
text += `)`;
|
||||
var code = wasmTextToBinary(text);
|
||||
|
||||
assertEq(code.length > 1000, true);
|
||||
for ([delayMillis, chunkSize] of [[0, 10], [1, 10], [0, 100], [1, 100], [0, 1000], [1, 1000], [10, 1000]]) {
|
||||
setBufferStreamParams(delayMillis, chunkSize);
|
||||
testBoth(code, 'run', 5050);
|
||||
}
|
||||
// fuzzing-safe disables setBufferStreamParams
|
||||
if (typeof setBufferStreamParams == 'function') {
|
||||
assertEq(code.length > 1000, true);
|
||||
for ([delayMillis, chunkSize] of [[0, 10], [1, 10], [0, 100], [1, 100], [0, 1000], [1, 1000], [10, 1000]]) {
|
||||
setBufferStreamParams(delayMillis, chunkSize);
|
||||
testBoth(code, 'run', 5050);
|
||||
}
|
||||
|
||||
setBufferStreamParams(1, 100);
|
||||
var arr = [];
|
||||
for (var i = 0; i < 10; i++)
|
||||
arr.push(WebAssembly.instantiateStreaming(code));
|
||||
var results;
|
||||
Promise.all(arr).then(r => results = r);
|
||||
drainJobQueue();
|
||||
assertEq(results.length === 10, true);
|
||||
for (var i = 0; i < 10; i++)
|
||||
assertEq(results[i].instance.exports.run(), 5050);
|
||||
setBufferStreamParams(1, 100);
|
||||
var arr = [];
|
||||
for (var i = 0; i < 10; i++)
|
||||
arr.push(WebAssembly.instantiateStreaming(code));
|
||||
var results;
|
||||
Promise.all(arr).then(r => results = r);
|
||||
drainJobQueue();
|
||||
assertEq(results.length === 10, true);
|
||||
for (var i = 0; i < 10; i++)
|
||||
assertEq(results[i].instance.exports.run(), 5050);
|
||||
}
|
||||
|
||||
// No code section, but data section:
|
||||
var code = wasmTextToBinary('(module (memory (import "js" "mem") 1) (data (i32.const 0) "a"))');
|
||||
|
Loading…
Reference in New Issue
Block a user