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

Side by Side Diff: tools/testing/perf_testing/run_perf_tests.py

Issue 10417025: Deal with different chromedrivers running on for Chrome and Dartium. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months 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
« no previous file with comments | « tools/get_drt.py ('k') | tools/testing/webdriver_test_setup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 return 'dromaeo' 835 return 'dromaeo'
836 836
837 def is_valid_combination(self, browser, version): 837 def is_valid_combination(self, browser, version):
838 # TODO(vsm): This avoids a bug in 32-bit Chrome (dartium) 838 # TODO(vsm): This avoids a bug in 32-bit Chrome (dartium)
839 # running JS dromaeo. 839 # running JS dromaeo.
840 if browser == 'dartium' and version == 'js': 840 if browser == 'dartium' and version == 'js':
841 return False 841 return False
842 return True 842 return True
843 843
844 class DromaeoPerfTester(DromaeoTester): 844 class DromaeoPerfTester(DromaeoTester):
845 def move_chrome_driver_if_needed(self, browser):
846 """Move the appropriate version of ChromeDriver onto the path.
847 TODO(efortuna): This is a total hack because the latest version of Chrome
848 (Dartium builds) requires a different version of ChromeDriver, that is
849 incompatible with the release or beta Chrome and vice versa. Remove these
850 shenanigans once we're back to both versions of Chrome using the same
851 version of ChromeDriver. IMPORTANT NOTE: This assumes your chromedriver is
852 in the default location (inside depot_tools).
853 """
854 current_dir = os.getcwd()
855 os.chdir(DART_INSTALL_LOCATION)
856 path = os.environ['PATH'].split(os.pathsep)
857 orig_chromedriver_path = os.path.join('tools', 'testing',
858 'orig-chromedriver')
859 dartium_chromedriver_path = os.path.join('tools', 'testing',
860 'dartium-chromedriver')
861 extension = ''
862 if platform.system() == 'Windows':
863 extension = '.exe'
864
865 def move_chromedriver(depot_tools, copy_to_depot_tools_dir=True,
866 from_path=None):
867 if from_path:
868 from_dir = from_path + extension
869 else:
870 from_dir = os.path.join(orig_chromedriver_path,
871 'chromedriver' + extension)
872 to_dir = os.path.join(depot_tools, 'chromedriver' + extension)
873 if not copy_to_depot_tools_dir:
874 tmp = to_dir
875 to_dir = from_dir
876 from_dir = tmp
877 print >> sys.stderr, from_dir
878 print >> sys.stderr, to_dir
879 if not os.path.exists(os.path.dirname(to_dir)):
880 os.makedirs(os.path.dirname(to_dir))
881 shutil.copyfile(from_dir, to_dir)
882
883 for loc in path:
884 if 'depot_tools' in loc:
885 if browser == 'chrome':
886 if os.path.exists(orig_chromedriver_path):
887 move_chromedriver(loc)
888 elif browser == 'dartium':
889 if not os.path.exists(dartium_chromedriver_path):
890 self.test.test_runner.run_cmd(['python',
891 os.path.join('tools', 'get_drt.py'), '--chromedriver'])
892 # Move original chromedriver for storage.
893 if not os.path.exists(orig_chromedriver_path):
894 move_chromedriver(loc, copy_to_depot_tools_dir=False)
895 # Copy Dartium chromedriver into depot_tools
896 move_chromedriver(loc, from_path=os.path.join(
897 dartium_chromedriver_path, 'chromedriver'))
898 os.chdir(current_dir)
899
845 def run_tests(self): 900 def run_tests(self):
846 """Run dromaeo in the browser.""" 901 """Run dromaeo in the browser."""
847 902
848 # Build tests. 903 # Build tests.
849 dromaeo_path = os.path.join('samples', 'third_party', 'dromaeo') 904 dromaeo_path = os.path.join('samples', 'third_party', 'dromaeo')
850 current_path = os.getcwd() 905 current_path = os.getcwd()
851 os.chdir(dromaeo_path) 906 os.chdir(dromaeo_path)
852 self.test.test_runner.run_cmd(['python', 'generate_frog_tests.py']) 907 self.test.test_runner.run_cmd(['python', 'generate_frog_tests.py'])
853 os.chdir(current_path) 908 os.chdir(current_path)
854 909
855 versions = DromaeoTester.get_dromaeo_versions() 910 versions = DromaeoTester.get_dromaeo_versions()
856 911
857 for browser in BrowserTester.get_browsers(): 912 for browser in BrowserTester.get_browsers():
913 self.move_chrome_driver_if_needed(browser)
858 for version_name in versions: 914 for version_name in versions:
859 if not self.test.is_valid_combination(browser, version_name): 915 if not self.test.is_valid_combination(browser, version_name):
860 continue 916 continue
861 version = DromaeoTest.DromaeoPerfTester.get_dromaeo_url_query( 917 version = DromaeoTest.DromaeoPerfTester.get_dromaeo_url_query(
862 browser, version_name) 918 browser, version_name)
863 self.test.trace_file = os.path.join( 919 self.test.trace_file = os.path.join(
864 'tools', 'testing', 'perf_testing', self.test.result_folder_name, 920 'tools', 'testing', 'perf_testing', self.test.result_folder_name,
865 'dromaeo-%s-%s-%s' % (self.test.cur_time, browser, version_name)) 921 'dromaeo-%s-%s-%s' % (self.test.cur_time, browser, version_name))
866 self.add_svn_revision_to_trace(self.test.trace_file, browser) 922 self.add_svn_revision_to_trace(self.test.trace_file, browser)
867 file_path = '"%s"' % os.path.join(os.getcwd(), dromaeo_path, 923 file_path = '"%s"' % os.path.join(os.getcwd(), dromaeo_path,
868 'index-js.html?%s' % version) 924 'index-js.html?%s' % version)
869 self.test.test_runner.run_cmd( 925 self.test.test_runner.run_cmd(
870 ['python', os.path.join('tools', 'testing', 'run_selenium.py'), 926 ['python', os.path.join('tools', 'testing', 'run_selenium.py'),
871 '--out', file_path, '--browser', browser, 927 '--out', file_path, '--browser', browser,
872 '--timeout', '900', '--mode', 'dromaeo'], self.test.trace_file, 928 '--timeout', '900', '--mode', 'dromaeo'], self.test.trace_file,
873 append=True) 929 append=True)
930 # Put default Chromedriver back in.
931 self.move_chrome_driver_if_needed('chrome')
874 932
875 @staticmethod 933 @staticmethod
876 def get_dromaeo_url_query(browser, version): 934 def get_dromaeo_url_query(browser, version):
877 if browser == 'dartium': 935 if browser == 'dartium':
878 version = version.replace('frog', 'dart') 936 version = version.replace('frog', 'dart')
879 version = version.replace('_','&') 937 version = version.replace('_','&')
880 tags = DromaeoTester.get_valid_dromaeo_tags() 938 tags = DromaeoTester.get_valid_dromaeo_tags()
881 return '|'.join([ '%s&%s' % (version, tag) for tag in tags]) 939 return '|'.join([ '%s&%s' % (version, tag) for tag in tags])
882 940
883 941
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 while True: 1285 while True:
1228 if runner.has_new_code(): 1286 if runner.has_new_code():
1229 runner.run_test_sequence() 1287 runner.run_test_sequence()
1230 else: 1288 else:
1231 time.sleep(200) 1289 time.sleep(200)
1232 else: 1290 else:
1233 runner.run_test_sequence() 1291 runner.run_test_sequence()
1234 1292
1235 if __name__ == '__main__': 1293 if __name__ == '__main__':
1236 main() 1294 main()
OLDNEW
« no previous file with comments | « tools/get_drt.py ('k') | tools/testing/webdriver_test_setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698