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

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

Issue 9181006: Changed automated testing to run test.dart instead of test.py (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « no previous file | no next file » | 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) 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 math 8 import math
9 try: 9 try:
10 from matplotlib.font_manager import FontProperties 10 from matplotlib.font_manager import FontProperties
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if output: 72 if output:
73 print output 73 print output
74 return output 74 return output
75 75
76 def time_cmd(cmd): 76 def time_cmd(cmd):
77 """Determine the amount of (real) time it takes to execute a given command.""" 77 """Determine the amount of (real) time it takes to execute a given command."""
78 start = time.time() 78 start = time.time()
79 run_cmd(cmd) 79 run_cmd(cmd)
80 return time.time() - start 80 return time.time() - start
81 81
82 def sync_and_build(failed_once=False): 82 def sync_and_build():
83 """Make sure we have the latest version of of the repo, and build it. We 83 """Make sure we have the latest version of of the repo, and build it. We
84 begin and end standing in DART_INSTALL_LOCATION. 84 begin and end standing in DART_INSTALL_LOCATION.
85 Args:
86 failed_once True if we have attempted to build this once before, and we've
87 failed, indicating the build is broken.
88 Returns: 85 Returns:
89 err_code = 1 if there was a problem building two times in a row.""" 86 err_code = 1 if there was a problem building."""
90 os.chdir(DART_INSTALL_LOCATION) 87 os.chdir(DART_INSTALL_LOCATION)
91 #Revert our newly built minfrog to prevent conflicts when we update 88 #Revert our newly built minfrog to prevent conflicts when we update
92 run_cmd(['svn', 'revert', os.path.join(os.getcwd(), 'frog', 'minfrog')]) 89 run_cmd(['svn', 'revert', os.path.join(os.getcwd(), 'frog', 'minfrog')])
93 90
94 run_cmd(['gclient', 'sync']) 91 run_cmd(['gclient', 'sync'])
95 # TODO(efortuna): building the sdk locally is a band-aid until all build 92 # TODO(efortuna): building the sdk locally is a band-aid until all build
96 # platform SDKs are hosted in Google storage. Pull from https://sandbox. 93 # platform SDKs are hosted in Google storage. Pull from https://sandbox.
97 # google.com/storage/?arg=dart-dump-render-tree#dart-dump-render-tree%2Fsdk 94 # google.com/storage/?arg=dart-dump-render-tree#dart-dump-render-tree%2Fsdk
98 # eventually. 95 # eventually.
99 # TODO(efortuna): Currently always building ia32 architecture because we don't 96 # TODO(efortuna): Currently always building ia32 architecture because we don't
100 # have test statistics for what's passing on x64. Eliminate arch specification 97 # have test statistics for what's passing on x64. Eliminate arch specification
101 # when we have tests running on x64, too. 98 # when we have tests running on x64, too.
99 shutil.rmtree(os.path.join(os.getcwd(),
100 utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32')))
102 lines = run_cmd([os.path.join('.', 'tools', 'build.py'), '-m', 'release', 101 lines = run_cmd([os.path.join('.', 'tools', 'build.py'), '-m', 'release',
103 '--arch=ia32', 'create_sdk']) 102 '--arch=ia32', 'create_sdk'])
104 103
105 for line in lines: 104 for line in lines:
106 if 'BUILD FAILED' in lines: 105 if 'BUILD FAILED' in lines:
107 if failed_once: 106 # Someone checked in a broken build! Just stop trying to make it work
108 # Someone checked in a broken build! Just stop trying to make it work 107 # and wait to try again.
109 # and wait to try again. 108 print 'Broken Build'
110 print 'Broken Build' 109 return 1
111 return 1
112 #Remove the output directory and attempt to build again. If it still
113 #fails, abort, and try again in a little bit.
114 shutil.rmtree(os.path.join(os.getcwd(),
115 utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32')))
116 sync_and_build(True)
117 return 0 110 return 0
118 111
119 def ensure_output_directory(dir_name): 112 def ensure_output_directory(dir_name):
120 """Test that the listed directory name exists, and if not, create one for 113 """Test that the listed directory name exists, and if not, create one for
121 our output to be placed. 114 our output to be placed.
122 Args: 115 Args:
123 dir_name the directory we will create if it does not exist.""" 116 dir_name the directory we will create if it does not exist."""
124 dir_path = os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', 117 dir_path = os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing',
125 'perf_testing', dir_name) 118 'perf_testing', dir_name)
126 if not os.path.exists(dir_path): 119 if not os.path.exists(dir_path):
(...skipping 26 matching lines...) Expand all
153 146
154 def get_benchmarks(): 147 def get_benchmarks():
155 if not PERFBOT_MODE: 148 if not PERFBOT_MODE:
156 return ['Smoketest'] 149 return ['Smoketest']
157 else: 150 else:
158 return ['Mandelbrot', 'DeltaBlue', 'Richards', 'NBody', 'BinaryTrees', 151 return ['Mandelbrot', 'DeltaBlue', 'Richards', 'NBody', 'BinaryTrees',
159 'Fannkuch', 'Meteor', 'BubbleSort', 'Fibonacci', 'Loop', 'Permute', 152 'Fannkuch', 'Meteor', 'BubbleSort', 'Fibonacci', 'Loop', 'Permute',
160 'Queens', 'QuickSort', 'Recurse', 'Sieve', 'Sum', 'Tak', 'Takl', 'Towers', 153 'Queens', 'QuickSort', 'Recurse', 'Sieve', 'Sum', 'Tak', 'Takl', 'Towers',
161 'TreeSort'] 154 'TreeSort']
162 155
156 def get_os_directory():
157 """Specifies the name of the directory for the testing build of dart, which
158 has yet a different naming convention from utils.getBuildRoot(...)."""
159 if platform.system() == 'Windows':
160 return 'windows'
161 elif platform.system() == 'Darwin':
162 return 'macos'
163 else:
164 return 'linux'
165
163 def upload_to_app_engine(): 166 def upload_to_app_engine():
164 """Upload our results to our appengine server.""" 167 """Upload our results to our appengine server."""
165 # TODO(efortuna): This is the most basic way to get the data up 168 # TODO(efortuna): This is the most basic way to get the data up
166 # for others to view. Revisit this once we're serving nicer graphs (Google 169 # for others to view. Revisit this once we're serving nicer graphs (Google
167 # Chart Tools) and from multiple perfbots and once we're in a position to 170 # Chart Tools) and from multiple perfbots and once we're in a position to
168 # organize the data in a useful manner(!!). 171 # organize the data in a useful manner(!!).
169 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', 172 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing',
170 'perf_testing')) 173 'perf_testing'))
171 shutil.rmtree(os.path.join('appengine', 'static', 'graphs'), 174 shutil.rmtree(os.path.join('appengine', 'static', 'graphs'),
172 ignore_errors=True) 175 ignore_errors=True)
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 526
524 527
525 class BrowserCorrectnessTestRunner(TestRunner): 528 class BrowserCorrectnessTestRunner(TestRunner):
526 def __init__(self, test_type, result_folder_name): 529 def __init__(self, test_type, result_folder_name):
527 super(BrowserCorrectnessTestRunner, self).__init__(result_folder_name, 530 super(BrowserCorrectnessTestRunner, self).__init__(result_folder_name,
528 get_browsers(), [FROG], [CORRECTNESS]) 531 get_browsers(), [FROG], [CORRECTNESS])
529 self.test_type = test_type 532 self.test_type = test_type
530 533
531 def run_tests(self): 534 def run_tests(self):
532 """run a test of the latest svn revision.""" 535 """run a test of the latest svn revision."""
536 the_os = get_os_directory()
Siggi Cherem (dart-lang) 2012/01/11 01:32:07 the_os => arch?
Emily Fortuna 2012/01/11 01:38:06 The directories returned are either "linux" "macos
Siggi Cherem (dart-lang) 2012/01/11 01:39:23 'the_' looks strange, that's all...
537 suffix = ''
538 if platform.system() == 'Windows':
539 suffix = '.exe'
533 for browser in get_browsers(): 540 for browser in get_browsers():
534 current_file = 'correctness%s-%s' % (self.cur_time, browser) 541 current_file = 'correctness%s-%s' % (self.cur_time, browser)
535 self.trace_file = os.path.join('tools', 'testing', 542 self.trace_file = os.path.join('tools', 'testing',
536 'perf_testing', self.result_folder_name, current_file) 543 'perf_testing', self.result_folder_name, current_file)
537 self.add_svn_revision_to_trace(self.trace_file) 544 self.add_svn_revision_to_trace(self.trace_file)
538 dart_sdk = os.path.join(os.getcwd(), utils.GetBuildRoot(utils.GuessOS(), 545 dart_sdk = os.path.join(os.getcwd(), utils.GetBuildRoot(utils.GuessOS(),
539 'release', 'ia32'), 'dart-sdk') 546 'release', 'ia32'), 'dart-sdk')
540 run_cmd([os.path.join('.', 'tools', 'test.py'), 547 run_cmd([os.path.join('.', 'tools', 'testing', 'bin', the_os,
541 '--component=webdriver', '--flag=%s' % browser, '--flag=--frog=%s' % \ 548 'dart' + suffix), os.path.join('tools', 'test.dart'),
542 os.path.join(dart_sdk, 'bin', 'frogc'), '--report', 549 '--component=webdriver', '--flag=%s,--frog=%s,--froglib=%s' % \
543 '--flag=--froglib=%s' % os.path.join(dart_sdk, 'lib'), 550 (browser, os.path.join(dart_sdk, 'bin', 'frogc'),
551 os.path.join(dart_sdk, 'lib')), '--report',
544 '--timeout=20', '--progress=color', '--mode=release', '-j1', 552 '--timeout=20', '--progress=color', '--mode=release', '-j1',
545 self.test_type], self.trace_file, append=True) 553 self.test_type], self.trace_file, append=True)
546 554
547 def process_file(self, afile): 555 def process_file(self, afile):
548 """Given a trace file, extract all the relevant information out of it to 556 """Given a trace file, extract all the relevant information out of it to
549 determine the number of correctly passing tests. 557 determine the number of correctly passing tests.
550 558
551 Arguments: 559 Arguments:
552 afile the filename string""" 560 afile the filename string"""
553 browser = afile.rpartition('-')[2] 561 browser = afile.rpartition('-')[2]
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 if has_new_code(): 762 if has_new_code():
755 run_test_sequence(cl, size, language, perf) 763 run_test_sequence(cl, size, language, perf)
756 else: 764 else:
757 time.sleep(SLEEP_TIME) 765 time.sleep(SLEEP_TIME)
758 else: 766 else:
759 run_test_sequence(cl, size, language, perf) 767 run_test_sequence(cl, size, language, perf)
760 768
761 if __name__ == '__main__': 769 if __name__ == '__main__':
762 main() 770 main()
763 771
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698