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

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

Issue 1396803002: [test] Pull test262 as a dependency. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 5 years, 2 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/test262/README ('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
1 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 21 matching lines...) Expand all
32 import shutil 32 import shutil
33 import sys 33 import sys
34 import tarfile 34 import tarfile
35 35
36 36
37 from testrunner.local import statusfile 37 from testrunner.local import statusfile
38 from testrunner.local import testsuite 38 from testrunner.local import testsuite
39 from testrunner.local import utils 39 from testrunner.local import utils
40 from testrunner.objects import testcase 40 from testrunner.objects import testcase
41 41
42 # The revision hash needs to be 7 characters?
43 TEST_262_ARCHIVE_REVISION = "26e6fd7" # This is the 2015-10-1 revision.
44 TEST_262_ARCHIVE_MD5 = "36fdd27f026f396234132fb5afdcfffb"
45 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s"
46 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] 42 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"]
47 43
48 TEST_262_SUITE_PATH = ["data", "test"] 44 TEST_262_SUITE_PATH = ["data", "test"]
49 TEST_262_HARNESS_PATH = ["data", "harness"] 45 TEST_262_HARNESS_PATH = ["data", "harness"]
50 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] 46 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"]
51 47
52 ALL_VARIANT_FLAGS_STRICT = dict( 48 ALL_VARIANT_FLAGS_STRICT = dict(
53 (v, [flags + ["--use-strict"] for flags in flag_sets]) 49 (v, [flags + ["--use-strict"] for flags in flag_sets])
54 for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems() 50 for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems()
55 ) 51 )
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return "FAILED!" in output.stdout 185 return "FAILED!" in output.stdout
190 186
191 def HasUnexpectedOutput(self, testcase): 187 def HasUnexpectedOutput(self, testcase):
192 outcome = self.GetOutcome(testcase) 188 outcome = self.GetOutcome(testcase)
193 if (statusfile.FAIL_SLOPPY in testcase.outcomes and 189 if (statusfile.FAIL_SLOPPY in testcase.outcomes and
194 "--use-strict" not in testcase.flags): 190 "--use-strict" not in testcase.flags):
195 return outcome != statusfile.FAIL 191 return outcome != statusfile.FAIL
196 return not outcome in (testcase.outcomes or [statusfile.PASS]) 192 return not outcome in (testcase.outcomes or [statusfile.PASS])
197 193
198 def DownloadData(self): 194 def DownloadData(self):
199 revision = TEST_262_ARCHIVE_REVISION 195 print "Test262 download is deprecated. It's part of DEPS."
200 archive_url = TEST_262_URL % revision 196
201 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision) 197 # Clean up old directories and archive files.
202 directory_name = os.path.join(self.root, "data")
203 directory_old_name = os.path.join(self.root, "data.old") 198 directory_old_name = os.path.join(self.root, "data.old")
199 if os.path.exists(directory_old_name):
200 shutil.rmtree(directory_old_name)
204 201
205 # Clobber if the test is in an outdated state, i.e. if there are any other
206 # archive files present.
207 archive_files = [f for f in os.listdir(self.root) 202 archive_files = [f for f in os.listdir(self.root)
208 if f.startswith("tc39-test262-")] 203 if f.startswith("tc39-test262-")]
209 if (len(archive_files) > 1 or 204 if len(archive_files) > 0:
210 os.path.basename(archive_name) not in archive_files):
211 print "Clobber outdated test archives ..." 205 print "Clobber outdated test archives ..."
212 for f in archive_files: 206 for f in archive_files:
213 os.remove(os.path.join(self.root, f)) 207 os.remove(os.path.join(self.root, f))
214 208
215 if not os.path.exists(archive_name):
216 print "Downloading test data from %s ..." % archive_url
217 utils.URLRetrieve(archive_url, archive_name)
218 if os.path.exists(directory_name):
219 if os.path.exists(directory_old_name):
220 shutil.rmtree(directory_old_name)
221 os.rename(directory_name, directory_old_name)
222 if not os.path.exists(directory_name):
223 print "Extracting test262-%s.tar.gz ..." % revision
224 md5 = hashlib.md5()
225 with open(archive_name, "rb") as f:
226 for chunk in iter(lambda: f.read(8192), ""):
227 md5.update(chunk)
228 print "MD5 hash is %s" % md5.hexdigest()
229 if md5.hexdigest() != TEST_262_ARCHIVE_MD5:
230 os.remove(archive_name)
231 print "MD5 expected %s" % TEST_262_ARCHIVE_MD5
232 raise Exception("MD5 hash mismatch of test data file")
233 archive = tarfile.open(archive_name, "r:gz")
234 if sys.platform in ("win32", "cygwin"):
235 # Magic incantation to allow longer path names on Windows.
236 archive.extractall(u"\\\\?\\%s" % self.root)
237 else:
238 archive.extractall(self.root)
239 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision),
240 directory_name)
241
242 209
243 def GetSuite(name, root): 210 def GetSuite(name, root):
244 return Test262TestSuite(name, root) 211 return Test262TestSuite(name, root)
OLDNEW
« no previous file with comments | « test/test262/README ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698