OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Copyright 2009 Google Inc. All Rights Reserved. | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
4 | 5 |
5 """Dromaeo benchmark automation script. | 6 """Dromaeo benchmark automation script. |
6 | 7 |
7 Script runs dromaeo tests in browsers specified by --browser switch and saves | 8 Script runs dromaeo tests in browsers specified by --browser switch and saves |
8 results to a spreadsheet on docs.google.com. | 9 results to a spreadsheet on docs.google.com. |
9 | 10 |
10 Prerequisites: | 11 Prerequisites: |
11 1. Install Google Data APIs Python Client Library from | 12 1. Install Google Data APIs Python Client Library from |
12 http://code.google.com/p/gdata-python-client. | 13 http://code.google.com/p/gdata-python-client. |
13 2. Checkout Dromaeo benchmark from | 14 2. Checkout Dromaeo benchmark from |
(...skipping 27 matching lines...) Expand all Loading... |
41 import time | 42 import time |
42 import urlparse | 43 import urlparse |
43 from optparse import OptionParser | 44 from optparse import OptionParser |
44 from BaseHTTPServer import HTTPServer | 45 from BaseHTTPServer import HTTPServer |
45 import SimpleHTTPServer | 46 import SimpleHTTPServer |
46 import gdata.spreadsheet.service | 47 import gdata.spreadsheet.service |
47 | 48 |
48 max_spreadsheet_columns = 20 | 49 max_spreadsheet_columns = 20 |
49 test_props = ['mean', 'error'] | 50 test_props = ['mean', 'error'] |
50 | 51 |
| 52 |
51 def ParseArguments(): | 53 def ParseArguments(): |
52 parser = OptionParser() | 54 parser = OptionParser() |
53 parser.add_option("-b", "--browser", | 55 parser.add_option("-b", "--browser", |
54 action="append", dest="browsers", | 56 action="append", dest="browsers", |
55 help="list of browsers to test") | 57 help="list of browsers to test") |
56 parser.add_option("-n", "--run_count", dest="run_count", type="int", | 58 parser.add_option("-n", "--run_count", dest="run_count", type="int", |
57 default=5, help="number of runs") | 59 default=5, help="number of runs") |
58 parser.add_option("-d", "--dromaeo_home", dest="dromaeo_home", | 60 parser.add_option("-d", "--dromaeo_home", dest="dromaeo_home", |
59 help="directory with your dromaeo files") | 61 help="directory with your dromaeo files") |
60 parser.add_option("-p", "--port", dest="port", type="int", | 62 parser.add_option("-p", "--port", dest="port", type="int", |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 benchmark_results.ProcessBrowserPostData(server.post_data) | 252 benchmark_results.ProcessBrowserPostData(server.post_data) |
251 # Kill browser. | 253 # Kill browser. |
252 KillProcessByName(browser) | 254 KillProcessByName(browser) |
253 browser_process.wait() | 255 browser_process.wait() |
254 | 256 |
255 # Insert test results into spreadsheet. | 257 # Insert test results into spreadsheet. |
256 for (test_name, test_data) in benchmark_results.data.iteritems(): | 258 for (test_name, test_data) in benchmark_results.data.iteritems(): |
257 spreadsheet_writer.WriteBrowserBenchmarkResults(test_name, test_data) | 259 spreadsheet_writer.WriteBrowserBenchmarkResults(test_name, test_data) |
258 | 260 |
259 server.socket.close() | 261 server.socket.close() |
| 262 return 0 |
| 263 |
260 | 264 |
261 if __name__ == '__main__': | 265 if __name__ == '__main__': |
262 main() | 266 sys.exit(main()) |
263 | |
OLD | NEW |