OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import datetime | 5 import datetime |
6 import re | 6 import re |
7 import string | 7 import string |
8 | 8 |
9 | 9 |
10 class Test(object): | 10 class Test(object): |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 | 1072 |
1073 # TODO(nednguyen): only rerun the tests that failed for the "without patch" | 1073 # TODO(nednguyen): only rerun the tests that failed for the "without patch" |
1074 # suffix. | 1074 # suffix. |
1075 | 1075 |
1076 # For the time being, we assume all isolated_script_test are not idempotent | 1076 # For the time being, we assume all isolated_script_test are not idempotent |
1077 # TODO(nednguyen): make this configurable in isolated_scripts's spec. | 1077 # TODO(nednguyen): make this configurable in isolated_scripts's spec. |
1078 return api.swarming.isolated_script_task( | 1078 return api.swarming.isolated_script_task( |
1079 title=self._step_name(suffix), isolated_hash=isolated_hash, | 1079 title=self._step_name(suffix), isolated_hash=isolated_hash, |
1080 shards=self._shards, idempotent=False, extra_args=args) | 1080 shards=self._shards, idempotent=False, extra_args=args) |
1081 | 1081 |
| 1082 def validate_simplified_results(self, results): |
| 1083 failures = results['failures'] |
| 1084 valid = results['valid'] |
| 1085 return results['valid'], results['failures'] |
| 1086 |
| 1087 def validate_json_test_results(self, api, results): |
| 1088 test_results = api.test_utils.create_results_from_json(results) |
| 1089 tests = test_results.tests |
| 1090 failures = list(t for t in tests if |
| 1091 tests[t]['expected'] != tests[t]['actual']) |
| 1092 valid = results['num_failures_by_type'].get('FAIL', 0) == len(failures) |
| 1093 return valid, failures |
| 1094 |
1082 def validate_task_results(self, api, step_result): | 1095 def validate_task_results(self, api, step_result): |
1083 results = getattr(step_result, 'isolated_script_results', None) or {} | 1096 results = getattr(step_result, 'isolated_script_results', None) or {} |
1084 | 1097 valid = True |
| 1098 failures = [] |
1085 try: | 1099 try: |
1086 failures = results['failures'] | 1100 if results.get('version', 0) == 3: |
1087 valid = results['valid'] | 1101 valid, failures = self.validate_json_test_results(api, results) |
1088 if not failures and step_result.retcode != 0: | 1102 else: |
1089 failures = ['%s (entire test suite)' % self.name] | 1103 valid, failures = self.validate_simplified_results(results) |
1090 valid = False | |
1091 except (ValueError, KeyError) as e: | 1104 except (ValueError, KeyError) as e: |
1092 step_result.presentation.logs['invalid_results_exc'] = [str(e)] | 1105 step_result.presentation.logs['invalid_results_exc'] = [str(e)] |
1093 valid = False | 1106 valid = False |
1094 failures = None | 1107 failures = None |
| 1108 if not failures and step_result.retcode != 0: |
| 1109 failures = ['%s (entire test suite)' % self.name] |
| 1110 valid = False |
1095 if valid: | 1111 if valid: |
1096 step_result.presentation.step_text += api.test_utils.format_step_text([ | 1112 step_result.presentation.step_text += api.test_utils.format_step_text([ |
1097 ['failures:', failures] | 1113 ['failures:', failures] |
1098 ]) | 1114 ]) |
1099 return valid, failures | 1115 return valid, failures |
1100 | 1116 |
1101 | 1117 |
1102 def generate_isolated_script(api, chromium_tests_api, mastername, buildername, | 1118 def generate_isolated_script(api, chromium_tests_api, mastername, buildername, |
1103 test_spec, bot_update_step, enable_swarming=False, | 1119 test_spec, bot_update_step, enable_swarming=False, |
1104 swarming_dimensions=None, | 1120 swarming_dimensions=None, |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 args=args) | 1767 args=args) |
1752 api.gsutil.upload( | 1768 api.gsutil.upload( |
1753 temp_output_dir.join( | 1769 temp_output_dir.join( |
1754 '%s-android-chrome.json' % timestamp_string), | 1770 '%s-android-chrome.json' % timestamp_string), |
1755 'chromium-annotated-tests', 'android') | 1771 'chromium-annotated-tests', 'android') |
1756 | 1772 |
1757 GOMA_TESTS = [ | 1773 GOMA_TESTS = [ |
1758 GTestTest('base_unittests'), | 1774 GTestTest('base_unittests'), |
1759 GTestTest('content_unittests'), | 1775 GTestTest('content_unittests'), |
1760 ] | 1776 ] |
OLD | NEW |