Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1937)

Side by Side Diff: test/simdjs/testcfg.py

Issue 1147743004: Adding ecmascript simd tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: drop extra code Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/simdjs/simdjs.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 the V8 project authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5
6 import hashlib
7 import os
8 import shutil
9 import sys
10 import tarfile
11 import imp
12
13 from testrunner.local import testsuite
14 from testrunner.local import utils
15 from testrunner.objects import testcase
16
17 SIMDJS_ARCHIVE_REVISION = "07e2713e0c9ea19feb0732d5bd84770c87310d79"
18 SIMDJS_ARCHIVE_MD5 = "cf6bddf99f18800b68e782054268ee3c"
19 SIMDJS_URL = (
20 "https://github.com/johnmccutchan/ecmascript_simd/archive/%s.tar.gz")
21
22 SIMDJS_SUITE_PATH = ["data", "src"]
23
24
25 class SimdJsTestSuite(testsuite.TestSuite):
26
27 def __init__(self, name, root):
28 super(SimdJsTestSuite, self).__init__(name, root)
29 self.testroot = os.path.join(self.root, *SIMDJS_SUITE_PATH)
30 self.ParseTestRecord = None
31
32 def ListTests(self, context):
33 tests = [
34 testcase.TestCase(self, 'shell_test_runner'),
35 ]
36 for filename in os.listdir(os.path.join(self.testroot, 'benchmarks')):
37 if (not filename.endswith('.js') or
38 filename in ['run.js', 'run_browser.js', 'base.js']):
39 continue
40 name = filename.rsplit('.')[0]
41 tests.append(
42 testcase.TestCase(self, 'benchmarks/' + name))
43 return tests
44
45 def GetFlagsForTestCase(self, testcase, context):
46 return (testcase.flags + context.mode_flags +
47 [os.path.join(self.root, "harness-adapt.js"),
48 "--harmony",
49 os.path.join(self.testroot, testcase.path + ".js"),
50 os.path.join(self.root, "harness-finish.js")])
51
52 def GetSourceForTest(self, testcase):
53 filename = os.path.join(self.testroot, testcase.path + ".js")
54 with open(filename) as f:
55 return f.read()
56
57 def IsNegativeTest(self, testcase):
58 return False
59
60 def IsFailureOutput(self, output, testpath):
61 if output.exit_code != 0:
62 return True
63 return "FAILED!" in output.stdout
64
65 def DownloadData(self):
66 revision = SIMDJS_ARCHIVE_REVISION
67 archive_url = SIMDJS_URL % revision
68 archive_name = os.path.join(
69 self.root, "ecmascript_simd-%s.tar.gz" % revision)
70 directory_name = os.path.join(self.root, "data")
71 directory_old_name = os.path.join(self.root, "data.old")
72 if not os.path.exists(archive_name):
73 print "Downloading test data from %s ..." % archive_url
74 utils.URLRetrieve(archive_url, archive_name)
75 if os.path.exists(directory_name):
76 if os.path.exists(directory_old_name):
77 shutil.rmtree(directory_old_name)
78 os.rename(directory_name, directory_old_name)
79 if not os.path.exists(directory_name):
80 print "Extracting ecmascript_simd-%s.tar.gz ..." % revision
81 md5 = hashlib.md5()
82 with open(archive_name, "rb") as f:
83 for chunk in iter(lambda: f.read(8192), ""):
84 md5.update(chunk)
85 print "MD5 hash is %s" % md5.hexdigest()
86 if md5.hexdigest() != SIMDJS_ARCHIVE_MD5:
87 os.remove(archive_name)
88 print "MD5 expected %s" % SIMDJS_ARCHIVE_MD5
89 raise Exception("MD5 hash mismatch of test data file")
90 archive = tarfile.open(archive_name, "r:gz")
91 if sys.platform in ("win32", "cygwin"):
92 # Magic incantation to allow longer path names on Windows.
93 archive.extractall(u"\\\\?\\%s" % self.root)
94 else:
95 archive.extractall(self.root)
96 os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision),
97 directory_name)
98
99
100 def GetSuite(name, root):
101 return SimdJsTestSuite(name, root)
OLDNEW
« no previous file with comments | « test/simdjs/simdjs.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698