| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client 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 sys | 9 import sys |
| 10 import thread | 10 import thread |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 err += '\nThe test probably did not get a callback that it expected.' | 202 err += '\nThe test probably did not get a callback that it expected.' |
| 203 listener.ServerError(err) | 203 listener.ServerError(err) |
| 204 break | 204 break |
| 205 elif not options.interactive and HardTimeout(options.hard_timeout): | 205 elif not options.interactive and HardTimeout(options.hard_timeout): |
| 206 listener.ServerError('The test took over %.1f seconds. This is ' | 206 listener.ServerError('The test took over %.1f seconds. This is ' |
| 207 'probably a runaway test.' % options.hard_timeout) | 207 'probably a runaway test.' % options.hard_timeout) |
| 208 break | 208 break |
| 209 else: | 209 else: |
| 210 # If Python 2.5 support is dropped, stick server.handle_request() here. | 210 # If Python 2.5 support is dropped, stick server.handle_request() here. |
| 211 time.sleep(0.125) | 211 time.sleep(0.125) |
| 212 | |
| 213 if options.tool: | 212 if options.tool: |
| 214 sys.stdout.write('##################### Waiting for the tool to exit\n') | |
| 215 browser.WaitForProcessDeath() | 213 browser.WaitForProcessDeath() |
| 216 sys.stdout.write('##################### Processing tool logs\n') | |
| 217 tool_failed = ProcessToolLogs(options, browser.tool_log_dir) | 214 tool_failed = ProcessToolLogs(options, browser.tool_log_dir) |
| 218 | |
| 219 finally: | 215 finally: |
| 220 browser.Cleanup() | 216 browser.Cleanup() |
| 221 server.server_close() | 217 server.server_close() |
| 222 | 218 |
| 223 if tool_failed: | 219 if tool_failed: |
| 224 return 2 | 220 return 2 |
| 225 elif listener.ever_failed: | 221 elif listener.ever_failed: |
| 226 return 1 | 222 return 1 |
| 227 else: | 223 else: |
| 228 return 0 | 224 return 0 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 242 parser.error('Must specify a URL') | 238 parser.error('Must specify a URL') |
| 243 | 239 |
| 244 if options.hard_timeout is None: | 240 if options.hard_timeout is None: |
| 245 options.hard_timeout = options.timeout * 3 | 241 options.hard_timeout = options.timeout * 3 |
| 246 | 242 |
| 247 return Run(url, options) | 243 return Run(url, options) |
| 248 | 244 |
| 249 | 245 |
| 250 if __name__ == '__main__': | 246 if __name__ == '__main__': |
| 251 sys.exit(RunFromCommandLine()) | 247 sys.exit(RunFromCommandLine()) |
| OLD | NEW |