| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Test runners for iOS.""" | 5 """Test runners for iOS.""" |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import collections | 8 import collections |
| 9 import errno | 9 import errno |
| 10 import os | 10 import os |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 passed.extend(result.passed_tests) | 344 passed.extend(result.passed_tests) |
| 345 failed.update(result.failed_tests) | 345 failed.update(result.failed_tests) |
| 346 flaked.update(result.flaked_tests) | 346 flaked.update(result.flaked_tests) |
| 347 except OSError as e: | 347 except OSError as e: |
| 348 if e.errno == errno.E2BIG: | 348 if e.errno == errno.E2BIG: |
| 349 print 'Too many test cases to resume.' | 349 print 'Too many test cases to resume.' |
| 350 print | 350 print |
| 351 else: | 351 else: |
| 352 raise | 352 raise |
| 353 | 353 |
| 354 # Retry failed test cases. Currently, XCTests don't support retries | 354 # Retry failed test cases. |
| 355 # because there are no arguments to select specific tests to run. | 355 if self.retries and failed: |
| 356 if self.retries and failed and not self.xctest_path: | |
| 357 print '%s tests failed and will be retried.' % len(failed) | 356 print '%s tests failed and will be retried.' % len(failed) |
| 358 print | 357 print |
| 359 for i in xrange(self.retries): | 358 for i in xrange(self.retries): |
| 360 for test in failed.keys(): | 359 for test in failed.keys(): |
| 361 print 'Retry #%s for %s.' % (i + 1, test) | 360 print 'Retry #%s for %s.' % (i + 1, test) |
| 362 print | 361 print |
| 363 result = self._run(self.get_launch_command(test_filter=[test])) | 362 result = self._run(self.get_launch_command(test_filter=[test])) |
| 364 # If the test passed on retry, consider it flake instead of failure. | 363 # If the test passed on retry, consider it flake instead of failure. |
| 365 if test in result.passed_tests: | 364 if test in result.passed_tests: |
| 366 flaked[test] = failed.pop(test) | 365 flaked[test] = failed.pop(test) |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 """ | 785 """ |
| 787 env = super(DeviceTestRunner, self).get_launch_env() | 786 env = super(DeviceTestRunner, self).get_launch_env() |
| 788 if self.xctest_path: | 787 if self.xctest_path: |
| 789 env['NSUnbufferedIO'] = 'YES' | 788 env['NSUnbufferedIO'] = 'YES' |
| 790 # e.g. ios_web_shell_egtests | 789 # e.g. ios_web_shell_egtests |
| 791 env['APP_TARGET_NAME'] = os.path.splitext( | 790 env['APP_TARGET_NAME'] = os.path.splitext( |
| 792 os.path.basename(self.app_path))[0] | 791 os.path.basename(self.app_path))[0] |
| 793 # e.g. ios_web_shell_egtests_module | 792 # e.g. ios_web_shell_egtests_module |
| 794 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'] + '_module' | 793 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'] + '_module' |
| 795 return env | 794 return env |
| OLD | NEW |