| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, 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 math | 8 import math |
| 9 try: | 9 try: |
| 10 from matplotlib.font_manager import FontProperties | 10 from matplotlib.font_manager import FontProperties |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 def get_os_directory(self): | 164 def get_os_directory(self): |
| 165 """Specifies the name of the directory for the testing build of dart, which | 165 """Specifies the name of the directory for the testing build of dart, which |
| 166 has yet a different naming convention from utils.getBuildRoot(...).""" | 166 has yet a different naming convention from utils.getBuildRoot(...).""" |
| 167 if platform.system() == 'Windows': | 167 if platform.system() == 'Windows': |
| 168 return 'windows' | 168 return 'windows' |
| 169 elif platform.system() == 'Darwin': | 169 elif platform.system() == 'Darwin': |
| 170 return 'macos' | 170 return 'macos' |
| 171 else: | 171 else: |
| 172 return 'linux' | 172 return 'linux' |
| 173 | 173 |
| 174 def upload_to_app_engine(self, suite_names): | |
| 175 """Upload our results to our appengine server. | |
| 176 Arguments: | |
| 177 suite_names: Directories to upload data from (should match directory | |
| 178 names).""" | |
| 179 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', | |
| 180 'perf_testing')) | |
| 181 for data in suite_names: | |
| 182 path = os.path.join('appengine', 'static', 'data', data, utils.GuessOS()) | |
| 183 shutil.rmtree(path, ignore_errors=True) | |
| 184 os.makedirs(path) | |
| 185 files = [] | |
| 186 # Copy the 1000 most recent trace files to be uploaded. | |
| 187 for f in os.listdir(data): | |
| 188 files += [(os.path.getmtime(os.path.join(data, f)), f)] | |
| 189 files.sort() | |
| 190 for f in files[-1000:]: | |
| 191 shutil.copyfile(os.path.join(data, f[1]), | |
| 192 os.path.join(path, f[1]+'.txt')) | |
| 193 # Generate directory listing. | |
| 194 for data in suite_names: | |
| 195 path = os.path.join('appengine', 'static', 'data', data, utils.GuessOS()) | |
| 196 out = open(os.path.join('appengine', 'static', | |
| 197 '%s-%s.html' % (data, utils.GuessOS())), 'w') | |
| 198 out.write('<html>\n <body>\n <ul>\n') | |
| 199 for f in os.listdir(path): | |
| 200 if not f.startswith('.'): | |
| 201 out.write(' <li><a href=data' + \ | |
| 202 '''/%(data)s/%(os)s/%(file)s>%(file)s</a></li>\n''' % \ | |
| 203 {'data': data, 'os': utils.GuessOS(), 'file': f}) | |
| 204 out.write(' </ul>\n </body>\n</html>') | |
| 205 out.close() | |
| 206 | |
| 207 shutil.rmtree(os.path.join('appengine', 'static', 'graphs'), | |
| 208 ignore_errors=True) | |
| 209 shutil.copytree('graphs', os.path.join('appengine', 'static', 'graphs')) | |
| 210 shutil.copyfile('index.html', os.path.join('appengine', 'static', | |
| 211 'index.html')) | |
| 212 shutil.copyfile('dromaeo.html', os.path.join('appengine', 'static', | |
| 213 'dromaeo.html')) | |
| 214 shutil.copyfile('data.html', os.path.join('appengine', 'static', | |
| 215 'data.html')) | |
| 216 self.run_cmd([os.path.join('..', '..', '..', 'third_party', | |
| 217 'appengine-python', 'appcfg.py'), '--oauth2', | |
| 218 'update', 'appengine/']) | |
| 219 | |
| 220 | |
| 221 def parse_args(self): | 174 def parse_args(self): |
| 222 parser = optparse.OptionParser() | 175 parser = optparse.OptionParser() |
| 223 parser.add_option('--suites', '-s', dest='suites', help='Run the specified ' | 176 parser.add_option('--suites', '-s', dest='suites', help='Run the specified ' |
| 224 'comma-separated test suites from set: %s' % \ | 177 'comma-separated test suites from set: %s' % \ |
| 225 ','.join(TestBuilder.available_suite_names()), | 178 ','.join(TestBuilder.available_suite_names()), |
| 226 action='store', default=None) | 179 action='store', default=None) |
| 227 parser.add_option('--forever', '-f', dest='continuous', help='Run this scri' | 180 parser.add_option('--forever', '-f', dest='continuous', help='Run this scri' |
| 228 'pt forever, always checking for the next svn checkin', | 181 'pt forever, always checking for the next svn checkin', |
| 229 action='store_true', default=False) | 182 action='store_true', default=False) |
| 230 parser.add_option('--nobuild', '-n', dest='no_build', action='store_true', | 183 parser.add_option('--nobuild', '-n', dest='no_build', action='store_true', |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 @staticmethod | 742 @staticmethod |
| 790 def legalize_filename(str): | 743 def legalize_filename(str): |
| 791 remap = { | 744 remap = { |
| 792 ' ': '_', | 745 ' ': '_', |
| 793 '(': '_', | 746 '(': '_', |
| 794 ')': '_', | 747 ')': '_', |
| 795 '*': 'ALL', | 748 '*': 'ALL', |
| 796 '=': 'ASSIGN', | 749 '=': 'ASSIGN', |
| 797 } | 750 } |
| 798 for (old, new) in remap.iteritems(): | 751 for (old, new) in remap.iteritems(): |
| 799 str = str.replace(old, new)» | 752 str = str.replace(old, new) |
| 800 return str | 753 return str |
| 801 | 754 |
| 802 # TODO(vsm): This is a hack to skip breaking tests. Triage this | 755 # TODO(vsm): This is a hack to skip breaking tests. Triage this |
| 803 # failure properly. The modify suite fails on 32-bit chrome, which | 756 # failure properly. The modify suite fails on 32-bit chrome, which |
| 804 # is the default on mac and win. | 757 # is the default on mac and win. |
| 805 @staticmethod | 758 @staticmethod |
| 806 def get_valid_dromaeo_tags(): | 759 def get_valid_dromaeo_tags(): |
| 807 tags = [tag for (tag, _) in DromaeoTester.DROMAEO_BENCHMARKS.values()] | 760 tags = [tag for (tag, _) in DromaeoTester.DROMAEO_BENCHMARKS.values()] |
| 808 if platform.system() == 'Darwin' or platform.system() == 'Windows': | 761 if platform.system() == 'Darwin' or platform.system() == 'Windows': |
| 809 tags.remove('modify') | 762 tags.remove('modify') |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 return 'dromaeo' | 796 return 'dromaeo' |
| 844 | 797 |
| 845 def is_valid_combination(self, browser, version): | 798 def is_valid_combination(self, browser, version): |
| 846 # TODO(vsm): This avoids a bug in 32-bit Chrome (dartium) | 799 # TODO(vsm): This avoids a bug in 32-bit Chrome (dartium) |
| 847 # running JS dromaeo. | 800 # running JS dromaeo. |
| 848 if browser == 'dartium' and version == 'js': | 801 if browser == 'dartium' and version == 'js': |
| 849 return False | 802 return False |
| 850 # dart:dom has been removed from Dartium. | 803 # dart:dom has been removed from Dartium. |
| 851 if browser == 'dartium' and 'dom' in version: | 804 if browser == 'dartium' and 'dom' in version: |
| 852 return False | 805 return False |
| 853 # Only run dart2js on Chrome until we validate it elsewhere. | 806 if browser == 'ff': |
| 854 if browser != 'chrome' and 'dart2js' in version: | 807 # TODO(vsm): We are waiting on a fix from Issue 3152 from dart2js. |
| 855 return False | 808 return False |
| 856 return True | 809 return True |
| 857 | 810 |
| 858 class DromaeoPerfGrapher(RuntimePerfGrapher): | 811 class DromaeoPerfGrapher(RuntimePerfGrapher): |
| 859 def plot_results(self, png_filename): | 812 def plot_results(self, png_filename): |
| 860 self.plot_all_perf(png_filename) | 813 self.plot_all_perf(png_filename) |
| 861 self.plot_avg_perf('2' + png_filename) | 814 self.plot_avg_perf('2' + png_filename) |
| 862 self.plot_avg_perf('3' + png_filename, ['chrome', 'dartium'], | 815 self.plot_avg_perf('3' + png_filename, ['chrome', 'dartium'], |
| 863 ['js', 'frog_dom', 'frog_html']) | 816 ['js', 'frog_dom', 'frog_html']) |
| 864 self.plot_avg_perf('4' + png_filename, ['chrome'], | 817 self.plot_avg_perf('4' + png_filename, ['chrome'], |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 if not self.test.is_valid_combination(browser, version_name): | 896 if not self.test.is_valid_combination(browser, version_name): |
| 944 continue | 897 continue |
| 945 version = DromaeoTest.DromaeoPerfTester.get_dromaeo_url_query( | 898 version = DromaeoTest.DromaeoPerfTester.get_dromaeo_url_query( |
| 946 browser, version_name) | 899 browser, version_name) |
| 947 self.test.trace_file = os.path.join( | 900 self.test.trace_file = os.path.join( |
| 948 'tools', 'testing', 'perf_testing', self.test.result_folder_name, | 901 'tools', 'testing', 'perf_testing', self.test.result_folder_name, |
| 949 'dromaeo-%s-%s-%s' % (self.test.cur_time, browser, version_name)) | 902 'dromaeo-%s-%s-%s' % (self.test.cur_time, browser, version_name)) |
| 950 self.add_svn_revision_to_trace(self.test.trace_file, browser) | 903 self.add_svn_revision_to_trace(self.test.trace_file, browser) |
| 951 file_path = '"%s"' % os.path.join(os.getcwd(), dromaeo_path, | 904 file_path = '"%s"' % os.path.join(os.getcwd(), dromaeo_path, |
| 952 'index-js.html?%s' % version) | 905 'index-js.html?%s' % version) |
| 953 if platform.system() == 'Windows': | |
| 954 file_path = file_path.replace('&', '^&') | |
| 955 file_path = file_path.replace('?', '^?') | |
| 956 file_path = file_path.replace('|', '^|') | |
| 957 self.test.test_runner.run_cmd( | 906 self.test.test_runner.run_cmd( |
| 958 ['python', os.path.join('tools', 'testing', 'run_selenium.py'), | 907 ['python', os.path.join('tools', 'testing', 'run_selenium.py'), |
| 959 '--out', file_path, '--browser', browser, | 908 '--out', file_path, '--browser', browser, |
| 960 '--timeout', '900', '--mode', 'dromaeo'], self.test.trace_file, | 909 '--timeout', '900', '--mode', 'dromaeo'], self.test.trace_file, |
| 961 append=True) | 910 append=True) |
| 962 # Put default Chromedriver back in. | 911 # Put default Chromedriver back in. |
| 963 self.move_chrome_driver_if_needed('chrome') | 912 self.move_chrome_driver_if_needed('chrome') |
| 964 | 913 |
| 965 @staticmethod | 914 @staticmethod |
| 966 def get_dromaeo_url_query(browser, version): | 915 def get_dromaeo_url_query(browser, version): |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 | 1104 |
| 1156 self.style_and_save_perf_plot( | 1105 self.style_and_save_perf_plot( |
| 1157 'Compiled Dromaeo Sizes', | 1106 'Compiled Dromaeo Sizes', |
| 1158 'Size (in bytes)', 10, 10, 'lower left', '2' + png_filename, | 1107 'Size (in bytes)', 10, 10, 'lower left', '2' + png_filename, |
| 1159 ['commandline'], | 1108 ['commandline'], |
| 1160 ['dart', 'frog_dom', 'frog_html', 'frog_htmlidiomatic'], | 1109 ['dart', 'frog_dom', 'frog_html', 'frog_htmlidiomatic'], |
| 1161 [self.test.extra_metrics[0]]) | 1110 [self.test.extra_metrics[0]]) |
| 1162 | 1111 |
| 1163 class CompileTimeAndSizeTest(Test): | 1112 class CompileTimeAndSizeTest(Test): |
| 1164 """Run tests to determine how long frogc takes to compile, and the compiled | 1113 """Run tests to determine how long frogc takes to compile, and the compiled |
| 1165 file output size of some benchmarking files.""" | 1114 file output size of some benchmarking files. |
| 1115 Note: This test is now 'deprecated' since frog is no longer in the sdk. We |
| 1116 just return the last numbers found for frog.""" |
| 1166 def __init__(self, test_runner): | 1117 def __init__(self, test_runner): |
| 1167 """Reference to the test_runner object that notifies us when to begin | 1118 """Reference to the test_runner object that notifies us when to begin |
| 1168 testing.""" | 1119 testing.""" |
| 1169 super(CompileTimeAndSizeTest, self).__init__( | 1120 super(CompileTimeAndSizeTest, self).__init__( |
| 1170 self.name(), ['commandline'], ['frog'], ['swarm', 'total'], | 1121 self.name(), ['commandline'], ['frog'], ['swarm', 'total'], |
| 1171 test_runner, self.CompileTester(self), | 1122 test_runner, self.CompileTester(self), |
| 1172 self.CompileProcessor(self), self.CompileGrapher(self)) | 1123 self.CompileProcessor(self), self.CompileGrapher(self)) |
| 1173 self.dart_compiler = os.path.join( | 1124 self.dart_compiler = os.path.join( |
| 1174 DART_INSTALL_LOCATION, utils.GetBuildRoot(utils.GuessOS(), | 1125 DART_INSTALL_LOCATION, utils.GetBuildRoot(utils.GuessOS(), |
| 1175 'release', 'ia32'), 'dart-sdk', 'bin', 'frogc') | 1126 'release', 'ia32'), 'dart-sdk', 'bin', 'frogc') |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1188 class CompileTester(Tester): | 1139 class CompileTester(Tester): |
| 1189 def run_tests(self): | 1140 def run_tests(self): |
| 1190 os.chdir('frog') | 1141 os.chdir('frog') |
| 1191 self.test.trace_file = os.path.join( | 1142 self.test.trace_file = os.path.join( |
| 1192 '..', 'tools', 'testing', 'perf_testing', | 1143 '..', 'tools', 'testing', 'perf_testing', |
| 1193 self.test.result_folder_name, | 1144 self.test.result_folder_name, |
| 1194 self.test.result_folder_name + self.test.cur_time) | 1145 self.test.result_folder_name + self.test.cur_time) |
| 1195 | 1146 |
| 1196 self.add_svn_revision_to_trace(self.test.trace_file) | 1147 self.add_svn_revision_to_trace(self.test.trace_file) |
| 1197 | 1148 |
| 1198 self.test.test_runner.run_cmd( | |
| 1199 [self.test.dart_vm, 'frogc.dart', '--out=swarm-result', | |
| 1200 os.path.join('..', 'samples', 'swarm', 'swarm.dart')]) | |
| 1201 #os.path.join('..', 'internal', 'golem', 'benchmarks-dart2js', 'tests'
, | |
| 1202 #'samples-r6461', 'swarm', 'swarm.dart')]) | |
| 1203 | |
| 1204 swarm_size = 0 | 1149 swarm_size = 0 |
| 1205 try: | 1150 try: |
| 1206 swarm_size = os.path.getsize('swarm-result') | 1151 swarm_size = os.path.getsize('swarm-result') |
| 1207 except OSError: | 1152 except OSError: |
| 1208 pass #If compilation failed, continue on running other tests. | 1153 pass #If compilation failed, continue on running other tests. |
| 1209 | 1154 |
| 1210 self.test.test_runner.run_cmd( | |
| 1211 [self.test.dart_vm, 'frogc.dart', '--out=total-result', | |
| 1212 os.path.join('..', 'internal', 'golem', 'benchmarks-dart2js', 'tests', | |
| 1213 'samples-r6461', 'total', 'client', 'Total.dart')]) | |
| 1214 total_size = 0 | 1155 total_size = 0 |
| 1215 try: | 1156 try: |
| 1216 total_size = os.path.getsize('total-result') | 1157 total_size = os.path.getsize('total-result') |
| 1217 except OSError: | 1158 except OSError: |
| 1218 pass #If compilation failed, continue on running other tests. | 1159 pass #If compilation failed, continue on running other tests. |
| 1219 | 1160 |
| 1220 self.test.test_runner.run_cmd( | 1161 self.test.test_runner.run_cmd( |
| 1221 ['echo', '%d Generated checked swarm size' % swarm_size], | 1162 ['echo', '%d Generated checked swarm size' % swarm_size], |
| 1222 self.test.trace_file, append=True) | 1163 self.test.trace_file, append=True) |
| 1223 | 1164 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 while True: | 1258 while True: |
| 1318 if runner.has_new_code(): | 1259 if runner.has_new_code(): |
| 1319 runner.run_test_sequence() | 1260 runner.run_test_sequence() |
| 1320 else: | 1261 else: |
| 1321 time.sleep(200) | 1262 time.sleep(200) |
| 1322 else: | 1263 else: |
| 1323 runner.run_test_sequence() | 1264 runner.run_test_sequence() |
| 1324 | 1265 |
| 1325 if __name__ == '__main__': | 1266 if __name__ == '__main__': |
| 1326 main() | 1267 main() |
| OLD | NEW |