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

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

Issue 14348002: Remove SCons related files (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed os.path.join occurrences that depended on old imports Created 7 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 | Annotate | Revision Log
« no previous file with comments | « test/preparser/testcfg.py ('k') | tools/test.py » ('j') | 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 # Magic incantation to allow longer path names on Windows. 114 # Magic incantation to allow longer path names on Windows.
115 archive.extractall(u"\\\\?\\%s" % self.root) 115 archive.extractall(u"\\\\?\\%s" % self.root)
116 else: 116 else:
117 archive.extractall(self.root) 117 archive.extractall(self.root)
118 os.rename(os.path.join(self.root, "test262-%s" % revision), 118 os.rename(os.path.join(self.root, "test262-%s" % revision),
119 directory_name) 119 directory_name)
120 120
121 121
122 def GetSuite(name, root): 122 def GetSuite(name, root):
123 return Test262TestSuite(name, root) 123 return Test262TestSuite(name, root)
124
125
126 # Deprecated definitions below.
127 # TODO(jkummerow): Remove when SCons is no longer supported.
128
129
130 from os.path import exists
131 from os.path import join
132 import test
133
134
135 class Test262TestCase(test.TestCase):
136
137 def __init__(self, filename, path, context, root, mode, framework):
138 super(Test262TestCase, self).__init__(context, path, mode)
139 self.filename = filename
140 self.framework = framework
141 self.root = root
142
143 def IsNegative(self):
144 return '@negative' in self.GetSource()
145
146 def GetLabel(self):
147 return "%s test262 %s" % (self.mode, self.GetName())
148
149 def IsFailureOutput(self, output):
150 if output.exit_code != 0:
151 return True
152 return 'FAILED!' in output.stdout
153
154 def GetCommand(self):
155 result = self.context.GetVmCommand(self, self.mode)
156 result += [ '--es5_readonly' ] # Temporary hack until we can remove flag
157 result += self.framework
158 result.append(self.filename)
159 return result
160
161 def GetName(self):
162 return self.path[-1]
163
164 def GetSource(self):
165 return open(self.filename).read()
166
167
168 class Test262TestConfiguration(test.TestConfiguration):
169
170 def __init__(self, context, root):
171 super(Test262TestConfiguration, self).__init__(context, root)
172
173 def ListTests(self, current_path, path, mode, variant_flags):
174 testroot = join(self.root, 'data', 'test', 'suite')
175 harness = [join(self.root, 'data', 'test', 'harness', f)
176 for f in TEST_262_HARNESS]
177 harness += [join(self.root, 'harness-adapt.js')]
178 tests = []
179 for root, dirs, files in os.walk(testroot):
180 for dotted in [x for x in dirs if x.startswith('.')]:
181 dirs.remove(dotted)
182 for skipped in [x for x in dirs if x in TEST_262_SKIP]:
183 dirs.remove(skipped)
184 dirs.sort()
185 root_path = root[len(self.root):].split(os.path.sep)
186 root_path = current_path + [x for x in root_path if x]
187 files.sort()
188 for file in files:
189 if file.endswith('.js'):
190 test_path = ['test262', file[:-3]]
191 if self.Contains(path, test_path):
192 test = Test262TestCase(join(root, file), test_path, self.context,
193 self.root, mode, harness)
194 tests.append(test)
195 return tests
196
197 def DownloadData(self):
198 revision = TEST_262_ARCHIVE_REVISION
199 archive_url = TEST_262_URL % revision
200 archive_name = join(self.root, 'test262-%s.tar.bz2' % revision)
201 directory_name = join(self.root, 'data')
202 directory_old_name = join(self.root, 'data.old')
203 if not exists(archive_name):
204 print "Downloading test data from %s ..." % archive_url
205 urllib.urlretrieve(archive_url, archive_name)
206 if exists(directory_name):
207 os.rename(directory_name, directory_old_name)
208 if not exists(directory_name):
209 print "Extracting test262-%s.tar.bz2 ..." % revision
210 md5 = hashlib.md5()
211 with open(archive_name,'rb') as f:
212 for chunk in iter(lambda: f.read(8192), ''):
213 md5.update(chunk)
214 if md5.hexdigest() != TEST_262_ARCHIVE_MD5:
215 os.remove(archive_name)
216 raise Exception("Hash mismatch of test data file")
217 archive = tarfile.open(archive_name, 'r:bz2')
218 if sys.platform in ('win32', 'cygwin'):
219 # Magic incantation to allow longer path names on Windows.
220 archive.extractall(u'\\\\?\\%s' % self.root)
221 else:
222 archive.extractall(self.root)
223 os.rename(join(self.root, 'test262-%s' % revision), directory_name)
224
225 def GetBuildRequirements(self):
226 return ['d8']
227
228 def GetTestStatus(self, sections, defs):
229 status_file = join(self.root, 'test262.status')
230 if exists(status_file):
231 test.ReadConfigurationInto(status_file, sections, defs)
232
233
234 def GetConfiguration(context, root):
235 return Test262TestConfiguration(context, root)
OLDNEW
« no previous file with comments | « test/preparser/testcfg.py ('k') | tools/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698