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

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

Issue 10006052: Further automation. Occasionaly we get a new svn server certificate, and we get (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 getpass 8 import getpass
9 import math 9 import math
10 try: 10 try:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 SLEEP_TIME = 200 67 SLEEP_TIME = 200
68 VERBOSE = False 68 VERBOSE = False
69 HAS_SHELL = False 69 HAS_SHELL = False
70 if platform.system() == 'Windows': 70 if platform.system() == 'Windows':
71 # On Windows, shell must be true to get the correct environment variables. 71 # On Windows, shell must be true to get the correct environment variables.
72 HAS_SHELL = True 72 HAS_SHELL = True
73 73
74 """First, some utility methods.""" 74 """First, some utility methods."""
75 75
76 def run_cmd(cmd_list, outfile=None, append=False): 76 def run_cmd(cmd_list, outfile=None, append=False, std_in=''):
77 """Run the specified command and print out any output to stdout. 77 """Run the specified command and print out any output to stdout.
78 78
79 Args: 79 Args:
80 cmd_list: a list of strings that make up the command to run 80 cmd_list: a list of strings that make up the command to run
81 outfile: a string indicating the name of the file that we should write 81 outfile: a string indicating the name of the file that we should write
82 stdout to 82 stdout to
83 append: True if we want to append to the file instead of overwriting it""" 83 append: True if we want to append to the file instead of overwriting it"""
84 if VERBOSE: 84 if VERBOSE:
85 print ' '.join(cmd_list) 85 print ' '.join(cmd_list)
86 out = subprocess.PIPE 86 out = subprocess.PIPE
87 if outfile: 87 if outfile:
88 mode = 'w' 88 mode = 'w'
89 if append: 89 if append:
90 mode = 'a' 90 mode = 'a'
91 out = open(outfile, mode) 91 out = open(outfile, mode)
92 if append: 92 if append:
93 # Annoying Windows "feature" -- append doesn't actually append unless you 93 # Annoying Windows "feature" -- append doesn't actually append unless you
94 # explicitly go to the end of the file. 94 # explicitly go to the end of the file.
95 # http://mail.python.org/pipermail/python-list/2009-October/1221859.html 95 # http://mail.python.org/pipermail/python-list/2009-October/1221859.html
96 out.seek(0, os.SEEK_END) 96 out.seek(0, os.SEEK_END)
97 p = subprocess.Popen(cmd_list, stdout = out, stderr = subprocess.PIPE, 97 p = subprocess.Popen(cmd_list, stdout = out, stderr=subprocess.PIPE,
98 shell=HAS_SHELL) 98 stdin=subprocess.PIPE, shell=HAS_SHELL)
99 output, not_used = p.communicate(); 99 output, not_used = p.communicate(std_in);
100 if output: 100 if output:
101 print output 101 print output
102 return output 102 return output
103 103
104 def time_cmd(cmd): 104 def time_cmd(cmd):
105 """Determine the amount of (real) time it takes to execute a given command.""" 105 """Determine the amount of (real) time it takes to execute a given command."""
106 start = time.time() 106 start = time.time()
107 run_cmd(cmd) 107 run_cmd(cmd)
108 return time.time() - start 108 return time.time() - start
109 109
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 dir_name: the directory we will create if it does not exist.""" 157 dir_name: the directory we will create if it does not exist."""
158 dir_path = os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', 158 dir_path = os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing',
159 'perf_testing', dir_name) 159 'perf_testing', dir_name)
160 if not os.path.exists(dir_path): 160 if not os.path.exists(dir_path):
161 os.mkdir(dir_path) 161 os.mkdir(dir_path)
162 print 'Creating output directory ', dir_path 162 print 'Creating output directory ', dir_path
163 163
164 def has_new_code(): 164 def has_new_code():
165 """Tests if there are any newer versions of files on the server.""" 165 """Tests if there are any newer versions of files on the server."""
166 os.chdir(DART_INSTALL_LOCATION) 166 os.chdir(DART_INSTALL_LOCATION)
167 results = run_cmd(['svn', 'st', '-u']) 167 # Pass 'p' in if we have a new certificate for the svn server, we want to
168 # (p)ermanently accept it.
169 results = run_cmd(['svn', 'st', '-u'], std_in='p')
168 for line in results: 170 for line in results:
169 if '*' in line: 171 if '*' in line:
170 return True 172 return True
171 return False 173 return False
172 174
173 # TODO(vsm): Add Dartium. 175 # TODO(vsm): Add Dartium.
174 def get_browsers(): 176 def get_browsers():
175 browsers = ['ff', 'chrome'] 177 browsers = ['ff', 'chrome']
176 if platform.system() == 'Darwin': 178 if platform.system() == 'Darwin':
177 browsers += ['safari'] 179 browsers += ['safari']
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 237
236 shutil.rmtree(os.path.join('appengine', 'static', 'graphs'), 238 shutil.rmtree(os.path.join('appengine', 'static', 'graphs'),
237 ignore_errors=True) 239 ignore_errors=True)
238 shutil.copytree('graphs', os.path.join('appengine', 'static', 'graphs')) 240 shutil.copytree('graphs', os.path.join('appengine', 'static', 'graphs'))
239 shutil.copyfile('index.html', os.path.join('appengine', 'static', 241 shutil.copyfile('index.html', os.path.join('appengine', 'static',
240 'index.html')) 242 'index.html'))
241 shutil.copyfile('dromaeo.html', os.path.join('appengine', 'static', 243 shutil.copyfile('dromaeo.html', os.path.join('appengine', 'static',
242 'dromaeo.html')) 244 'dromaeo.html'))
243 shutil.copyfile('data.html', os.path.join('appengine', 'static', 245 shutil.copyfile('data.html', os.path.join('appengine', 'static',
244 'data.html')) 246 'data.html'))
245 p = subprocess.Popen([os.path.join('..', '..', '..', 'third_party', 247 run_cmd([os.path.join('..', '..', '..', 'third_party',
246 'appengine-python', 'appcfg.py'), '--oauth2', 'update', 248 'appengine-python', 'appcfg.py'), '--oauth2', 'update',
247 'appengine/'], shell=HAS_SHELL, stdin=subprocess.PIPE) 249 'appengine/'])
248 p.communicate()
249 250
250 251
251 class TestRunner(object): 252 class TestRunner(object):
252 """The base class to provide shared code for different tests we will run and 253 """The base class to provide shared code for different tests we will run and
253 graph.""" 254 graph."""
254 255
255 def __init__(self, result_folder_name, platform_list, variants, 256 def __init__(self, result_folder_name, platform_list, variants,
256 values_list): 257 values_list):
257 """Args: 258 """Args:
258 result_folder_name the name of the folder where a tracefile of 259 result_folder_name the name of the folder where a tracefile of
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 while True: 981 while True:
981 if has_new_code(): 982 if has_new_code():
982 run_test_sequence(suites, no_build, graph_only, upload) 983 run_test_sequence(suites, no_build, graph_only, upload)
983 else: 984 else:
984 time.sleep(SLEEP_TIME) 985 time.sleep(SLEEP_TIME)
985 else: 986 else:
986 run_test_sequence(suites, no_build, graph_only, upload) 987 run_test_sequence(suites, no_build, graph_only, upload)
987 988
988 if __name__ == '__main__': 989 if __name__ == '__main__':
989 main() 990 main()
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