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

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

Issue 8566021: Made changes to the test architecture so that we can run frameworks other than (Closed) Base URL: http://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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return path + '.dartium.html' 416 return path + '.dartium.html'
417 417
418 def GetCompileCommand(self, fatal_static_type_errors=False): 418 def GetCompileCommand(self, fatal_static_type_errors=False):
419 fatal_static_type_errors = fatal_static_type_errors # shutup lint! 419 fatal_static_type_errors = fatal_static_type_errors # shutup lint!
420 return None 420 return None
421 421
422 def Compile(self): 422 def Compile(self):
423 return 0 423 return 0
424 424
425 425
426 class WebDriverArchiecture(ChromiumArchitecture): 426 class WebDriverArchitecture(ChromiumArchitecture):
427 """Architecture that runs compiled dart->JS (via frog) through a variety of 427 """Architecture that runs compiled dart->JS (via frog) through a
428 real browsers using WebDriver.""" 428 real browser (by default, Chrome) using WebDriver."""
429 429
430 def __init__(self, root_path, arch, mode, component, test): 430 def __init__(self, root_path, arch, mode, component, test):
431 super(WebDriverArchiecture, self).__init__(root_path, arch, mode, 431 super(WebDriverArchitecture, self).__init__(root_path, arch, mode,
432 component, test) 432 component, test)
433 433
434 def GetCompileCommand(self, fatal_static_type_errors=False): 434 def GetCompileCommand(self, fatal_static_type_errors=False):
435 """Returns cmdline as an array to invoke the compiler on this test.""" 435 """Returns cmdline as an array to invoke the compiler on this test."""
436 # We need an absolute path because the compilation will run 436 # We need an absolute path because the compilation will run
437 # in a temporary directory. 437 # in a temporary directory.
438 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh')) 438 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh'))
439 build_root = utils.GetBuildRoot(OS_GUESS, self.mode, 'ia32') 439 build_root = utils.GetBuildRoot(OS_GUESS, self.mode, 'ia32')
440 cmd = [frog, '--libdir=%s' % os.path.abspath(os.path.join(self.root_path, 440 cmd = [frog, '--libdir=%s' % os.path.abspath(os.path.join(self.root_path,
441 'frog', 'lib')), '--compile-only', 441 'frog', 'lib')), '--compile-only',
442 '--out=%s' % self.GetScriptPath()] 442 '--out=%s' % self.GetScriptPath()]
443 cmd.append(self.GetTestScriptFile()) 443 cmd.append(self.GetTestScriptFile())
444 return cmd 444 return cmd
445 445
446 def GetRunCommand(self, fatal_static_type_errors=False): 446 def GetRunCommand(self, browser='chrome', fatal_static_type_errors=False):
Siggi Cherem (dart-lang) 2011/11/14 23:56:06 this will possibly be not compatible with calls th
447 """Returns a command line to execute for the test.""" 447 """Returns a command line to execute for the test."""
448 selenium_location = os.path.join(self.root_path, 'tools', 'testing', 448 selenium_location = os.path.join(self.root_path, 'tools', 'testing',
449 'run_selenium.py') 449 'run_selenium.py')
450 450
451 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName()) 451 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName())
452 f = open(html_output_file, 'w') 452 f = open(html_output_file, 'w')
453 f.write(self.GetHtmlContents()) 453 f.write(self.GetHtmlContents())
454 f.close() 454 f.close()
455 return [selenium_location, html_output_file] 455 return [selenium_location, html_output_file, browser]
456
457 class FirefoxDriverArchitecture(WebDriverArchitecture):
Siggi Cherem (dart-lang) 2011/11/14 23:56:06 if you end up adding the parameter to the construc
458
459 def GetRunCommand(self, fatal_static_type_errors=False):
460 """Returns a command line to execute for the test."""
461 return super(FirefoxDriverArchitecture, self).GetRunCommand(browser='ff',
462 fatal_static_type_errors = fatal_static_type_errors)
463
464 class IEDriverArchitecture(WebDriverArchitecture):
465
466 def GetRunCommand(self, fatal_static_type_errors=False):
467 """Returns a command line to execute for the test."""
468 return super(IEDriverArchitecture, self).GetRunCommand(browser='ie',
469 fatal_static_type_errors = fatal_static_type_errors)
456 470
457 471
458 class StandaloneArchitecture(Architecture): 472 class StandaloneArchitecture(Architecture):
459 """Base class for architectures that run tests without a browser.""" 473 """Base class for architectures that run tests without a browser."""
460 474
461 def __init__(self, root_path, arch, mode, component, test): 475 def __init__(self, root_path, arch, mode, component, test):
462 super(StandaloneArchitecture, self).__init__(root_path, arch, mode, componen t, 476 super(StandaloneArchitecture, self).__init__(root_path, arch, mode, componen t,
463 test) 477 test)
464 478
465 def GetExecutable(self): 479 def GetExecutable(self):
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 root_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) 568 root_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
555 if component == 'chromium': 569 if component == 'chromium':
556 return DartcChromiumArchitecture(root_path, arch, mode, component, test) 570 return DartcChromiumArchitecture(root_path, arch, mode, component, test)
557 571
558 elif component == 'dartium': 572 elif component == 'dartium':
559 return DartiumArchitecture(root_path, arch, mode, component, test) 573 return DartiumArchitecture(root_path, arch, mode, component, test)
560 574
561 elif component == 'frogium': 575 elif component == 'frogium':
562 return FrogChromiumArchitecture(root_path, arch, mode, component, test) 576 return FrogChromiumArchitecture(root_path, arch, mode, component, test)
563 577
564 elif component == 'webdriver': 578 elif component == 'webdriver' or component == 'webdriverchrome':
565 return WebDriverArchiecture(root_path, arch, mode, component, test) 579 return WebDriverArchitecture(root_path, arch, mode, component, test)
580
581 elif component == 'webdriverff':
Siggi Cherem (dart-lang) 2011/11/14 23:56:06 it might be nice to use - or _ on these names, as
582 return FirefoxDriverArchitecture(root_path, arch, mode, component, test)
583
584 elif component == 'webdriverie':
585 return IEDriverArchitecture(root_path, arch, mode, component, test)
566 586
567 elif component in ['vm', 'frog', 'frogsh']: 587 elif component in ['vm', 'frog', 'frogsh']:
568 return StandaloneArchitecture(root_path, arch, mode, component, test) 588 return StandaloneArchitecture(root_path, arch, mode, component, test)
569 589
570 elif component == 'leg': 590 elif component == 'leg':
571 return LegArchitecture(root_path, arch, mode, component, test) 591 return LegArchitecture(root_path, arch, mode, component, test)
572 592
573 elif component == 'dartc': 593 elif component == 'dartc':
574 return DartcArchitecture(root_path, arch, mode, component, test) 594 return DartcArchitecture(root_path, arch, mode, component, test)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698