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

Side by Side Diff: tools/testing/architecture.py

Issue 8824013: Enable test invoker to provide path to frog for frogium test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5
6 import os 6 import os
7 import platform 7 import platform
8 import re 8 import re
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 self.test = test 163 self.test = test
164 self.build_root = utils.GetBuildRoot(OS_GUESS, self.mode, self.arch) 164 self.build_root = utils.GetBuildRoot(OS_GUESS, self.mode, self.arch)
165 source = file(test).read() 165 source = file(test).read()
166 self.vm_options = [] 166 self.vm_options = []
167 self.dart_options = utils.ParseTestOptions(DART_OPTIONS_PATTERN, 167 self.dart_options = utils.ParseTestOptions(DART_OPTIONS_PATTERN,
168 source, 168 source,
169 root_path) 169 root_path)
170 self.is_web_test = _IsWebTest(source) 170 self.is_web_test = _IsWebTest(source)
171 self.temp_dir = None 171 self.temp_dir = None
172 172
173 def GetVMOption(self, option):
174 for flag in self.vm_options:
175 if flag.startswith('--%s=' % option):
176 return flag.split('=')[1]
177 return None
178
173 def HasFatalTypeErrors(self): 179 def HasFatalTypeErrors(self):
174 """Returns True if this type of component supports --fatal-type-errors.""" 180 """Returns True if this type of component supports --fatal-type-errors."""
175 return False 181 return False
176 182
177 def GetTestFrameworkPath(self): 183 def GetTestFrameworkPath(self):
178 """Path to dart source (TestFramework.dart) for testing framework.""" 184 """Path to dart source (TestFramework.dart) for testing framework."""
179 return os.path.join(self.root_path, 'tests', 'isolate', 'src', 185 return os.path.join(self.root_path, 'tests', 'isolate', 'src',
180 'TestFramework.dart') 186 'TestFramework.dart')
181 187
182 188
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 app_output_file = self.GetTestScriptFile() 271 app_output_file = self.GetTestScriptFile()
266 f = open(app_output_file, 'w') 272 f = open(app_output_file, 'w')
267 f.write(self.GetTestContents(library_file)) 273 f.write(self.GetTestContents(library_file))
268 f.close() 274 f.close()
269 275
270 def GetRunCommand(self, fatal_static_type_errors=False): 276 def GetRunCommand(self, fatal_static_type_errors=False):
271 """Returns a command line to execute for the test.""" 277 """Returns a command line to execute for the test."""
272 fatal_static_type_errors = fatal_static_type_errors # shutup lint! 278 fatal_static_type_errors = fatal_static_type_errors # shutup lint!
273 # Find DRT 279 # Find DRT
274 # For some reason, DRT needs to be called via an absolute path 280 # For some reason, DRT needs to be called via an absolute path
275 drt_location = None 281 drt_location = self.GetVMOption('browser')
276 flags = self.vm_options
277 for flag in flags:
278 if flag.startswith('--browser='):
279 drt_location = flag.split('=')[1]
280 break
281 if drt_location is not None: 282 if drt_location is not None:
282 drt_location = os.path.abspath(drt_location) 283 drt_location = os.path.abspath(drt_location)
283 else: 284 else:
284 drt_location = os.path.join(self.root_path, 'client', 'tests', 'drt', 285 drt_location = os.path.join(self.root_path, 'client', 'tests', 'drt',
285 'DumpRenderTree') 286 'DumpRenderTree')
286 287
287 # On Mac DumpRenderTree is a .app folder 288 # On Mac DumpRenderTree is a .app folder
288 if platform.system() == 'Darwin': 289 if platform.system() == 'Darwin':
289 drt_location += '.app/Contents/MacOS/DumpRenderTree' 290 drt_location += '.app/Contents/MacOS/DumpRenderTree'
290 291
291 drt_flags = ['--no-timeout'] 292 drt_flags = ['--no-timeout']
292 dart_flags = '--dart-flags=--enable_asserts --enable_type_checks ' 293 dart_flags = '--dart-flags=--enable_asserts --enable_type_checks '
293 dart_flags += ' '.join(flags) 294 dart_flags += ' '.join(self.vm_options)
294 295
295 drt_flags.append(dart_flags) 296 drt_flags.append(dart_flags)
296 297
297 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName()) 298 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName())
298 f = open(html_output_file, 'w') 299 f = open(html_output_file, 'w')
299 f.write(self.GetHtmlContents()) 300 f.write(self.GetHtmlContents())
300 f.close() 301 f.close()
301 302
302 drt_flags.append(html_output_file) 303 drt_flags.append(html_output_file)
303 304
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 class FrogChromiumArchitecture(ChromiumArchitecture): 403 class FrogChromiumArchitecture(ChromiumArchitecture):
403 """ChromiumArchitecture that compiles code using frog.""" 404 """ChromiumArchitecture that compiles code using frog."""
404 405
405 def __init__(self, root_path, arch, mode, component, test): 406 def __init__(self, root_path, arch, mode, component, test):
406 super(FrogChromiumArchitecture, self).__init__( 407 super(FrogChromiumArchitecture, self).__init__(
407 root_path, arch, mode, component, test) 408 root_path, arch, mode, component, test)
408 409
409 def GetCompileCommand(self, fatal_static_type_errors=False): 410 def GetCompileCommand(self, fatal_static_type_errors=False):
410 """Returns cmdline as an array to invoke the compiler on this test.""" 411 """Returns cmdline as an array to invoke the compiler on this test."""
411 412
413 # Get a frog executable from the command line. Default to frogsh.
412 # We need an absolute path because the compilation will run 414 # We need an absolute path because the compilation will run
413 # in a temporary directory. 415 # in a temporary directory.
414 416 frog = self.GetVMOption('frog')
415 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh')) 417 if frog is not None:
416 frog_libdir = os.path.abspath(os.path.join(self.root_path, 'frog', 'lib')) 418 frog = os.path.abspath(frog)
419 else:
420 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh') )
421 frog_libdir = self.GetVMOption('froglib')
422 if frog_libdir is not None:
423 frog_libdir = os.path.abspath(frog_libdir)
424 else:
425 frog_libdir = os.path.abspath(os.path.join(self.root_path, 'frog', 'lib'))
417 cmd = [frog, 426 cmd = [frog,
418 '--libdir=%s' % frog_libdir, 427 '--libdir=%s' % frog_libdir,
419 '--compile-only', 428 '--compile-only',
420 '--out=%s' % self.GetScriptPath()] 429 '--out=%s' % self.GetScriptPath()]
421 cmd.extend(self.vm_options) 430 cmd.extend(self.vm_options)
422 cmd.append(self.GetTestScriptFile()) 431 cmd.append(self.GetTestScriptFile())
423 return cmd 432 return cmd
424 433
425 434
426 class DartiumArchitecture(BrowserArchitecture): 435 class DartiumArchitecture(BrowserArchitecture):
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 return WebDriverArchitecture(root_path, arch, mode, component, test) 594 return WebDriverArchitecture(root_path, arch, mode, component, test)
586 595
587 elif component in ['vm', 'frog', 'frogsh']: 596 elif component in ['vm', 'frog', 'frogsh']:
588 return StandaloneArchitecture(root_path, arch, mode, component, test) 597 return StandaloneArchitecture(root_path, arch, mode, component, test)
589 598
590 elif component == 'leg': 599 elif component == 'leg':
591 return LegArchitecture(root_path, arch, mode, component, test) 600 return LegArchitecture(root_path, arch, mode, component, test)
592 601
593 elif component == 'dartc': 602 elif component == 'dartc':
594 return DartcArchitecture(root_path, arch, mode, component, test) 603 return DartcArchitecture(root_path, arch, mode, component, test)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698