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

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

Issue 1897203003: Detach ArrayBuffer in test262 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Refactoring Created 4 years, 8 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/detachArrayBuffer.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 25 matching lines...) Expand all
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 DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") 42 DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
43 ARCHIVE = DATA + ".tar" 43 ARCHIVE = DATA + ".tar"
44 44
45 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] 45 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"]
46 TEST_262_NATIVE_FILES = ["detachArrayBuffer.js"]
46 47
47 TEST_262_SUITE_PATH = ["data", "test"] 48 TEST_262_SUITE_PATH = ["data", "test"]
48 TEST_262_HARNESS_PATH = ["data", "harness"] 49 TEST_262_HARNESS_PATH = ["data", "harness"]
49 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] 50 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"]
50 51
51 ALL_VARIANT_FLAGS_STRICT = dict( 52 ALL_VARIANT_FLAGS_STRICT = dict(
52 (v, [flags + ["--use-strict"] for flags in flag_sets]) 53 (v, [flags + ["--use-strict"] for flags in flag_sets])
53 for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems() 54 for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems()
54 ) 55 )
55 56
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 testname = relpath.replace(os.path.sep, "/") 125 testname = relpath.replace(os.path.sep, "/")
125 case = testcase.TestCase(self, testname) 126 case = testcase.TestCase(self, testname)
126 tests.append(case) 127 tests.append(case)
127 return tests 128 return tests
128 129
129 def GetFlagsForTestCase(self, testcase, context): 130 def GetFlagsForTestCase(self, testcase, context):
130 return (testcase.flags + context.mode_flags + self.harness + 131 return (testcase.flags + context.mode_flags + self.harness +
131 self.GetIncludesForTest(testcase) + ["--harmony"] + 132 self.GetIncludesForTest(testcase) + ["--harmony"] +
132 (["--module"] if "module" in self.GetTestRecord(testcase) else []) + 133 (["--module"] if "module" in self.GetTestRecord(testcase) else []) +
133 [os.path.join(self.testroot, testcase.path + ".js")] + 134 [os.path.join(self.testroot, testcase.path + ".js")] +
134 (["--throws"] if "negative" in self.GetTestRecord(testcase) else []) ) 135 (["--throws"] if "negative" in self.GetTestRecord(testcase)
136 else []) +
137 (["--allow-natives-syntax"]
138 if "detachArrayBuffer.js" in
139 self.GetTestRecord(testcase).get("includes", [])
140 else []))
135 141
136 def _VariantGeneratorFactory(self): 142 def _VariantGeneratorFactory(self):
137 return Test262VariantGenerator 143 return Test262VariantGenerator
138 144
139 def LoadParseTestRecord(self): 145 def LoadParseTestRecord(self):
140 if not self.ParseTestRecord: 146 if not self.ParseTestRecord:
141 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) 147 root = os.path.join(self.root, *TEST_262_TOOLS_PATH)
142 f = None 148 f = None
143 try: 149 try:
144 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) 150 (f, pathname, description) = imp.find_module("parseTestRecord", [root])
145 module = imp.load_module("parseTestRecord", f, pathname, description) 151 module = imp.load_module("parseTestRecord", f, pathname, description)
146 self.ParseTestRecord = module.parseTestRecord 152 self.ParseTestRecord = module.parseTestRecord
147 except: 153 except:
148 raise ImportError("Cannot load parseTestRecord; you may need to " 154 raise ImportError("Cannot load parseTestRecord; you may need to "
149 "gclient sync for test262") 155 "gclient sync for test262")
150 finally: 156 finally:
151 if f: 157 if f:
152 f.close() 158 f.close()
153 return self.ParseTestRecord 159 return self.ParseTestRecord
154 160
155 def GetTestRecord(self, testcase): 161 def GetTestRecord(self, testcase):
156 if not hasattr(testcase, "test_record"): 162 if not hasattr(testcase, "test_record"):
157 ParseTestRecord = self.LoadParseTestRecord() 163 ParseTestRecord = self.LoadParseTestRecord()
158 testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase), 164 testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase),
159 testcase.path) 165 testcase.path)
160 return testcase.test_record 166 return testcase.test_record
161 167
168 def BasePath(self, filename):
169 return self.root if filename in TEST_262_NATIVE_FILES else self.harnesspath
170
162 def GetIncludesForTest(self, testcase): 171 def GetIncludesForTest(self, testcase):
163 test_record = self.GetTestRecord(testcase) 172 test_record = self.GetTestRecord(testcase)
164 if "includes" in test_record: 173 if "includes" in test_record:
165 includes = [os.path.join(self.harnesspath, f) 174 return [os.path.join(self.BasePath(filename), filename)
166 for f in test_record["includes"]] 175 for filename in test_record.get("includes", [])]
Michael Achenbach 2016/04/21 07:23:49 But you didn't fully add the other simplification
Dan Ehrenberg 2016/04/21 07:29:36 Oh, I misunderstood somehow. I'll do this in a fol
167 else: 176 else:
168 includes = [] 177 includes = []
169 return includes 178 return includes
170 179
171 def GetSourceForTest(self, testcase): 180 def GetSourceForTest(self, testcase):
172 filename = os.path.join(self.testroot, testcase.path + ".js") 181 filename = os.path.join(self.testroot, testcase.path + ".js")
173 with open(filename) as f: 182 with open(filename) as f:
174 return f.read() 183 return f.read()
175 184
176 def _ParseException(self, str): 185 def _ParseException(self, str):
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 # data folder. 224 # data folder.
216 if os.path.exists(ARCHIVE) and not os.path.exists(DATA): 225 if os.path.exists(ARCHIVE) and not os.path.exists(DATA):
217 print "Extracting archive..." 226 print "Extracting archive..."
218 tar = tarfile.open(ARCHIVE) 227 tar = tarfile.open(ARCHIVE)
219 tar.extractall(path=os.path.dirname(ARCHIVE)) 228 tar.extractall(path=os.path.dirname(ARCHIVE))
220 tar.close() 229 tar.close()
221 230
222 231
223 def GetSuite(name, root): 232 def GetSuite(name, root):
224 return Test262TestSuite(name, root) 233 return Test262TestSuite(name, root)
OLDNEW
« no previous file with comments | « test/test262/detachArrayBuffer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698