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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 break | 291 break |
292 elif not options.interactive and server.TimedOut(options.timeout): | 292 elif not options.interactive and server.TimedOut(options.timeout): |
293 js_time = server.TimeSinceJSHeartbeat() | 293 js_time = server.TimeSinceJSHeartbeat() |
294 err = 'Did not hear from the test for %.1f seconds.' % options.timeout | 294 err = 'Did not hear from the test for %.1f seconds.' % options.timeout |
295 err += '\nHeard from Javascript %.1f seconds ago.' % js_time | 295 err += '\nHeard from Javascript %.1f seconds ago.' % js_time |
296 if js_time > 2.0: | 296 if js_time > 2.0: |
297 err += '\nThe renderer probably hung or crashed.' | 297 err += '\nThe renderer probably hung or crashed.' |
298 else: | 298 else: |
299 err += '\nThe test probably did not get a callback that it expected.' | 299 err += '\nThe test probably did not get a callback that it expected.' |
300 listener.ServerError(err) | 300 listener.ServerError(err) |
301 if not server.received_request: | |
302 raise RetryTest('Chrome hung before running the test.') | |
301 break | 303 break |
302 elif not options.interactive and HardTimeout(options.hard_timeout): | 304 elif not options.interactive and HardTimeout(options.hard_timeout): |
303 listener.ServerError('The test took over %.1f seconds. This is ' | 305 listener.ServerError('The test took over %.1f seconds. This is ' |
304 'probably a runaway test.' % options.hard_timeout) | 306 'probably a runaway test.' % options.hard_timeout) |
305 break | 307 break |
306 else: | 308 else: |
307 # If Python 2.5 support is dropped, stick server.handle_request() here. | 309 # If Python 2.5 support is dropped, stick server.handle_request() here. |
308 time.sleep(0.125) | 310 time.sleep(0.125) |
309 | 311 |
310 if options.tool: | 312 if options.tool: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 | 351 |
350 # This is an entrypoint for tests that treat the browser tester as a Python | 352 # This is an entrypoint for tests that treat the browser tester as a Python |
351 # library rather than an opaque script. | 353 # library rather than an opaque script. |
352 # (e.g. run_inbrowser_trusted_crash_in_startup_test) | 354 # (e.g. run_inbrowser_trusted_crash_in_startup_test) |
353 def Run(url, options): | 355 def Run(url, options): |
354 result = 1 | 356 result = 1 |
355 attempt = 1 | 357 attempt = 1 |
356 while True: | 358 while True: |
357 try: | 359 try: |
358 result = RunTestsOnce(url, options) | 360 result = RunTestsOnce(url, options) |
361 if result and options.tool is None: | |
Mark Seaborn
2013/11/14 01:27:58
To be honest, I don't understand why you're adding
| |
362 raise RetryTest('HACK retrying failed test.') | |
359 break | 363 break |
360 except RetryTest: | 364 except RetryTest: |
361 # Only retry once. | 365 # Only retry once. |
362 if attempt < 2: | 366 if attempt < 2: |
363 sys.stdout.write('\n@@@STEP_WARNINGS@@@\n') | 367 sys.stdout.write('\n@@@STEP_WARNINGS@@@\n') |
364 sys.stdout.write('WARNING: suspected flake, retrying test!\n\n') | 368 sys.stdout.write('WARNING: suspected flake, retrying test!\n\n') |
365 attempt += 1 | 369 attempt += 1 |
366 continue | 370 continue |
367 else: | 371 else: |
368 sys.stdout.write('\nWARNING: failed too many times, not retrying.\n\n') | 372 sys.stdout.write('\nWARNING: failed too many times, not retrying.\n\n') |
(...skipping 13 matching lines...) Expand all Loading... | |
382 # Validate the URL | 386 # Validate the URL |
383 url = options.url | 387 url = options.url |
384 if url is None: | 388 if url is None: |
385 parser.error('Must specify a URL') | 389 parser.error('Must specify a URL') |
386 | 390 |
387 return Run(url, options) | 391 return Run(url, options) |
388 | 392 |
389 | 393 |
390 if __name__ == '__main__': | 394 if __name__ == '__main__': |
391 sys.exit(RunFromCommandLine()) | 395 sys.exit(RunFromCommandLine()) |
OLD | NEW |