Commit 8235558b authored by binji's avatar binji Committed by Commit bot

[SAB] Test262 Agent harness

Review-Url: https://codereview.chromium.org/2658933004
Cr-Commit-Position: refs/heads/master@{#43357}
parent af76645b
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
$.agent = (function () {
var workers = [];
var i32a = null;
var pendingReports = [];
// Agents call Atomics.wait on this location to sleep.
var SLEEP_LOC = 0;
// 1 if the started worker is ready, 0 otherwise.
var START_LOC = 1;
// The number of workers that have received the broadcast.
var BROADCAST_LOC = 2;
// Each worker has a count of outstanding reports; worker N uses memory
// location [WORKER_REPORT_LOC + N].
var WORKER_REPORT_LOC = 3;
function workerScript(script) {
return `
var index;
var i32a = null;
var broadcasts = [];
var pendingReceiver = null;
function handleBroadcast() {
if (pendingReceiver && broadcasts.length > 0) {
pendingReceiver.apply(null, broadcasts.shift());
pendingReceiver = null;
}
};
var onmessage = function(msg) {
switch (msg.kind) {
case 'start':
i32a = msg.i32a;
index = msg.index;
(0, eval)(\`${script}\`);
break;
case 'broadcast':
Atomics.add(i32a, ${BROADCAST_LOC}, 1);
broadcasts.push([msg.sab, msg.id]);
handleBroadcast();
break;
}
};
var $ = {
agent: {
receiveBroadcast(receiver) {
pendingReceiver = receiver;
handleBroadcast();
},
report(msg) {
postMessage(msg);
Atomics.add(i32a, ${WORKER_REPORT_LOC} + index, 1);
},
sleep(s) { Atomics.wait(i32a, ${SLEEP_LOC}, 0, s); },
leaving() {}
}
};`;
}
var agent = {
start(script) {
if (i32a === null) {
i32a = new Int32Array(new SharedArrayBuffer(256));
}
var w = new Worker(workerScript(script));
w.index = workers.length;
w.postMessage({kind: 'start', i32a: i32a, index: w.index});
workers.push(w);
},
broadcast(sab, id) {
Atomics.store(i32a, BROADCAST_LOC, 0);
for (var w of workers) {
w.postMessage({kind: 'broadcast', sab: sab, id: id|0});
}
while (Atomics.load(i32a, BROADCAST_LOC) != workers.length) {}
},
getReport() {
for (var w of workers) {
while (Atomics.load(i32a, WORKER_REPORT_LOC + w.index) > 0) {
pendingReports.push(w.getMessage());
Atomics.sub(i32a, WORKER_REPORT_LOC + w.index, 1);
}
}
return pendingReports.shift() || null;
},
sleep(s) { Atomics.wait(i32a, SLEEP_LOC, 0, s); }
};
return agent;
})();
......@@ -7,6 +7,7 @@
'data.tar',
'detachArrayBuffer.js',
'harness-adapt.js',
'harness-agent.js',
'test262.status',
'testcfg.py',
],
......
......@@ -443,80 +443,88 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=5855
'language/expressions/async-generators/*': [SKIP],
# https://bugs.chromium.org/p/v8/issues/detail?id=4614
'built-ins/SharedArrayBuffer/*': [SKIP],
'built-ins/Atomics/*': [SKIP],
'built-ins/DataView/buffer-does-not-have-arraybuffer-data-throws-sab': [SKIP],
'built-ins/DataView/buffer-reference-sab': [SKIP],
'built-ins/DataView/byteoffset-is-negative-throws-sab': [SKIP],
'built-ins/DataView/custom-proto-access-throws-sab': [SKIP],
'built-ins/DataView/custom-proto-if-not-object-fallbacks-to-default-prototype-sab': [SKIP],
'built-ins/DataView/custom-proto-if-object-is-used-sab': [SKIP],
'built-ins/DataView/defined-bytelength-and-byteoffset-sab': [SKIP],
'built-ins/DataView/defined-byteoffset-sab': [SKIP],
'built-ins/DataView/defined-byteoffset-undefined-bytelength-sab': [SKIP],
'built-ins/DataView/excessive-bytelength-throws-sab': [SKIP],
'built-ins/DataView/excessive-byteoffset-throws-sab': [SKIP],
'built-ins/DataView/instance-extensibility-sab': [SKIP],
'built-ins/DataView/negative-bytelength-throws-sab': [SKIP],
'built-ins/DataView/negative-byteoffset-throws-sab': [SKIP],
'built-ins/DataView/newtarget-undefined-throws-sab': [SKIP],
'built-ins/DataView/proto-from-ctor-realm-sab': [SKIP],
'built-ins/DataView/prototype/buffer/return-buffer-sab': [SKIP],
'built-ins/DataView/prototype/buffer/this-has-no-dataview-internal-sab': [SKIP],
'built-ins/DataView/prototype/byteLength/return-bytelength-sab': [SKIP],
'built-ins/DataView/prototype/byteLength/this-has-no-dataview-internal-sab': [SKIP],
'built-ins/DataView/prototype/byteOffset/return-byteoffset-sab': [SKIP],
'built-ins/DataView/prototype/byteOffset/this-has-no-dataview-internal-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/index-is-out-of-range-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/negative-byteoffset-throws-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-symbol-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/return-value-clean-arraybuffer-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/return-values-custom-offset-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/return-values-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/this-has-no-dataview-internal-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/to-boolean-littleendian-sab': [SKIP],
'built-ins/DataView/prototype/getInt32/toindex-byteoffset-sab': [SKIP],
'built-ins/DataView/return-abrupt-tonumber-bytelength-sab': [SKIP],
'built-ins/DataView/return-abrupt-tonumber-bytelength-symbol-sab': [SKIP],
'built-ins/DataView/return-abrupt-tonumber-byteoffset-sab': [SKIP],
'built-ins/DataView/return-abrupt-tonumber-byteoffset-symbol-sab': [SKIP],
'built-ins/DataView/return-instance-sab': [SKIP],
'built-ins/DataView/toindex-bytelength-sab': [SKIP],
'built-ins/DataView/toindex-byteoffset-sab': [SKIP],
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab': [SKIP],
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab': [SKIP],
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab': [SKIP],
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-custom-proto-access-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-defined-length-and-offset-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-defined-length-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-defined-negative-length-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-defined-offset-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-excessive-length-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-excessive-offset-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-is-referenced-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-length-access-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-length-is-symbol-throws-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-new-instance-extensibility-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-returns-new-instance-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-toindex-bytelength-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-toindex-byteoffset-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object-sab': [SKIP],
'built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab': [SKIP],
'built-ins/TypedArrays/internals/Get/indexed-value-sab': [SKIP],
'built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer': [SKIP],
'built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer': [SKIP],
'built-ins/TypedArrays/buffer-arg-typedarray-backed-by-sharedarraybuffer': [SKIP],
# SharedArrayBuffer tests that require flags
'built-ins/SharedArrayBuffer/*': ['--harmony-sharedarraybuffer'],
'built-ins/Atomics/*': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/buffer-does-not-have-arraybuffer-data-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/buffer-reference-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/byteoffset-is-negative-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/custom-proto-access-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/custom-proto-if-not-object-fallbacks-to-default-prototype-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/custom-proto-if-object-is-used-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/defined-bytelength-and-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/defined-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/defined-byteoffset-undefined-bytelength-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/excessive-bytelength-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/excessive-byteoffset-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/instance-extensibility-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/negative-bytelength-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/negative-byteoffset-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/newtarget-undefined-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/proto-from-ctor-realm-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/buffer/return-buffer-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/buffer/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/byteLength/return-bytelength-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/byteLength/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/byteOffset/return-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/byteOffset/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/index-is-out-of-range-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/negative-byteoffset-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-symbol-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/return-value-clean-arraybuffer-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/return-values-custom-offset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/return-values-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/to-boolean-littleendian-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/prototype/getInt32/toindex-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/return-abrupt-tonumber-bytelength-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/return-abrupt-tonumber-bytelength-symbol-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/return-abrupt-tonumber-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/return-abrupt-tonumber-byteoffset-symbol-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/return-instance-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/toindex-bytelength-sab': ['--harmony-sharedarraybuffer'],
'built-ins/DataView/toindex-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-custom-proto-access-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-defined-length-and-offset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-defined-length-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-defined-negative-length-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-defined-offset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-excessive-length-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-excessive-offset-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-is-referenced-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-length-access-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-length-is-symbol-throws-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-new-instance-extensibility-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-returns-new-instance-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-toindex-bytelength-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-toindex-byteoffset-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/internals/Get/indexed-value-sab': ['--harmony-sharedarraybuffer'],
'built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer': ['--harmony-sharedarraybuffer'],
'built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer': ['--harmony-sharedarraybuffer'],
'built-ins/TypedArrays/buffer-arg-typedarray-backed-by-sharedarraybuffer': ['--harmony-sharedarraybuffer'],
# https://bugs.chromium.org/p/v8/issues/detail?id=5983
'built-ins/SharedArrayBuffer/newtarget-prototype-is-not-object': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=5984
'built-ins/SharedArrayBuffer/proto-from-ctor-realm': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=5982
'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab': ['--harmony-sharedarraybuffer', FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=5897
'built-ins/SharedArrayBuffer/prototype/slice/*': [SKIP],
......@@ -688,6 +696,8 @@
# The failed allocation causes an asan/msan/tsan error
'built-ins/ArrayBuffer/allocation-limit': [SKIP],
'built-ins/ArrayBuffer/length-is-too-large-throws': [SKIP],
'built-ins/SharedArrayBuffer/allocation-limit': [SKIP],
'built-ins/SharedArrayBuffer/length-is-too-large-throws': [SKIP],
}], # asan == True or msan == True or tsan == True
['variant == asm_wasm', {
......
......@@ -142,6 +142,8 @@ class Test262TestSuite(testsuite.TestSuite):
def GetFlagsForTestCase(self, testcase, context):
return (testcase.flags + context.mode_flags + self.harness +
([os.path.join(self.root, "harness-agent.js")]
if testcase.path.startswith('built-ins/Atomics') else []) +
self.GetIncludesForTest(testcase) +
(["--module"] if "module" in self.GetTestRecord(testcase) else []) +
[self.GetPathForTest(testcase)] +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment