Commit f32e3024 authored by littledan's avatar littledan Committed by Commit bot

Detach ArrayBuffer in test262

New incoming test262 tests check what happens on detached ("neutered")
ArrayBuffers. This patch makes the test262 infrastructure define
detaching an ArrayBuffer in terms of %ArrayBufferNeuter, passing the
--allow-natives-syntax flag, when it is needed.

BUG=v8:4193
LOG=N
R=adamk,machenbach

Review URL: https://codereview.chromium.org/1897203003

Cr-Commit-Position: refs/heads/master@{#35676}
parent 5ce4a69a
// Copyright 2016 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.
function $DETACHBUFFER(buffer) {
%ArrayBufferNeuter(buffer);
}
......@@ -43,6 +43,7 @@ DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
ARCHIVE = DATA + ".tar"
TEST_262_HARNESS_FILES = ["sta.js", "assert.js"]
TEST_262_NATIVE_FILES = ["detachArrayBuffer.js"]
TEST_262_SUITE_PATH = ["data", "test"]
TEST_262_HARNESS_PATH = ["data", "harness"]
......@@ -131,7 +132,12 @@ class Test262TestSuite(testsuite.TestSuite):
self.GetIncludesForTest(testcase) + ["--harmony"] +
(["--module"] if "module" in self.GetTestRecord(testcase) else []) +
[os.path.join(self.testroot, testcase.path + ".js")] +
(["--throws"] if "negative" in self.GetTestRecord(testcase) else []))
(["--throws"] if "negative" in self.GetTestRecord(testcase)
else []) +
(["--allow-natives-syntax"]
if "detachArrayBuffer.js" in
self.GetTestRecord(testcase).get("includes", [])
else []))
def _VariantGeneratorFactory(self):
return Test262VariantGenerator
......@@ -159,11 +165,14 @@ class Test262TestSuite(testsuite.TestSuite):
testcase.path)
return testcase.test_record
def BasePath(self, filename):
return self.root if filename in TEST_262_NATIVE_FILES else self.harnesspath
def GetIncludesForTest(self, testcase):
test_record = self.GetTestRecord(testcase)
if "includes" in test_record:
includes = [os.path.join(self.harnesspath, f)
for f in test_record["includes"]]
return [os.path.join(self.BasePath(filename), filename)
for filename in test_record.get("includes", [])]
else:
includes = []
return includes
......
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