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

Side by Side Diff: test/message/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/cctest/testcfg.py ('k') | test/mjsunit/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"): 52 if filename.endswith(".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 result = [] 60 result = []
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 result += match.strip().split() 63 result += match.strip().split()
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if not re.match(pattern, actual): 102 if not re.match(pattern, actual):
103 return True 103 return True
104 return False 104 return False
105 105
106 def StripOutputForTransmit(self, testcase): 106 def StripOutputForTransmit(self, testcase):
107 pass 107 pass
108 108
109 109
110 def GetSuite(name, root): 110 def GetSuite(name, root):
111 return MessageTestSuite(name, root) 111 return MessageTestSuite(name, root)
112
113
114 # Deprecated definitions below.
115 # TODO(jkummerow): Remove when SCons is no longer supported.
116
117
118 import test
119 from os.path import join, exists, basename, isdir
120
121 class MessageTestCase(test.TestCase):
122
123 def __init__(self, path, file, expected, mode, context, config):
124 super(MessageTestCase, self).__init__(context, path, mode)
125 self.file = file
126 self.expected = expected
127 self.config = config
128
129 def IgnoreLine(self, str):
130 """Ignore empty lines, valgrind output and Android output."""
131 if not str: return True
132 return (str.startswith('==') or str.startswith('**') or
133 str.startswith('ANDROID'))
134
135 def IsFailureOutput(self, output):
136 f = file(self.expected)
137 # Skip initial '#' comment and spaces
138 for line in f:
139 if (not line.startswith('#')) and (not line.strip()):
140 break
141 # Convert output lines to regexps that we can match
142 env = { 'basename': basename(self.file) }
143 patterns = [ ]
144 for line in f:
145 if not line.strip():
146 continue
147 pattern = re.escape(line.rstrip() % env)
148 pattern = pattern.replace('\\*', '.*')
149 pattern = '^%s$' % pattern
150 patterns.append(pattern)
151 # Compare actual output with the expected
152 raw_lines = output.stdout.splitlines()
153 outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ]
154 if len(outlines) != len(patterns):
155 return True
156 for i in xrange(len(patterns)):
157 if not re.match(patterns[i], outlines[i]):
158 return True
159 return False
160
161 def GetLabel(self):
162 return "%s %s" % (self.mode, self.GetName())
163
164 def GetName(self):
165 return self.path[-1]
166
167 def GetCommand(self):
168 result = self.config.context.GetVmCommand(self, self.mode)
169 source = open(self.file).read()
170 flags_match = re.findall(FLAGS_PATTERN, source)
171 for match in flags_match:
172 result += match.strip().split()
173 result.append(self.file)
174 return result
175
176 def GetSource(self):
177 return (open(self.file).read()
178 + "\n--- expected output ---\n"
179 + open(self.expected).read())
180
181
182 class MessageTestConfiguration(test.TestConfiguration):
183
184 def __init__(self, context, root):
185 super(MessageTestConfiguration, self).__init__(context, root)
186
187 def Ls(self, path):
188 if isdir(path):
189 return [f[:-3] for f in os.listdir(path) if f.endswith('.js')]
190 else:
191 return []
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 mjsunit.sort()
198 regress.sort()
199 bugs.sort()
200 all_tests = mjsunit + regress + bugs
201 result = []
202 for test in all_tests:
203 if self.Contains(path, test):
204 file_prefix = join(self.root, reduce(join, test[1:], ""))
205 file_path = file_prefix + ".js"
206 output_path = file_prefix + ".out"
207 if not exists(output_path):
208 print "Could not find %s" % output_path
209 continue
210 result.append(MessageTestCase(test, file_path, output_path, mode,
211 self.context, self))
212 return result
213
214 def GetBuildRequirements(self):
215 return ['d8']
216
217 def GetTestStatus(self, sections, defs):
218 status_file = join(self.root, 'message.status')
219 if exists(status_file):
220 test.ReadConfigurationInto(status_file, sections, defs)
221
222
223 def GetConfiguration(context, root):
224 return MessageTestConfiguration(context, root)
OLDNEW
« no previous file with comments | « test/cctest/testcfg.py ('k') | test/mjsunit/testcfg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698