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

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

Issue 478163002: test/test262: update testcfg.py for new test262 (Closed) Base URL: git@github.com:smikes/v8.git@master
Patch Set: Created 6 years, 4 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
« test/test262/harness-adapt.js ('K') | « test/test262/harness-adapt.js ('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 18 matching lines...) Expand all
29 import hashlib 29 import hashlib
30 import os 30 import os
31 import shutil 31 import shutil
32 import sys 32 import sys
33 import tarfile 33 import tarfile
34 34
35 from testrunner.local import testsuite 35 from testrunner.local import testsuite
36 from testrunner.local import utils 36 from testrunner.local import utils
37 from testrunner.objects import testcase 37 from testrunner.objects import testcase
38 38
39 TEST_262_ARCHIVE_REVISION = "595a36b" # This is the 2014-Aug-10 revision.
40 TEST_262_ARCHIVE_MD5 = "89dfc8458f474cdb7e8e178f3215dd06"
41 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s"
42 TEST_262_HARNESS = ["sta.js"]
39 43
40 TEST_262_ARCHIVE_REVISION = "fbba29f" # This is the r365 revision. 44 TEST_262_ROOT = ["data", "test"]
41 TEST_262_ARCHIVE_MD5 = "e1ff0db438cc12de8fb6da80621b4ef6" 45 TEST_262_SUITE_ROOT = TEST_262_ROOT + ["suite"]
42 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" 46 TEST_262_HARNESS_ROOT = TEST_262_ROOT + ["harness"]
43 TEST_262_HARNESS = ["sta.js", "testBuiltInObject.js", "testIntl.js"] 47 TEST_262_PYTHON_ROOT = ["data", "tools", "packaging"]
44 48
49 # import parseTestRecord
Jakob Kummerow 2014/08/18 11:55:47 Nit: comments should have proper capitalization an
smikes 2014/08/18 16:04:26 Removed needless comment.
50 sys.path.append(os.path.abspath(os.path.join('test', 'test262', *TEST_262_PYTHON _ROOT)))
Jakob Kummerow 2014/08/18 11:55:47 nit: 80col please. Also, if we need to muck with
smikes 2014/08/18 16:04:27 Fixed both. Is there a more idiomatic way of impo
Jakob Kummerow 2014/08/18 16:14:10 There is imp, https://docs.python.org/2/library/im
51 try:
52 from parseTestRecord import parseTestRecord
Jakob Kummerow 2014/08/18 11:55:47 nit: "... as ParseTestRecord" to adhere to Capital
smikes 2014/08/18 16:04:26 Done.
53 except ImportError:
54 print "Need to --download-data for test262"
45 55
46 class Test262TestSuite(testsuite.TestSuite): 56 class Test262TestSuite(testsuite.TestSuite):
47 57
48 def __init__(self, name, root): 58 def __init__(self, name, root):
49 super(Test262TestSuite, self).__init__(name, root) 59 super(Test262TestSuite, self).__init__(name, root)
50 self.testroot = os.path.join(root, "data", "test", "suite") 60 # set up paths
51 self.harness = [os.path.join(self.root, "data", "test", "harness", f) 61 self.testroot = os.path.join(self.root, *TEST_262_SUITE_ROOT)
52 for f in TEST_262_HARNESS] 62 self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_ROOT)
53 self.harness += [os.path.join(self.root, "harness-adapt.js")] 63
64 # basic test harness consists of TEST_262_HARNESS files
65 # and our harness adapter
66 self.harness = [os.path.join(self.harnesspath, f)
67 for f in TEST_262_HARNESS] + [
Jakob Kummerow 2014/08/18 11:55:47 Please move the last '[' to the next line for bett
smikes 2014/08/18 16:04:26 Done.
68 os.path.join(self.root, "harness-adapt.js")]
54 69
55 def CommonTestName(self, testcase): 70 def CommonTestName(self, testcase):
56 return testcase.path.split(os.path.sep)[-1] 71 return testcase.path.split(os.path.sep)[-1]
57 72
58 def ListTests(self, context): 73 def ListTests(self, context):
59 tests = [] 74 tests = []
60 for dirname, dirs, files in os.walk(self.testroot): 75 for dirname, dirs, files in os.walk(self.testroot):
61 for dotted in [x for x in dirs if x.startswith(".")]: 76 for dotted in [x for x in dirs if x.startswith(".")]:
62 dirs.remove(dotted) 77 dirs.remove(dotted)
63 if context.noi18n and "intl402" in dirs: 78 if context.noi18n and "intl402" in dirs:
64 dirs.remove("intl402") 79 dirs.remove("intl402")
65 dirs.sort() 80 dirs.sort()
66 files.sort() 81 files.sort()
67 for filename in files: 82 for filename in files:
68 if filename.endswith(".js"): 83 if filename.endswith(".js"):
69 testname = os.path.join(dirname[len(self.testroot) + 1:], 84 testname = os.path.join(dirname[len(self.testroot) + 1:],
70 filename[:-3]) 85 filename[:-3])
71 case = testcase.TestCase(self, testname) 86 case = testcase.TestCase(self, testname)
72 tests.append(case) 87 tests.append(case)
73 return tests 88 return tests
74 89
75 def GetFlagsForTestCase(self, testcase, context): 90 def GetFlagsForTestCase(self, testcase, context):
76 return (testcase.flags + context.mode_flags + self.harness + 91 return (testcase.flags + context.mode_flags + self.harness +
92 self.GetIncludesForTest(testcase) +
77 [os.path.join(self.testroot, testcase.path + ".js")]) 93 [os.path.join(self.testroot, testcase.path + ".js")])
78 94
95 def GetIncludesForTest(self, testcase):
96 try:
Jakob Kummerow 2014/08/18 11:55:47 The V8 project as a whole is not too fond of excep
smikes 2014/08/18 16:04:27 Done.
97 testRecord = parseTestRecord(self.GetSourceForTest(testcase), testcase.pat h)
Jakob Kummerow 2014/08/18 11:55:47 nit: 80col
98 return [os.path.join(self.harnesspath, f)
99 for f in testRecord['includes']]
100 except KeyError:
101 return []
102
79 def GetSourceForTest(self, testcase): 103 def GetSourceForTest(self, testcase):
80 filename = os.path.join(self.testroot, testcase.path + ".js") 104 try:
81 with open(filename) as f: 105 return testcase.source
Jakob Kummerow 2014/08/18 11:55:47 No need to cache this; the framework is careful no
smikes 2014/08/18 16:04:26 Yes, but I was calling GetSourceForTest repeatedly
82 return f.read() 106 except AttributeError:
107 filename = os.path.join(self.testroot, testcase.path + ".js")
108 with open(filename) as f:
109 testcase.source = f.read()
110 return testcase.source
83 111
84 def IsNegativeTest(self, testcase): 112 def IsNegativeTest(self, testcase):
85 return "@negative" in self.GetSourceForTest(testcase) 113 testRecord = parseTestRecord(self.GetSourceForTest(testcase), testcase.path)
Jakob Kummerow 2014/08/18 11:55:47 nit: s/testRecord/test_record/
smikes 2014/08/18 16:04:27 Done.
114 try:
Jakob Kummerow 2014/08/18 11:55:47 Again, I'd prefer 'if "negative" in test_record:'
smikes 2014/08/18 16:04:27 Done.
115 return testRecord['negative']
116 except KeyError:
117 return False
86 118
87 def IsFailureOutput(self, output, testpath): 119 def IsFailureOutput(self, output, testpath):
88 if output.exit_code != 0: 120 if output.exit_code != 0:
89 return True 121 return True
90 return "FAILED!" in output.stdout 122 return "FAILED!" in output.stdout
91 123
92 def DownloadData(self): 124 def DownloadData(self):
93 revision = TEST_262_ARCHIVE_REVISION 125 revision = TEST_262_ARCHIVE_REVISION
94 archive_url = TEST_262_URL % revision 126 archive_url = TEST_262_URL % revision
95 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision) 127 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision)
(...skipping 20 matching lines...) Expand all
116 # Magic incantation to allow longer path names on Windows. 148 # Magic incantation to allow longer path names on Windows.
117 archive.extractall(u"\\\\?\\%s" % self.root) 149 archive.extractall(u"\\\\?\\%s" % self.root)
118 else: 150 else:
119 archive.extractall(self.root) 151 archive.extractall(self.root)
120 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), 152 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision),
121 directory_name) 153 directory_name)
122 154
123 155
124 def GetSuite(name, root): 156 def GetSuite(name, root):
125 return Test262TestSuite(name, root) 157 return Test262TestSuite(name, root)
OLDNEW
« test/test262/harness-adapt.js ('K') | « test/test262/harness-adapt.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698