Chromium Code Reviews| Index: scripts/slave/runtest.py |
| =================================================================== |
| --- scripts/slave/runtest.py (revision 132640) |
| +++ scripts/slave/runtest.py (working copy) |
| @@ -171,6 +171,21 @@ |
| (e, output_dir)) |
| return http_server |
| +def start_wpr_server(test_exe_path): |
| + """Start Web Page Replay server. |
| + |
| + WPR makes it easy to record all the resources for a web page and serve |
| + that page with a simulated network. |
| + """ |
| + import google.webpagereplay_utils |
|
cmp
2012/04/18 20:37:22
it seems like sys.path needs to be manipulated so
slamm_google
2012/04/18 20:42:55
Line 31 does that manipulation:
sys.path.insert
cmp_google
2012/04/18 20:47:15
Thanks, I didn't see that.
|
| + test_exe_name = os.path.splitext(os.path.basename(test_exe_path))[0] |
| + paths = google.webpagereplay_utils.ChromiumPaths( |
| + TEST_EXE_NAME=test_exe_name, TEST_NAME='2012Q2') |
| + wpr_server = google.webpagereplay_utils.ReplayLauncher( |
| + paths['replay'], paths['.wpr'], paths['logs'], ['--no-dns_forwarding']) |
| + wpr_server.StartServer() |
| + return wpr_server |
| + |
| def main_mac(options, args): |
| if len(args) < 1: |
| raise chromium_utils.MissingArgument('Usage: %s' % USAGE) |
| @@ -233,10 +248,13 @@ |
| try: |
| http_server = None |
| + webpagereplay_server = None |
| if options.document_root: |
| http_server = start_http_server('mac', build_dir=build_dir, |
| test_exe_path=test_exe_path, |
| document_root=options.document_root) |
| + if options.enable_wpr: |
| + webpagereplay_server = start_wpr_server(test_exe_path) |
| if options.factory_properties.get('asan', False): |
| symbolize = os.path.abspath(os.path.join('src', 'third_party', 'asan', |
| 'scripts', 'asan_symbolize.py')) |
| @@ -247,6 +265,8 @@ |
| finally: |
| if http_server: |
| http_server.StopServer() |
| + if webpagereplay_server: |
| + webpagereplay_server.StopServer() |
| if options.generate_json_file: |
| _GenerateJSONForTestResults(options, results_tracker) |
| @@ -353,10 +373,13 @@ |
| try: |
| http_server = None |
| + webpagereplay_server = None |
| if options.document_root: |
| http_server = start_http_server('linux', build_dir=build_dir, |
| test_exe_path=test_exe_path, |
| document_root=options.document_root) |
| + if options.enable_wpr: |
| + webpagereplay_server = start_wpr_server(test_exe_path) |
| if options.xvfb: |
| xvfb.StartVirtualX( |
| slave_name, bin_dir, |
| @@ -372,6 +395,8 @@ |
| finally: |
| if http_server: |
| http_server.StopServer() |
| + if webpagereplay_server: |
| + webpagereplay_server.StopServer() |
| if options.xvfb: |
| xvfb.StopVirtualX(slave_name) |
| @@ -484,6 +509,10 @@ |
| default=None, metavar='DOC_ROOT', |
| help='Start a local httpd server using the given ' |
| 'document root, relative to the current dir') |
| + option_parser.add_option('', '--enable-wpr', action='store_true', |
| + default=False, |
| + help='Start the given Web Page Replay server using ' |
| + 'the httpd document root as the archive root.') |
| option_parser.add_option('', '--total-shards', dest='total_shards', |
| default=None, type="int", |
| help='Number of shards to split this test into.') |