Commit ccd15eaf authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Prepare test262 sources during init.

Bug: v8:6917
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: Iad6b429cfd855c435528468396c880f7733776d9
Reviewed-on: https://chromium-review.googlesource.com/819551
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50024}
parent 8f357557
......@@ -131,6 +131,37 @@ class Test262TestSuite(testsuite.TestSuite):
self.harness += [os.path.join(self.root, "harness-adapt.js")]
self.localtestroot = os.path.join(self.root, *TEST_262_LOCAL_TESTS_PATH)
self.ParseTestRecord = None
self._extract_sources()
self._parse_test_record = self._load_parse_test_record()
def _extract_sources(self):
# The archive is created only on swarming. Local checkouts have the
# data folder.
if (os.path.exists(ARCHIVE) and
# Check for a JS file from the archive if we need to unpack. Some other
# files from the archive unfortunately exist due to a bug in the
# isolate_processor.
# TODO(machenbach): Migrate this to GN to avoid using the faulty
# isolate_processor: http://crbug.com/669910
not os.path.exists(os.path.join(DATA, 'test', 'harness', 'error.js'))):
print "Extracting archive..."
tar = tarfile.open(ARCHIVE)
tar.extractall(path=os.path.dirname(ARCHIVE))
tar.close()
def _load_parse_test_record(self):
root = os.path.join(self.root, *TEST_262_TOOLS_PATH)
f = None
try:
(f, pathname, description) = imp.find_module("parseTestRecord", [root])
module = imp.load_module("parseTestRecord", f, pathname, description)
return module.parseTestRecord
except:
raise ImportError("Cannot load parseTestRecord; you may need to "
"gclient sync for test262")
finally:
if f:
f.close()
def ListTests(self, context):
testnames = set()
......@@ -180,27 +211,10 @@ class Test262TestSuite(testsuite.TestSuite):
def _VariantGeneratorFactory(self):
return Test262VariantGenerator
def LoadParseTestRecord(self):
if not self.ParseTestRecord:
root = os.path.join(self.root, *TEST_262_TOOLS_PATH)
f = None
try:
(f, pathname, description) = imp.find_module("parseTestRecord", [root])
module = imp.load_module("parseTestRecord", f, pathname, description)
self.ParseTestRecord = module.parseTestRecord
except:
raise ImportError("Cannot load parseTestRecord; you may need to "
"gclient sync for test262")
finally:
if f:
f.close()
return self.ParseTestRecord
def GetTestRecord(self, testcase):
if not hasattr(testcase, "test_record"):
ParseTestRecord = self.LoadParseTestRecord()
testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase),
testcase.path)
testcase.test_record = self._parse_test_record(
self.GetSourceForTest(testcase), testcase.path)
return testcase.test_record
def BasePath(self, filename):
......@@ -251,21 +265,6 @@ class Test262TestSuite(testsuite.TestSuite):
return [statusfile.FAIL]
return super(Test262TestSuite, self).GetExpectedOutcomes(testcase)
def PrepareSources(self):
# The archive is created only on swarming. Local checkouts have the
# data folder.
if (os.path.exists(ARCHIVE) and
# Check for a JS file from the archive if we need to unpack. Some other
# files from the archive unfortunately exist due to a bug in the
# isolate_processor.
# TODO(machenbach): Migrate this to GN to avoid using the faulty
# isolate_processor: http://crbug.com/669910
not os.path.exists(os.path.join(DATA, 'test', 'harness', 'error.js'))):
print "Extracting archive..."
tar = tarfile.open(ARCHIVE)
tar.extractall(path=os.path.dirname(ARCHIVE))
tar.close()
def GetSuite(name, root):
return Test262TestSuite(name, root)
......@@ -69,7 +69,7 @@ class VariantGenerator(object):
class TestSuite(object):
@staticmethod
def LoadTestSuite(root, global_init=True):
def LoadTestSuite(root):
name = root.split(os.path.sep)[-1]
f = None
try:
......@@ -121,14 +121,6 @@ class TestSuite(object):
"""
return self._VariantGeneratorFactory()(self, set(variants))
def PrepareSources(self):
"""Called once before multiprocessing for doing file-system operations.
This should not access the network. For network access use the method
below.
"""
pass
def ReadStatusFile(self, variables):
with open(self.status_file()) as f:
self.rules, self.prefix_rules = (
......
......@@ -123,9 +123,6 @@ class StandardTestRunner(base_runner.BaseTestRunner):
if suite:
suites.append(suite)
for s in suites:
s.PrepareSources()
try:
return self._execute(args, options, suites)
except KeyboardInterrupt:
......
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