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

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

Issue 8491052: Minor code clean-ups addressing Nicolas suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 years, 1 month 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 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 super(FrogChromiumArchitecture, self).__init__( 384 super(FrogChromiumArchitecture, self).__init__(
385 root_path, arch, mode, component, test) 385 root_path, arch, mode, component, test)
386 386
387 def GetCompileCommand(self, fatal_static_type_errors=False): 387 def GetCompileCommand(self, fatal_static_type_errors=False):
388 """Returns cmdline as an array to invoke the compiler on this test.""" 388 """Returns cmdline as an array to invoke the compiler on this test."""
389 389
390 # We need an absolute path because the compilation will run 390 # We need an absolute path because the compilation will run
391 # in a temporary directory. 391 # in a temporary directory.
392 392
393 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh')) 393 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh'))
394 cmd = [frog, '--out=' + self.GetScriptPath(), '--compile-only', 394 frog_libdir = os.path.abspath(os.path.join(self.root_path, 'frog', 'lib'))
395 '--libdir=' + os.path.abspath( 395 cmd = [frog,
396 os.path.join(self.root_path, 'frog', 'lib'))] 396 '--libdir=%s' % frog_libdir,
397 '--compile-only',
398 '--out=%s' % self.GetScriptPath()]
397 cmd.extend(self.vm_options) 399 cmd.extend(self.vm_options)
398 cmd.append(self.GetTestScriptFile()) 400 cmd.append(self.GetTestScriptFile())
399 return cmd 401 return cmd
400 402
401 403
402 class DartiumArchitecture(BrowserArchitecture): 404 class DartiumArchitecture(BrowserArchitecture):
403 """Architecture that runs dart in an VM embedded in DumpRenderTree.""" 405 """Architecture that runs dart in an VM embedded in DumpRenderTree."""
404 406
405 def __init__(self, root_path, arch, mode, component, test): 407 def __init__(self, root_path, arch, mode, component, test):
406 super(DartiumArchitecture, self).__init__(root_path, arch, mode, component, test) 408 super(DartiumArchitecture, self).__init__(root_path, arch, mode, component, test)
407 409
408 def GetScriptType(self): 410 def GetScriptType(self):
409 return 'application/dart' 411 return 'application/dart'
410 412
411 def GetScriptPath(self): 413 def GetScriptPath(self):
412 return 'file:///' + self.GetTestScriptFile() 414 return 'file:///' + self.GetTestScriptFile()
413 415
414 def GetHtmlName(self): 416 def GetHtmlName(self):
415 path = os.path.relpath(self.test, self.root_path).replace(os.sep, '_') 417 path = os.path.relpath(self.test, self.root_path).replace(os.sep, '_')
416 return path + '.dartium.html' 418 return path + '.dartium.html'
417 419
418 def GetCompileCommand(self, fatal_static_type_errors=False): 420 def GetCompileCommand(self, fatal_static_type_errors=False):
419 fatal_static_type_errors = fatal_static_type_errors # shutup lint! 421 fatal_static_type_errors = fatal_static_type_errors # shutup lint!
420 return None 422 return None
421 423
422 def Compile(self): 424 def Compile(self):
423 return 0 425 return 0
424 426
425 427
426 class WebDriverArchiecture(ChromiumArchitecture): 428 class WebDriverArchiecture(FrogChromiumArchitecture):
427 """Architecture that runs compiled dart->JS (via frog) through a variety of 429 """Architecture that runs compiled dart->JS (via frog) through a variety of
428 real browsers using WebDriver.""" 430 real browsers using WebDriver."""
429 431
430 def __init__(self, root_path, arch, mode, component, test): 432 def __init__(self, root_path, arch, mode, component, test):
431 super(WebDriverArchiecture, self).__init__(root_path, arch, mode, 433 super(WebDriverArchiecture, self).__init__(root_path, arch, mode,
432 component, test) 434 component, test)
433 435
434 def GetCompileCommand(self, fatal_static_type_errors=False):
435 """Returns cmdline as an array to invoke the compiler on this test."""
436 # We need an absolute path because the compilation will run
437 # in a temporary directory.
438 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh'))
439 build_root = utils.GetBuildRoot(OS_GUESS, self.mode, 'ia32')
440 cmd = [frog, '--libdir=%s' % os.path.abspath(os.path.join(self.root_path,
441 'frog', 'lib')), '--compile-only',
442 '--out=%s' % self.GetScriptPath()]
443 cmd.append(self.GetTestScriptFile())
444 return cmd
445
446 def GetRunCommand(self, fatal_static_type_errors=False): 436 def GetRunCommand(self, fatal_static_type_errors=False):
447 """Returns a command line to execute for the test.""" 437 """Returns a command line to execute for the test."""
448 selenium_location = os.path.join(self.root_path, 'tools', 'testing', 438 selenium_location = os.path.join(self.root_path, 'tools', 'testing',
449 'run_selenium.py') 439 'run_selenium.py')
450 440
451 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName()) 441 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName())
452 f = open(html_output_file, 'w') 442 f = open(html_output_file, 'w')
453 f.write(self.GetHtmlContents()) 443 f.write(self.GetHtmlContents())
454 f.close() 444 f.close()
455 return [selenium_location, html_output_file] 445 return [selenium_location, html_output_file]
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 return WebDriverArchiecture(root_path, arch, mode, component, test) 555 return WebDriverArchiecture(root_path, arch, mode, component, test)
566 556
567 elif component in ['vm', 'frog', 'frogsh']: 557 elif component in ['vm', 'frog', 'frogsh']:
568 return StandaloneArchitecture(root_path, arch, mode, component, test) 558 return StandaloneArchitecture(root_path, arch, mode, component, test)
569 559
570 elif component == 'leg': 560 elif component == 'leg':
571 return LegArchitecture(root_path, arch, mode, component, test) 561 return LegArchitecture(root_path, arch, mode, component, test)
572 562
573 elif component == 'dartc': 563 elif component == 'dartc':
574 return DartcArchitecture(root_path, arch, mode, component, test) 564 return DartcArchitecture(root_path, arch, mode, component, test)
OLDNEW
« frog/scripts/buildbot_annotated_steps.py ('K') | « frog/scripts/buildbot_annotated_steps.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698