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: |
| 362 # Currently (2013/11/15) nacl_integration is fairly flaky and there is |
| 363 # not enough time to look into it. Retry if the test fails for any |
| 364 # reason. Note that in general this test runner tries to only retry |
| 365 # when a known flake is encountered. (See the other raise |
| 366 # RetryTest(..)s in this file.) This blanket retry means that those |
| 367 # other cases could be removed without changing the behavior of the test |
| 368 # runner, but it is hoped that this blanket retry will eventually be |
| 369 # unnecessary and subsequently removed. The more precise retries have |
| 370 # been left in place to preserve the knowledge. |
| 371 raise RetryTest('HACK retrying failed test.') |
359 break | 372 break |
360 except RetryTest: | 373 except RetryTest: |
361 # Only retry once. | 374 # Only retry once. |
362 if attempt < 2: | 375 if attempt < 2: |
363 sys.stdout.write('\n@@@STEP_WARNINGS@@@\n') | 376 sys.stdout.write('\n@@@STEP_WARNINGS@@@\n') |
364 sys.stdout.write('WARNING: suspected flake, retrying test!\n\n') | 377 sys.stdout.write('WARNING: suspected flake, retrying test!\n\n') |
365 attempt += 1 | 378 attempt += 1 |
366 continue | 379 continue |
367 else: | 380 else: |
368 sys.stdout.write('\nWARNING: failed too many times, not retrying.\n\n') | 381 sys.stdout.write('\nWARNING: failed too many times, not retrying.\n\n') |
(...skipping 13 matching lines...) Expand all Loading... |
382 # Validate the URL | 395 # Validate the URL |
383 url = options.url | 396 url = options.url |
384 if url is None: | 397 if url is None: |
385 parser.error('Must specify a URL') | 398 parser.error('Must specify a URL') |
386 | 399 |
387 return Run(url, options) | 400 return Run(url, options) |
388 | 401 |
389 | 402 |
390 if __name__ == '__main__': | 403 if __name__ == '__main__': |
391 sys.exit(RunFromCommandLine()) | 404 sys.exit(RunFromCommandLine()) |
OLD | NEW |