Chromium Code Reviews| 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 getpass | 8 import getpass |
| 9 import math | 9 import math |
| 10 from matplotlib.font_manager import FontProperties | 10 from matplotlib.font_manager import FontProperties |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 for browser in get_browsers(): | 491 for browser in get_browsers(): |
| 492 for version in self.versions: | 492 for version in self.versions: |
| 493 self.trace_file = os.path.join('tools', 'testing', 'perf_testing', | 493 self.trace_file = os.path.join('tools', 'testing', 'perf_testing', |
| 494 self.result_folder_name, | 494 self.result_folder_name, |
| 495 'perf-%s-%s-%s' % (self.cur_time, browser, version)) | 495 'perf-%s-%s-%s' % (self.cur_time, browser, version)) |
| 496 self.add_svn_revision_to_trace(self.trace_file) | 496 self.add_svn_revision_to_trace(self.trace_file) |
| 497 file_path = os.path.join(os.getcwd(), 'internal', 'browserBenchmarks', | 497 file_path = os.path.join(os.getcwd(), 'internal', 'browserBenchmarks', |
| 498 'benchmark_page_%s.html' % version) | 498 'benchmark_page_%s.html' % version) |
| 499 run_cmd(['python', os.path.join('tools', 'testing', 'run_selenium.py'), | 499 run_cmd(['python', os.path.join('tools', 'testing', 'run_selenium.py'), |
| 500 '--out', file_path, '--browser', browser, | 500 '--out', file_path, '--browser', browser, |
| 501 '--timeout', '600', '--perf'], self.trace_file, append=True) | 501 '--timeout', '600', '--mode', 'perf'], self.trace_file, append=True) |
| 502 | 502 |
| 503 def process_file(self, afile): | 503 def process_file(self, afile): |
| 504 """Comb through the html to find the performance results.""" | 504 """Comb through the html to find the performance results.""" |
| 505 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', | 505 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', |
| 506 'perf_testing')) | 506 'perf_testing')) |
| 507 parts = afile.split('-') | 507 parts = afile.split('-') |
| 508 browser = parts[2] | 508 browser = parts[2] |
| 509 version = parts[3] | 509 version = parts[3] |
| 510 f = open(os.path.join(self.result_folder_name, afile)) | 510 f = open(os.path.join(self.result_folder_name, afile)) |
| 511 lines = f.readlines() | 511 lines = f.readlines() |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 for version_name in versions: | 587 for version_name in versions: |
| 588 version = version_name.replace('_','&') | 588 version = version_name.replace('_','&') |
| 589 self.trace_file = os.path.join('tools', 'testing', 'perf_testing', | 589 self.trace_file = os.path.join('tools', 'testing', 'perf_testing', |
| 590 self.result_folder_name, | 590 self.result_folder_name, |
| 591 'dromaeo-%s-%s-%s' % (self.cur_time, browser, version_name)) | 591 'dromaeo-%s-%s-%s' % (self.cur_time, browser, version_name)) |
| 592 self.add_svn_revision_to_trace(self.trace_file) | 592 self.add_svn_revision_to_trace(self.trace_file) |
| 593 file_path = os.path.join(os.getcwd(), dromaeo_path, | 593 file_path = os.path.join(os.getcwd(), dromaeo_path, |
| 594 'index-js.html?%s' % version) | 594 'index-js.html?%s' % version) |
| 595 run_cmd(['python', os.path.join('tools', 'testing', 'run_selenium.py'), | 595 run_cmd(['python', os.path.join('tools', 'testing', 'run_selenium.py'), |
| 596 '--out', file_path, '--browser', browser, | 596 '--out', file_path, '--browser', browser, |
| 597 '--timeout', '200', '--dromaeo'], self.trace_file, append=True) | 597 '--timeout', '200', '--mode', 'dromaeo'], self.trace_file, append=Tr ue) |
| 598 | 598 |
| 599 def process_file(self, afile): | 599 def process_file(self, afile): |
| 600 """Comb through the html to find the performance results.""" | 600 """Comb through the html to find the performance results.""" |
| 601 parts = afile.split('-') | 601 parts = afile.split('-') |
| 602 browser = parts[2] | 602 browser = parts[2] |
| 603 version = parts[3] | 603 version = parts[3] |
| 604 | 604 |
| 605 bench_dict = self.values_dict[browser][version] | 605 bench_dict = self.values_dict[browser][version] |
| 606 | 606 |
| 607 f = open(os.path.join(self.result_folder_name, afile)) | 607 f = open(os.path.join(self.result_folder_name, afile)) |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 | 846 |
| 847 def plot_results(self, png_filename): | 847 def plot_results(self, png_filename): |
| 848 self.style_and_save_perf_plot('Compiled minfrog Sizes', | 848 self.style_and_save_perf_plot('Compiled minfrog Sizes', |
| 849 'Size (in bytes)', 10, 10, 'lower left', png_filename, [COMMAND_LINE], | 849 'Size (in bytes)', 10, 10, 'lower left', png_filename, [COMMAND_LINE], |
| 850 [FROG], ['swarm', 'total', 'minfrog']) | 850 [FROG], ['swarm', 'total', 'minfrog']) |
| 851 | 851 |
| 852 self.style_and_save_perf_plot('Time to compile and bootstrap', | 852 self.style_and_save_perf_plot('Time to compile and bootstrap', |
| 853 'Seconds', 10, 10, 'lower left', '2' + png_filename, [COMMAND_LINE], | 853 'Seconds', 10, 10, 'lower left', '2' + png_filename, [COMMAND_LINE], |
| 854 [FROG], ['Bootstrapping', 'Compiling on Dart VM']) | 854 [FROG], ['Bootstrapping', 'Compiling on Dart VM']) |
| 855 | 855 |
| 856 # TODO(vsm): Make these names consistent with BROWSER_PERF, CL_PERF, | |
| 857 # etc. above. | |
|
vsm
2012/04/04 18:09:02
Emily: I didn't change the names as it seems like
Emily Fortuna
2012/04/04 18:30:58
Don't worry about the old flag names. Change as yo
vsm
2012/04/04 20:05:09
Done.
| |
| 858 SUITES = { | |
| 859 'command-line': CommandLinePerformanceTest, | |
| 860 'size-time': CompileTimeAndSizeTest, | |
| 861 'browser-perf': BrowserStandalonePerformanceTest, | |
| 862 'dromaeo': DromaeoTest, | |
| 863 'dromaeo-size': DromaeoSizeTest, | |
| 864 } | |
| 865 | |
| 856 def parse_args(): | 866 def parse_args(): |
| 857 parser = optparse.OptionParser() | 867 parser = optparse.OptionParser() |
| 858 # TODO(vsm): Change to a list to scale. | 868 # TODO(vsm): Change to a list to scale. |
| 859 parser.add_option('--command-line', '-c', dest='cl', | 869 parser.add_option('--suites', '-s', dest='suites', |
| 860 help='Run the command line tests', | 870 help='Run the specified test suites', |
|
Emily Fortuna
2012/04/04 18:30:58
add "comma separated" and perhaps list the valid o
vsm
2012/04/04 20:05:09
Done.
| |
| 861 action='store_true', default=False) | 871 action='store', default=None) |
| 862 parser.add_option('--size-time', '-s', dest='size', | |
| 863 help='Run the code size and timing tests', | |
| 864 action='store_true', default=False) | |
| 865 parser.add_option('--browser-perf', '-b', dest='perf', | |
| 866 help='Run the browser performance tests', | |
| 867 action='store_true', default=False) | |
| 868 parser.add_option('--dromaeo', '-d', dest='dromaeo', | |
| 869 help='Run the Dromaeo performance tests', | |
| 870 action='store_true', default=False) | |
| 871 parser.add_option('--dromaeo-size', '-D', dest='dsize', | |
| 872 help='Run the Dromaeo size tests', | |
| 873 action='store_true', default=False) | |
| 874 parser.add_option('--forever', '-f', dest='continuous', | 872 parser.add_option('--forever', '-f', dest='continuous', |
| 875 help='Run this script forever, always checking for the next svn ' | 873 help='Run this script forever, always checking for the next svn ' |
| 876 'checkin', action='store_true', default=False) | 874 'checkin', action='store_true', default=False) |
| 877 parser.add_option('--verbose', '-v', dest='verbose', | 875 parser.add_option('--verbose', '-v', dest='verbose', |
| 878 help='Print extra debug output', action='store_true', default=False) | 876 help='Print extra debug output', action='store_true', default=False) |
| 879 parser.add_option('--nobuild', '-n', dest='no_build', action='store_true', | 877 parser.add_option('--nobuild', '-n', dest='no_build', action='store_true', |
| 880 help='Do not sync with the repository and do not rebuild.', default=False) | 878 help='Do not sync with the repository and do not rebuild.', default=False) |
| 881 parser.add_option('--graph-only', '-g', dest='graph_only', default=False, | 879 parser.add_option('--graph-only', '-g', dest='graph_only', default=False, |
| 882 help='Do not run tests, only regenerate graphs', action='store_true') | 880 help='Do not run tests, only regenerate graphs', action='store_true') |
| 883 parser.add_option('--user', '-u', dest='username', | 881 parser.add_option('--user', '-u', dest='username', |
| 884 help='Username for submitting new data to App Engine', default='') | 882 help='Username for submitting new data to App Engine', default='') |
| 885 | 883 |
| 886 args, ignored = parser.parse_args() | 884 args, ignored = parser.parse_args() |
| 887 password = '' | 885 password = '' |
| 888 if args.username != '': | 886 if args.username != '': |
| 889 password = getpass.getpass("App Engine Password: ") | 887 password = getpass.getpass("App Engine Password: ") |
| 890 else: | 888 else: |
| 891 print 'Warning: performance data will not be uploaded to App Engine' + \ | 889 print 'Warning: performance data will not be uploaded to App Engine' + \ |
| 892 ' if you do not provide a username.' | 890 ' if you do not provide a username.' |
| 893 if not (args.cl or args.size or args.perf or args.dromaeo or args.dsize): | |
| 894 args.cl = args.size = args.perf = args.dromaeo = args.dsize = True | |
| 895 return (args.cl, args.size, args.perf, args.dromaeo, args.dsize, | |
| 896 args.continuous, args.verbose, args.no_build, args.graph_only, | |
| 897 args.username, password) | |
| 898 | 891 |
| 899 def run_test_sequence(cl, size, perf, dromaeo, dsize, no_build, graph_only, | 892 if not args.suites: |
| 893 suites = SUITES.values() | |
| 894 else: | |
| 895 suites = [] | |
| 896 suitelist = args.suites.split(',') | |
| 897 for name in suitelist: | |
| 898 if name in SUITES: | |
| 899 suites.append(SUITES[name]) | |
| 900 else: | |
| 901 print 'Error: invalid suite %s' % name | |
| 902 sys.exit(1) | |
| 903 return (suites, args.continuous, args.verbose, args.no_build, | |
| 904 args.graph_only, args.username, password) | |
| 905 | |
| 906 def run_test_sequence(suites, no_build, graph_only, | |
| 900 username, password): | 907 username, password): |
| 901 # The buildbot already builds and syncs to a specific revision. Don't fight | 908 # The buildbot already builds and syncs to a specific revision. Don't fight |
| 902 # with it or replicate work. | 909 # with it or replicate work. |
| 903 if (not no_build or not graph_only) and sync_and_build() == 1: | 910 if (not no_build or not graph_only) and sync_and_build() == 1: |
| 904 return # The build is broken. | 911 return # The build is broken. |
| 905 if size: | 912 |
| 906 CompileTimeAndSizeTest().run(graph_only) | 913 for test in suites: |
| 907 if cl: | 914 test().run(graph_only) |
| 908 CommandLinePerformanceTest().run(graph_only) | |
| 909 if perf: | |
| 910 BrowserStandalonePerformanceTest().run(graph_only) | |
| 911 if dromaeo: | |
| 912 DromaeoTest().run(graph_only) | |
| 913 if dsize: | |
| 914 DromaeoSizeTest().run(graph_only) | |
| 915 | 915 |
| 916 if username != '': | 916 if username != '': |
| 917 upload_to_app_engine(username, password) | 917 upload_to_app_engine(username, password) |
| 918 | 918 |
| 919 def main(): | 919 def main(): |
| 920 global VERBOSE | 920 global VERBOSE |
| 921 (cl, size, perf, dromaeo, dsize, continuous, verbose, no_build, graph_only, | 921 (suites, continuous, verbose, no_build, graph_only, |
| 922 username, password) = parse_args() | 922 username, password) = parse_args() |
|
Emily Fortuna
2012/04/04 18:30:58
can you move this back up to one line now?
vsm
2012/04/04 20:05:09
It doesn't fit in 80.
On 2012/04/04 18:30:58, Emi
| |
| 923 VERBOSE = verbose | 923 VERBOSE = verbose |
| 924 if continuous: | 924 if continuous: |
| 925 while True: | 925 while True: |
| 926 if has_new_code(): | 926 if has_new_code(): |
| 927 run_test_sequence(cl, size, perf, dromaeo, dsize, no_build, graph_only, | 927 run_test_sequence(suites, no_build, graph_only, |
| 928 username, password) | 928 username, password) |
| 929 else: | 929 else: |
| 930 time.sleep(SLEEP_TIME) | 930 time.sleep(SLEEP_TIME) |
| 931 else: | 931 else: |
| 932 run_test_sequence(cl, size, perf, dromaeo, dsize, no_build, graph_only, | 932 run_test_sequence(suites, no_build, graph_only, |
| 933 username, password) | 933 username, password) |
| 934 | 934 |
| 935 if __name__ == '__main__': | 935 if __name__ == '__main__': |
| 936 main() | 936 main() |
| OLD | NEW |