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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 print | 369 print |
370 else: | 370 else: |
371 raise | 371 raise |
372 | 372 |
373 # Retry failed test cases. Currently, XCTests don't support retries | 373 # Retry failed test cases. Currently, XCTests don't support retries |
374 # because there are no arguments to select specific tests to run. | 374 # because there are no arguments to select specific tests to run. |
375 if self.retries and failed and not self.xctest_path: | 375 if self.retries and failed and not self.xctest_path: |
376 print '%s tests failed and will be retried.' % len(failed) | 376 print '%s tests failed and will be retried.' % len(failed) |
377 print | 377 print |
378 for i in xrange(self.retries): | 378 for i in xrange(self.retries): |
379 for test in failed: | 379 for test in failed.keys(): |
380 print 'Retry #%s for %s.' % (i + 1, test) | 380 print 'Retry #%s for %s.' % (i + 1, test) |
381 print | 381 print |
382 self._run(self.get_launch_command(test_filter=[test])) | 382 result = self._run(self.get_launch_command(test_filter=[test])) |
| 383 # If the test passed on retry, consider it flake instead of failure. |
| 384 if test in result.passed_tests: |
| 385 flaked[test] = failed.pop(test) |
383 | 386 |
384 # Build test_results.json. | 387 # Build test_results.json. |
385 self.test_results['interrupted'] = result.crashed | 388 self.test_results['interrupted'] = result.crashed |
386 self.test_results['num_failures_by_type'] = { | 389 self.test_results['num_failures_by_type'] = { |
387 'FAIL': len(failed) + len(flaked), | 390 'FAIL': len(failed) + len(flaked), |
388 'PASS': len(passed), | 391 'PASS': len(passed), |
389 } | 392 } |
390 tests = collections.OrderedDict() | 393 tests = collections.OrderedDict() |
391 for test in passed: | 394 for test in passed: |
392 tests[test] = { 'expected': 'PASS', 'actual': 'PASS' } | 395 tests[test] = { 'expected': 'PASS', 'actual': 'PASS' } |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 """ | 774 """ |
772 env = super(DeviceTestRunner, self).get_launch_env() | 775 env = super(DeviceTestRunner, self).get_launch_env() |
773 if self.xctest_path: | 776 if self.xctest_path: |
774 env['NSUnbufferedIO'] = 'YES' | 777 env['NSUnbufferedIO'] = 'YES' |
775 # e.g. ios_web_shell_egtests | 778 # e.g. ios_web_shell_egtests |
776 env['APP_TARGET_NAME'] = os.path.splitext( | 779 env['APP_TARGET_NAME'] = os.path.splitext( |
777 os.path.basename(self.app_path))[0] | 780 os.path.basename(self.app_path))[0] |
778 # e.g. ios_web_shell_egtests_module | 781 # e.g. ios_web_shell_egtests_module |
779 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'] + '_module' | 782 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'] + '_module' |
780 return env | 783 return env |
OLD | NEW |