| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import glob | 6 import glob |
| 7 import optparse | 7 import optparse |
| 8 import os.path | 8 import os.path |
| 9 import socket | 9 import socket |
| 10 import sys | 10 import sys |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 help='Enable/disable PPAPI Dev interfaces while testing.') | 124 help='Enable/disable PPAPI Dev interfaces while testing.') |
| 125 parser.add_option('--nacl_exe_stdin', dest='nacl_exe_stdin', | 125 parser.add_option('--nacl_exe_stdin', dest='nacl_exe_stdin', |
| 126 type='string', default=None, | 126 type='string', default=None, |
| 127 help='Redirect standard input of NaCl executable.') | 127 help='Redirect standard input of NaCl executable.') |
| 128 parser.add_option('--nacl_exe_stdout', dest='nacl_exe_stdout', | 128 parser.add_option('--nacl_exe_stdout', dest='nacl_exe_stdout', |
| 129 type='string', default=None, | 129 type='string', default=None, |
| 130 help='Redirect standard output of NaCl executable.') | 130 help='Redirect standard output of NaCl executable.') |
| 131 parser.add_option('--nacl_exe_stderr', dest='nacl_exe_stderr', | 131 parser.add_option('--nacl_exe_stderr', dest='nacl_exe_stderr', |
| 132 type='string', default=None, | 132 type='string', default=None, |
| 133 help='Redirect standard error of NaCl executable.') | 133 help='Redirect standard error of NaCl executable.') |
| 134 parser.add_option('--expect_browser_process_crash', |
| 135 dest='expect_browser_process_crash', |
| 136 action='store_true', |
| 137 help='Do not signal a failure if the browser process ' |
| 138 'crashes') |
| 134 | 139 |
| 135 return parser | 140 return parser |
| 136 | 141 |
| 137 | 142 |
| 138 def ProcessToolLogs(options, logs_dir): | 143 def ProcessToolLogs(options, logs_dir): |
| 139 if options.tool == 'memcheck': | 144 if options.tool == 'memcheck': |
| 140 analyzer = memcheck_analyze.MemcheckAnalyzer('', use_gdb=True) | 145 analyzer = memcheck_analyze.MemcheckAnalyzer('', use_gdb=True) |
| 141 logs_wildcard = 'xml.*' | 146 logs_wildcard = 'xml.*' |
| 142 elif options.tool == 'tsan': | 147 elif options.tool == 'tsan': |
| 143 analyzer = tsan_analyze.TsanAnalyzer('', use_gdb=True) | 148 analyzer = tsan_analyze.TsanAnalyzer('', use_gdb=True) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 249 |
| 245 tool_failed = False | 250 tool_failed = False |
| 246 time_started = time.time() | 251 time_started = time.time() |
| 247 | 252 |
| 248 def HardTimeout(total_time): | 253 def HardTimeout(total_time): |
| 249 return total_time >= 0.0 and time.time() - time_started >= total_time | 254 return total_time >= 0.0 and time.time() - time_started >= total_time |
| 250 | 255 |
| 251 try: | 256 try: |
| 252 while server.test_in_progress or options.interactive: | 257 while server.test_in_progress or options.interactive: |
| 253 if not browser.IsRunning(): | 258 if not browser.IsRunning(): |
| 259 if options.expect_browser_process_crash: |
| 260 break |
| 254 listener.ServerError('Browser process ended during test ' | 261 listener.ServerError('Browser process ended during test ' |
| 255 '(return code %r)' % browser.GetReturnCode()) | 262 '(return code %r)' % browser.GetReturnCode()) |
| 256 # If Chrome exits prematurely without making a single request to the | 263 # If Chrome exits prematurely without making a single request to the |
| 257 # web server, this is probally a Chrome crash-on-launch bug not related | 264 # web server, this is probally a Chrome crash-on-launch bug not related |
| 258 # to the test at hand. Retry, unless we're in interactive mode. In | 265 # to the test at hand. Retry, unless we're in interactive mode. In |
| 259 # interactive mode the user may manually close the browser, so don't | 266 # interactive mode the user may manually close the browser, so don't |
| 260 # retry (it would just be annoying.) | 267 # retry (it would just be annoying.) |
| 261 if not server.received_request and not options.interactive: | 268 if not server.received_request and not options.interactive: |
| 262 raise RetryTest('Chrome failed to launch.') | 269 raise RetryTest('Chrome failed to launch.') |
| 263 else: | 270 else: |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 # Validate the URL | 349 # Validate the URL |
| 343 url = options.url | 350 url = options.url |
| 344 if url is None: | 351 if url is None: |
| 345 parser.error('Must specify a URL') | 352 parser.error('Must specify a URL') |
| 346 | 353 |
| 347 return Run(url, options) | 354 return Run(url, options) |
| 348 | 355 |
| 349 | 356 |
| 350 if __name__ == '__main__': | 357 if __name__ == '__main__': |
| 351 sys.exit(RunFromCommandLine()) | 358 sys.exit(RunFromCommandLine()) |
| OLD | NEW |