| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 from os.path import dirname, abspath | 10 from os.path import dirname, abspath |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 platform_list, versions, benchmarks, test_runner, tester, | 390 platform_list, versions, benchmarks, test_runner, tester, |
| 391 file_processor, build_targets=build_targets) | 391 file_processor, build_targets=build_targets) |
| 392 self.platform_list = platform_list | 392 self.platform_list = platform_list |
| 393 self.platform_type = platform_type | 393 self.platform_type = platform_type |
| 394 self.versions = versions | 394 self.versions = versions |
| 395 self.benchmarks = benchmarks | 395 self.benchmarks = benchmarks |
| 396 | 396 |
| 397 | 397 |
| 398 class BrowserTester(Tester): | 398 class BrowserTester(Tester): |
| 399 @staticmethod | 399 @staticmethod |
| 400 def get_browsers(): | 400 def get_browsers(add_dartium=True): |
| 401 browsers = ['dartium', 'ff', 'chrome'] | 401 browsers = ['ff', 'chrome'] |
| 402 if add_dartium: |
| 403 browsers += ['dartium'] |
| 402 has_shell = False | 404 has_shell = False |
| 403 if platform.system() == 'Darwin': | 405 if platform.system() == 'Darwin': |
| 404 browsers += ['safari'] | 406 browsers += ['safari'] |
| 405 if platform.system() == 'Windows': | 407 if platform.system() == 'Windows': |
| 406 browsers += ['ie'] | 408 browsers += ['ie'] |
| 407 has_shell = True | 409 has_shell = True |
| 408 if 'dartium' in browsers: | 410 if 'dartium' in browsers: |
| 409 # Fetch it if necessary. | 411 # Fetch it if necessary. |
| 410 get_dartium = ['python', | 412 get_dartium = ['python', |
| 411 os.path.join(DART_INSTALL_LOCATION, 'tools', 'get_drt.py'), | 413 os.path.join(DART_INSTALL_LOCATION, 'tools', 'get_drt.py'), |
| 412 '--dartium'] | 414 '--dartium'] |
| 413 # TODO(vsm): It's inconvenient that run_cmd isn't in scope here. | 415 # TODO(vsm): It's inconvenient that run_cmd isn't in scope here. |
| 414 # Perhaps there is a better place to put that or this. | 416 # Perhaps there is a better place to put that or this. |
| 415 subprocess.call(get_dartium, stdout=sys.stdout, stderr=sys.stderr, | 417 subprocess.call(get_dartium, stdout=sys.stdout, stderr=sys.stderr, |
| 416 shell=has_shell) | 418 shell=has_shell) |
| 417 return browsers | 419 return browsers |
| 418 | 420 |
| 419 | 421 |
| 420 class CommonBrowserTest(RuntimePerformanceTest): | 422 class CommonBrowserTest(RuntimePerformanceTest): |
| 421 """Runs this basic performance tests (Benchpress, some V8 benchmarks) in the | 423 """Runs this basic performance tests (Benchpress, some V8 benchmarks) in the |
| 422 browser.""" | 424 browser.""" |
| 423 | 425 |
| 424 def __init__(self, test_runner): | 426 def __init__(self, test_runner): |
| 425 """Args: | 427 """Args: |
| 426 test_runner: Reference to the object that notifies us when to run.""" | 428 test_runner: Reference to the object that notifies us when to run.""" |
| 427 super(CommonBrowserTest, self).__init__( | 429 super(CommonBrowserTest, self).__init__( |
| 428 self.name(), BrowserTester.get_browsers(), | 430 self.name(), BrowserTester.get_browsers(False), |
| 429 'browser', ['js', 'frog'], | 431 'browser', ['js', 'frog'], |
| 430 self.get_standalone_benchmarks(), test_runner, | 432 self.get_standalone_benchmarks(), test_runner, |
| 431 self.CommonBrowserTester(self), | 433 self.CommonBrowserTester(self), |
| 432 self.CommonBrowserFileProcessor(self)) | 434 self.CommonBrowserFileProcessor(self)) |
| 433 | 435 |
| 434 @staticmethod | 436 @staticmethod |
| 435 def name(): | 437 def name(): |
| 436 return 'browser-perf' | 438 return 'browser-perf' |
| 437 | 439 |
| 438 @staticmethod | 440 @staticmethod |
| 439 def get_standalone_benchmarks(): | 441 def get_standalone_benchmarks(): |
| 440 return ['Mandelbrot', 'DeltaBlue', 'Richards', 'NBody', 'BinaryTrees', | 442 return ['Mandelbrot', 'DeltaBlue', 'Richards', 'NBody', 'BinaryTrees', |
| 441 'Fannkuch', 'Meteor', 'BubbleSort', 'Fibonacci', 'Loop', 'Permute', | 443 'Fannkuch', 'Meteor', 'BubbleSort', 'Fibonacci', 'Loop', 'Permute', |
| 442 'Queens', 'QuickSort', 'Recurse', 'Sieve', 'Sum', 'Tak', 'Takl', 'Towers', | 444 'Queens', 'QuickSort', 'Recurse', 'Sieve', 'Sum', 'Tak', 'Takl', 'Towers', |
| 443 'TreeSort'] | 445 'TreeSort'] |
| 444 | 446 |
| 445 class CommonBrowserTester(BrowserTester): | 447 class CommonBrowserTester(BrowserTester): |
| 446 def run_tests(self): | 448 def run_tests(self): |
| 447 """Run a performance test in the browser.""" | 449 """Run a performance test in the browser.""" |
| 448 os.chdir('frog') | 450 os.chdir('frog') |
| 449 self.test.test_runner.run_cmd(['python', os.path.join('benchmarks', | 451 self.test.test_runner.run_cmd(['python', os.path.join('benchmarks', |
| 450 'make_web_benchmarks.py')]) | 452 'make_web_benchmarks.py')]) |
| 451 os.chdir('..') | 453 os.chdir('..') |
| 452 | 454 |
| 453 for browser in BrowserTester.get_browsers(): | 455 for browser in self.test.platform_list: |
| 454 for version in self.test.versions: | 456 for version in self.test.versions: |
| 455 if not self.test.is_valid_combination(browser, version): | 457 if not self.test.is_valid_combination(browser, version): |
| 456 continue | 458 continue |
| 457 self.test.trace_file = os.path.join( | 459 self.test.trace_file = os.path.join( |
| 458 'tools', 'testing', 'perf_testing', self.test.result_folder_name, | 460 'tools', 'testing', 'perf_testing', self.test.result_folder_name, |
| 459 'perf-%s-%s-%s' % (self.test.cur_time, browser, version)) | 461 'perf-%s-%s-%s' % (self.test.cur_time, browser, version)) |
| 460 self.add_svn_revision_to_trace(self.test.trace_file, browser) | 462 self.add_svn_revision_to_trace(self.test.trace_file, browser) |
| 461 file_path = os.path.join( | 463 file_path = os.path.join( |
| 462 os.getcwd(), 'internal', 'browserBenchmarks', | 464 os.getcwd(), 'internal', 'browserBenchmarks', |
| 463 'benchmark_page_%s.html' % version) | 465 'benchmark_page_%s.html' % version) |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 while True: | 934 while True: |
| 933 if runner.has_new_code(): | 935 if runner.has_new_code(): |
| 934 runner.run_test_sequence() | 936 runner.run_test_sequence() |
| 935 else: | 937 else: |
| 936 time.sleep(200) | 938 time.sleep(200) |
| 937 else: | 939 else: |
| 938 runner.run_test_sequence() | 940 runner.run_test_sequence() |
| 939 | 941 |
| 940 if __name__ == '__main__': | 942 if __name__ == '__main__': |
| 941 main() | 943 main() |
| OLD | NEW |