OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2010 Google Inc. All Rights Reserved. | 2 # Copyright 2010 Google Inc. All Rights Reserved. |
3 # | 3 # |
4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
7 # | 7 # |
8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
9 # | 9 # |
10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 # The location of the Replay script | 49 # The location of the Replay script |
50 REPLAY_PATH = '../replay.py' | 50 REPLAY_PATH = '../replay.py' |
51 | 51 |
52 # The name of the application we're using | 52 # The name of the application we're using |
53 BENCHMARK_APPLICATION_NAME = 'perftracker' | 53 BENCHMARK_APPLICATION_NAME = 'perftracker' |
54 | 54 |
55 # The location of the PerfTracker extension | 55 # The location of the PerfTracker extension |
56 PERFTRACKER_EXTENSION_PATH = './extension' | 56 PERFTRACKER_EXTENSION_PATH = './extension' |
57 | 57 |
58 # The server_port is the port which runs the webserver to test against. | 58 # The server_port is the port which runs the webserver to test against. |
59 SERVER_PORT = 8000 | 59 SERVER_PORT = 7171 |
| 60 SERVER_PORT_SSL = 7172 |
60 | 61 |
61 # For SPDY testing, where we have both a frontend and backend server, | 62 # For SPDY testing, where we have both a frontend and backend server, |
62 # this is the port to run the backend server. | 63 # this is the port to run the backend server. |
63 BACKEND_SERVER_PORT = 8001 | 64 BACKEND_SERVER_PORT = 7173 |
64 | 65 |
65 | 66 |
66 def DoAppEngineLogin(username, password): | 67 def DoAppEngineLogin(username, password): |
67 """Log into the Google AppEngine app. | 68 """Log into the Google AppEngine app. |
68 | 69 |
69 This code credit to: http://dalelane.co.uk/blog/?p=303 | 70 This code credit to: http://dalelane.co.uk/blog/?p=303 |
70 """ | 71 """ |
71 target_authenticated_url = runner_cfg.appengine_url | 72 target_authenticated_url = runner_cfg.appengine_url |
72 | 73 |
73 # We use a cookie to authenticate with Google App Engine by registering a | 74 # We use a cookie to authenticate with Google App Engine by registering a |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 port = BACKEND_SERVER_PORT | 308 port = BACKEND_SERVER_PORT |
308 init_cwnd = 32 | 309 init_cwnd = 32 |
309 | 310 |
310 if protocol == 'http-base': | 311 if protocol == 'http-base': |
311 init_cwnd = 3 # See RFC3390 | 312 init_cwnd = 3 # See RFC3390 |
312 | 313 |
313 cmdline = [ | 314 cmdline = [ |
314 REPLAY_PATH, | 315 REPLAY_PATH, |
315 '--no-dns_forwarding', | 316 '--no-dns_forwarding', |
316 '--port', str(port), | 317 '--port', str(port), |
| 318 '--ssl_port', str(SERVER_PORT_SSL), |
317 '--shaping_port', str(SERVER_PORT), | 319 '--shaping_port', str(SERVER_PORT), |
318 '--log_level', self.log_level, | 320 '--log_level', self.log_level, |
319 '--init_cwnd', str(init_cwnd), | 321 '--init_cwnd', str(init_cwnd), |
| 322 '--use_closest_match', |
320 ] | 323 ] |
321 if self.cache_miss_file: | 324 if self.cache_miss_file: |
322 cmdline += ['-e', self.cache_miss_file] | 325 cmdline += ['-e', self.cache_miss_file] |
323 if self.use_closest_match: | 326 if self.use_closest_match: |
324 cmdline += ['--use_closest_match'] | 327 cmdline += ['--use_closest_match'] |
325 if self.use_server_delay: | 328 if self.use_server_delay: |
326 cmdline += ['--use_server_delay'] | 329 cmdline += ['--use_server_delay'] |
327 if not self.use_deterministic_script: | 330 if not self.use_deterministic_script: |
328 cmdline += ['--inject_scripts='] | 331 cmdline += ['--inject_scripts='] |
329 if self.log_file: | 332 if self.log_file: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 use_virtualx = True | 419 use_virtualx = True |
417 if os.getuid() == 0: | 420 if os.getuid() == 0: |
418 user_uid = int(os.getenv('SUDO_UID')) | 421 user_uid = int(os.getenv('SUDO_UID')) |
419 switch_away_from_root = lambda: os.setuid(user_uid) | 422 switch_away_from_root = lambda: os.setuid(user_uid) |
420 os.chown(profile_dir, user_uid, -1) | 423 os.chown(profile_dir, user_uid, -1) |
421 | 424 |
422 try: | 425 try: |
423 if use_virtualx: | 426 if use_virtualx: |
424 StartVirtualX(platform.node(), '/tmp') | 427 StartVirtualX(platform.node(), '/tmp') |
425 | 428 |
426 server_host_port_pair = '127.0.0.1:%s' % SERVER_PORT | |
427 cmdline = [ | 429 cmdline = [ |
428 runner_cfg.chrome_path, | 430 runner_cfg.chrome_path, |
429 '--activate-on-launch', | 431 '--activate-on-launch', |
430 '--disable-background-networking', | 432 '--disable-background-networking', |
431 # Stop the translate bar from appearing at the top of the page. When | 433 # Stop the translate bar from appearing at the top of the page. When |
432 # it's there, the screenshots are shorter than they should be. | 434 # it's there, the screenshots are shorter than they should be. |
433 '--disable-translate', | 435 '--disable-translate', |
434 | 436 |
435 '--enable-benchmarking', | 437 '--enable-benchmarking', |
436 '--enable-experimental-extension-apis', | 438 '--enable-experimental-extension-apis', |
437 '--enable-logging', | 439 '--enable-logging', |
438 '--enable-stats-table', | 440 '--enable-stats-table', |
439 '--host-resolver-rules=MAP * %s,EXCLUDE %s' % ( | 441 '--host-resolver-rules=MAP * 127.0.0.1,EXCLUDE %s' % ( |
440 server_host_port_pair, runner_cfg.appengine_host), | 442 runner_cfg.appengine_host), |
441 '--ignore-certificate-errors', | 443 '--ignore-certificate-errors', |
442 '--load-extension=' + PERFTRACKER_EXTENSION_PATH, | 444 '--load-extension=' + PERFTRACKER_EXTENSION_PATH, |
443 '--log-level=0', | 445 '--log-level=0', |
444 '--no-first-run', | 446 '--no-first-run', |
445 '--no-proxy-server', | 447 '--no-proxy-server', |
446 '--start-maximized', | 448 '--start-maximized', |
| 449 '--testing-fixed-http-port=' + str(SERVER_PORT), |
| 450 '--testing-fixed-https-port=' + str(SERVER_PORT_SSL), |
447 '--user-data-dir=' + profile_dir, | 451 '--user-data-dir=' + profile_dir, |
448 ] | 452 ] |
449 if self.use_chrome_deterministic_js: | 453 if self.use_chrome_deterministic_js: |
450 cmdline += ['--no-js-randomness'] | 454 cmdline += ['--no-js-randomness'] |
451 if self.cache_miss_file: | 455 if self.cache_miss_file: |
452 cmdline += ['--no-sandbox'] | 456 cmdline += ['--no-sandbox'] |
453 | 457 |
454 spdy_mode = None | 458 spdy_mode = None |
455 if self.network['protocol'] == 'spdy': | 459 if self.network['protocol'] == 'spdy': |
456 spdy_mode = 'ssl' | 460 spdy_mode = 'ssl' |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 if options.do_record: | 655 if options.do_record: |
652 logging.debug("Running on record mode") | 656 logging.debug("Running on record mode") |
653 options.record = runner_cfg.replay_data_archive | 657 options.record = runner_cfg.replay_data_archive |
654 main(options, options.cache_miss_file) | 658 main(options, options.cache_miss_file) |
655 options.do_record = False | 659 options.do_record = False |
656 | 660 |
657 options.record = None | 661 options.record = None |
658 # run the replay round | 662 # run the replay round |
659 logging.debug("Running on replay mode") | 663 logging.debug("Running on replay mode") |
660 sys.exit(main(options, options.cache_miss_file)) | 664 sys.exit(main(options, options.cache_miss_file)) |
OLD | NEW |