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

Side by Side Diff: tools/utils.py

Issue 8226016: Add the ability to run tests with several sets of VM flags (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed code in comments Created 9 years, 2 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
OLDNEW
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 # This file contains a set of utilities functions used by other Python-based 5 # This file contains a set of utilities functions used by other Python-based
6 # scripts. 6 # scripts.
7 7
8 import commands 8 import commands
9 import os 9 import os
10 import platform 10 import platform
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 def GetBuildRoot(target_os, mode=None, arch=None): 138 def GetBuildRoot(target_os, mode=None, arch=None):
139 if arch == 'dartc' and RUN_FROM_TOP_DIR: arch = ARCH_GUESS 139 if arch == 'dartc' and RUN_FROM_TOP_DIR: arch = ARCH_GUESS
140 global BUILD_ROOT 140 global BUILD_ROOT
141 if mode: 141 if mode:
142 return os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, arch)) 142 return os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, arch))
143 else: 143 else:
144 return BUILD_ROOT[target_os] 144 return BUILD_ROOT[target_os]
145 145
146 146
147 def RewritePathSeparator(path, workspace):
148 # Paths in test files are always specified using '/'
149 # as the path separator. Replace with the actual
150 # path separator before use.
151 if ('/' in path):
152 split_path = path.split('/')
153 path = os.sep.join(split_path)
154 path = os.path.join(workspace, path)
155 if not os.path.exists(path):
156 raise Exception(path)
157 return path
158
159
147 def ParseTestOptions(pattern, source, workspace): 160 def ParseTestOptions(pattern, source, workspace):
148 match = pattern.search(source) 161 match = pattern.search(source)
149 # Options should be a single line in the test case no splits.
150 if match: 162 if match:
151 def rewrite(path, workspace): 163 return [RewritePathSeparator(o, workspace) for o in match.group(1).split(' ' )]
152 # Paths in test files are always specified using '/'
153 # as the path separator. Replace with the actual
154 # path separator before use.
155 if ('/' in path):
156 split_path = path.split('/')
157 path = os.sep.join(split_path)
158 path = os.path.join(workspace, path)
159 if not os.path.exists(path):
160 raise Exception(path)
161 return path
162 return [rewrite(o, workspace) for o in match.group(1).split(' ')]
163 else: 164 else:
164 return None 165 return None
165 166
167
168 def ParseTestOptionsMultiple(pattern, source, workspace):
169 matches = pattern.findall(source)
170 if matches:
171 result = []
172 for match in matches:
173 result.append(
174 [RewritePathSeparator(o, workspace) for o in match.split(' ')]);
175 return result
176 else:
177 return None
178
166 179
167 def ConfigureJava(): 180 def ConfigureJava():
168 java_home = '/usr/libexec/java_home' 181 java_home = '/usr/libexec/java_home'
169 if os.path.exists(java_home): 182 if os.path.exists(java_home):
170 proc = subprocess.Popen([java_home, '-v', '1.6+'], 183 proc = subprocess.Popen([java_home, '-v', '1.6+'],
171 stdout=subprocess.PIPE, 184 stdout=subprocess.PIPE,
172 stderr=subprocess.PIPE) 185 stderr=subprocess.PIPE)
173 (stdout, stderr) = proc.communicate() 186 (stdout, stderr) = proc.communicate()
174 if proc.wait() != 0: 187 if proc.wait() != 0:
175 raise ToolError('non-zero exit code from ' + java_home) 188 raise ToolError('non-zero exit code from ' + java_home)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 def __init__(self, value): 231 def __init__(self, value):
219 self.value = value 232 self.value = value
220 233
221 def __str__(self): 234 def __str__(self):
222 return repr(self.value) 235 return repr(self.value)
223 236
224 237
225 if __name__ == "__main__": 238 if __name__ == "__main__":
226 import sys 239 import sys
227 Main(sys.argv) 240 Main(sys.argv)
OLDNEW
« tools/testing/test_configuration.py ('K') | « tools/testing/test_configuration.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698