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

Side by Side Diff: test/mjsunit/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/message/testcfg.py ('k') | test/mozilla/testcfg.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 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 def ListTests(self, context): 44 def ListTests(self, context):
45 tests = [] 45 tests = []
46 for dirname, dirs, files in os.walk(self.root): 46 for dirname, dirs, files in os.walk(self.root):
47 for dotted in [x for x in dirs if x.startswith('.')]: 47 for dotted in [x for x in dirs if x.startswith('.')]:
48 dirs.remove(dotted) 48 dirs.remove(dotted)
49 dirs.sort() 49 dirs.sort()
50 files.sort() 50 files.sort()
51 for filename in files: 51 for filename in files:
52 if filename.endswith(".js") and filename != "mjsunit.js": 52 if filename.endswith(".js") and filename != "mjsunit.js":
53 testname = join(dirname[len(self.root) + 1:], filename[:-3]) 53 testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
54 test = testcase.TestCase(self, testname) 54 test = testcase.TestCase(self, testname)
55 tests.append(test) 55 tests.append(test)
56 return tests 56 return tests
57 57
58 def GetFlagsForTestCase(self, testcase, context): 58 def GetFlagsForTestCase(self, testcase, context):
59 source = self.GetSourceForTest(testcase) 59 source = self.GetSourceForTest(testcase)
60 flags = [] + context.mode_flags 60 flags = [] + context.mode_flags
61 flags_match = re.findall(FLAGS_PATTERN, source) 61 flags_match = re.findall(FLAGS_PATTERN, source)
62 for match in flags_match: 62 for match in flags_match:
63 flags += match.strip().split() 63 flags += match.strip().split()
(...skipping 24 matching lines...) Expand all
88 return testcase.flags + flags 88 return testcase.flags + flags
89 89
90 def GetSourceForTest(self, testcase): 90 def GetSourceForTest(self, testcase):
91 filename = os.path.join(self.root, testcase.path + self.suffix()) 91 filename = os.path.join(self.root, testcase.path + self.suffix())
92 with open(filename) as f: 92 with open(filename) as f:
93 return f.read() 93 return f.read()
94 94
95 95
96 def GetSuite(name, root): 96 def GetSuite(name, root):
97 return MjsunitTestSuite(name, root) 97 return MjsunitTestSuite(name, root)
98
99
100 # Deprecated definitions below.
101 # TODO(jkummerow): Remove when SCons is no longer supported.
102
103
104 from os.path import dirname, exists, join, normpath
105 import tempfile
106 import test
107
108
109 class MjsunitTestCase(test.TestCase):
110
111 def __init__(self, path, file, mode, context, config, isolates):
112 super(MjsunitTestCase, self).__init__(context, path, mode)
113 self.file = file
114 self.config = config
115 self.self_script = False
116 self.isolates = isolates
117
118 def GetLabel(self):
119 return "%s %s" % (self.mode, self.GetName())
120
121 def GetName(self):
122 return self.path[-1] + ["", "-isolates"][self.isolates]
123
124 def TestsIsolates(self):
125 return self.isolates
126
127 def GetVmCommand(self, source):
128 result = self.config.context.GetVmCommand(self, self.mode)
129 flags_match = re.findall(FLAGS_PATTERN, source);
130 for match in flags_match:
131 result += match.strip().split()
132 return result
133
134 def GetVmArguments(self, source):
135 result = []
136 additional_files = []
137 files_match = FILES_PATTERN.search(source);
138 # Accept several lines of 'Files:'
139 while True:
140 if files_match:
141 additional_files += files_match.group(1).strip().split()
142 files_match = FILES_PATTERN.search(source, files_match.end())
143 else:
144 break
145 for a_file in additional_files:
146 result.append(join(dirname(self.config.root), '..', a_file))
147 framework = join(dirname(self.config.root), 'mjsunit', 'mjsunit.js')
148 if SELF_SCRIPT_PATTERN.search(source):
149 result.append(self.CreateSelfScript())
150 result += [framework, self.file]
151 return result
152
153 def GetCommand(self):
154 source = open(self.file).read()
155 result = self.GetVmCommand(source)
156 result += self.GetVmArguments(source)
157 if self.isolates:
158 result.append("--isolate")
159 result += self.GetVmArguments(source)
160 return result
161
162 def GetSource(self):
163 return open(self.file).read()
164
165 def CreateSelfScript(self):
166 (fd_self_script, self_script) = tempfile.mkstemp(suffix=".js")
167 def MakeJsConst(name, value):
168 return "var %(name)s=\'%(value)s\';\n" % \
169 {'name': name, \
170 'value': value.replace('\\', '\\\\').replace('\'', '\\\'') }
171 try:
172 os.write(fd_self_script, MakeJsConst('TEST_FILE_NAME', self.file))
173 except IOError, e:
174 test.PrintError("write() " + str(e))
175 os.close(fd_self_script)
176 self.self_script = self_script
177 return self_script
178
179 def AfterRun(self, result):
180 if self.self_script and (not result or (not result.HasPreciousOutput())):
181 test.CheckedUnlink(self.self_script)
182
183 class MjsunitTestConfiguration(test.TestConfiguration):
184
185 def __init__(self, context, root):
186 super(MjsunitTestConfiguration, self).__init__(context, root)
187
188 def Ls(self, path):
189 def SelectTest(name):
190 return name.endswith('.js') and name != 'mjsunit.js'
191 return [f[:-3] for f in os.listdir(path) if SelectTest(f)]
192
193 def ListTests(self, current_path, path, mode, variant_flags):
194 mjsunit = [current_path + [t] for t in self.Ls(self.root)]
195 regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'r egress'))]
196 bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs')) ]
197 third_party = [current_path + ['third_party', t] for t in self.Ls(join(self. root, 'third_party'))]
198 tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools '))]
199 compiler = [current_path + ['compiler', t] for t in self.Ls(join(self.root, 'compiler'))]
200 harmony = [current_path + ['harmony', t] for t in self.Ls(join(self.root, 'h armony'))]
201 mjsunit.sort()
202 regress.sort()
203 bugs.sort()
204 third_party.sort()
205 tools.sort()
206 compiler.sort()
207 harmony.sort()
208 all_tests = mjsunit + regress + bugs + third_party + tools + compiler + harm ony
209 result = []
210 for test in all_tests:
211 if self.Contains(path, test):
212 file_path = join(self.root, reduce(join, test[1:], "") + ".js")
213 result.append(MjsunitTestCase(test, file_path, mode, self.context, self, False))
214 result.append(MjsunitTestCase(test, file_path, mode, self.context, self, True))
215 return result
216
217 def GetBuildRequirements(self):
218 return ['d8']
219
220 def GetTestStatus(self, sections, defs):
221 status_file = join(self.root, 'mjsunit.status')
222 if exists(status_file):
223 test.ReadConfigurationInto(status_file, sections, defs)
224
225
226
227 def GetConfiguration(context, root):
228 return MjsunitTestConfiguration(context, root)
OLDNEW
« no previous file with comments | « test/message/testcfg.py ('k') | test/mozilla/testcfg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698