OLD | NEW |
---|---|
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 return path + '.dartium.html' | 387 return path + '.dartium.html' |
388 | 388 |
389 def GetCompileCommand(self, fatal_static_type_errors=False): | 389 def GetCompileCommand(self, fatal_static_type_errors=False): |
390 fatal_static_type_errors = fatal_static_type_errors # shutup lint! | 390 fatal_static_type_errors = fatal_static_type_errors # shutup lint! |
391 return None | 391 return None |
392 | 392 |
393 def Compile(self): | 393 def Compile(self): |
394 return 0 | 394 return 0 |
395 | 395 |
396 | 396 |
397 class WebDriverArchiecture(ChromiumArchitecture): | |
398 """Architecture that runs compiled dart->JS (via frog) through a variety of | |
399 real browsers using WebDriver.""" | |
400 | |
401 def __init__(self, root_path, arch, mode, component, test): | |
402 super(WebDriverArchiecture, self).__init__(root_path, arch, mode, | |
403 component, test) | |
404 | |
405 def GetCompileCommand(self, fatal_static_type_errors=False): | |
406 """Returns cmdline as an array to invoke the compiler on this test.""" | |
407 # We need an absolute path because the compilation will run | |
408 # in a temporary directory. | |
409 frog = os.path.abspath(utils.GetDartRunner(self.mode, self.arch, 'frogsh')) | |
ngeoffray
2011/11/11 09:20:50
Could that be frog instead? frogsh requires node,
| |
410 build_root = utils.GetBuildRoot(OS_GUESS, self.mode, 'ia32') | |
411 cmd = [frog, '--libdir=%s' % os.path.abspath(os.path.join(self.root_path, | |
412 'frog', 'lib')), '--compile-only', | |
413 '--out=%s' % self.GetScriptPath()] | |
414 cmd.append(self.GetTestScriptFile()) | |
415 return cmd | |
416 | |
417 def GetRunCommand(self, fatal_static_type_errors=False): | |
418 """Returns a command line to execute for the test.""" | |
419 selenium_location = os.path.join(self.root_path, 'tools', 'testing', | |
420 'run_selenium.py') | |
421 | |
422 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName()) | |
423 f = open(html_output_file, 'w') | |
424 f.write(self.GetHtmlContents()) | |
425 f.close() | |
426 return [selenium_location, html_output_file] | |
427 | |
428 | |
397 class StandaloneArchitecture(Architecture): | 429 class StandaloneArchitecture(Architecture): |
398 """Base class for architectures that run tests without a browser.""" | 430 """Base class for architectures that run tests without a browser.""" |
399 | 431 |
400 def __init__(self, root_path, arch, mode, component, test): | 432 def __init__(self, root_path, arch, mode, component, test): |
401 super(StandaloneArchitecture, self).__init__(root_path, arch, mode, componen t, | 433 super(StandaloneArchitecture, self).__init__(root_path, arch, mode, componen t, |
402 test) | 434 test) |
403 | 435 |
404 def GetExecutable(self): | 436 def GetExecutable(self): |
405 """Returns the path to the Dart test runner (executes the .dart file).""" | 437 """Returns the path to the Dart test runner (executes the .dart file).""" |
406 return utils.GetDartRunner(self.mode, self.arch, self.component) | 438 return utils.GetDartRunner(self.mode, self.arch, self.component) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 | 522 |
491 | 523 |
492 def GetArchitecture(arch, mode, component, test): | 524 def GetArchitecture(arch, mode, component, test): |
493 root_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) | 525 root_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) |
494 if component == 'chromium': | 526 if component == 'chromium': |
495 return ChromiumArchitecture(root_path, arch, mode, component, test) | 527 return ChromiumArchitecture(root_path, arch, mode, component, test) |
496 | 528 |
497 elif component == 'dartium': | 529 elif component == 'dartium': |
498 return DartiumArchitecture(root_path, arch, mode, component, test) | 530 return DartiumArchitecture(root_path, arch, mode, component, test) |
499 | 531 |
532 elif component == 'webdriver': | |
533 return WebDriverArchiecture(root_path, arch, mode, component, test) | |
534 | |
500 elif component in ['vm', 'frog', 'frogsh']: | 535 elif component in ['vm', 'frog', 'frogsh']: |
501 return StandaloneArchitecture(root_path, arch, mode, component, test) | 536 return StandaloneArchitecture(root_path, arch, mode, component, test) |
502 | 537 |
503 elif component == 'leg': | 538 elif component == 'leg': |
504 return LegArchitecture(root_path, arch, mode, component, test) | 539 return LegArchitecture(root_path, arch, mode, component, test) |
505 | 540 |
506 elif component == 'dartc': | 541 elif component == 'dartc': |
507 return DartcArchitecture(root_path, arch, mode, component, test) | 542 return DartcArchitecture(root_path, arch, mode, component, test) |
OLD | NEW |