OLD | NEW |
---|---|
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...) Loading... | |
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 67 matching lines...) Loading... | |
123 relpath = fullpath[len(self.testroot) + 1 : -3] | 124 relpath = fullpath[len(self.testroot) + 1 : -3] |
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 [os.path.join(self.testroot, testcase.path + ".js")] + | 133 [os.path.join(self.testroot, testcase.path + ".js")] + |
133 (["--throws"] if "negative" in self.GetTestRecord(testcase) else []) ) | 134 (["--throws"] if "negative" in self.GetTestRecord(testcase) |
135 else []) + | |
136 (["--allow-natives-syntax"] | |
137 if "detachArrayBuffer.js" in | |
Michael Achenbach
2016/04/20 07:53:45
Just a question to understand how this is all patc
Dan Ehrenberg
2016/04/20 19:19:03
Yes, test262 upstream adds new tests which include
| |
138 self.GetTestRecord(testcase).get("includes", []) | |
139 else [])) | |
134 | 140 |
135 def _VariantGeneratorFactory(self): | 141 def _VariantGeneratorFactory(self): |
136 return Test262VariantGenerator | 142 return Test262VariantGenerator |
137 | 143 |
138 def LoadParseTestRecord(self): | 144 def LoadParseTestRecord(self): |
139 if not self.ParseTestRecord: | 145 if not self.ParseTestRecord: |
140 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) | 146 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) |
141 f = None | 147 f = None |
142 try: | 148 try: |
143 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) | 149 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) |
(...skipping 10 matching lines...) Loading... | |
154 def GetTestRecord(self, testcase): | 160 def GetTestRecord(self, testcase): |
155 if not hasattr(testcase, "test_record"): | 161 if not hasattr(testcase, "test_record"): |
156 ParseTestRecord = self.LoadParseTestRecord() | 162 ParseTestRecord = self.LoadParseTestRecord() |
157 testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase), | 163 testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase), |
158 testcase.path) | 164 testcase.path) |
159 return testcase.test_record | 165 return testcase.test_record |
160 | 166 |
161 def GetIncludesForTest(self, testcase): | 167 def GetIncludesForTest(self, testcase): |
162 test_record = self.GetTestRecord(testcase) | 168 test_record = self.GetTestRecord(testcase) |
163 if "includes" in test_record: | 169 if "includes" in test_record: |
164 includes = [os.path.join(self.harnesspath, f) | 170 includes = [os.path.join(self.root |
Michael Achenbach
2016/04/20 07:53:45
nit: maybe less nesting and a local var for readab
Dan Ehrenberg
2016/04/20 19:19:03
Factored out a separate BasePath method for this p
| |
171 if f in TEST_262_NATIVE_FILES | |
172 else self.harnesspath, | |
173 f) | |
165 for f in test_record["includes"]] | 174 for f in test_record["includes"]] |
166 else: | 175 else: |
167 includes = [] | 176 includes = [] |
168 return includes | 177 return includes |
169 | 178 |
170 def GetSourceForTest(self, testcase): | 179 def GetSourceForTest(self, testcase): |
171 filename = os.path.join(self.testroot, testcase.path + ".js") | 180 filename = os.path.join(self.testroot, testcase.path + ".js") |
172 with open(filename) as f: | 181 with open(filename) as f: |
173 return f.read() | 182 return f.read() |
174 | 183 |
(...skipping 39 matching lines...) Loading... | |
214 # data folder. | 223 # data folder. |
215 if os.path.exists(ARCHIVE) and not os.path.exists(DATA): | 224 if os.path.exists(ARCHIVE) and not os.path.exists(DATA): |
216 print "Extracting archive..." | 225 print "Extracting archive..." |
217 tar = tarfile.open(ARCHIVE) | 226 tar = tarfile.open(ARCHIVE) |
218 tar.extractall(path=os.path.dirname(ARCHIVE)) | 227 tar.extractall(path=os.path.dirname(ARCHIVE)) |
219 tar.close() | 228 tar.close() |
220 | 229 |
221 | 230 |
222 def GetSuite(name, root): | 231 def GetSuite(name, root): |
223 return Test262TestSuite(name, root) | 232 return Test262TestSuite(name, root) |
OLD | NEW |