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 json | 6 import json |
7 import re | 7 import re |
8 import string | 8 import string |
9 | 9 |
10 | 10 |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1073 | 1073 |
1074 # TODO(nednguyen): only rerun the tests that failed for the "without patch" | 1074 # TODO(nednguyen): only rerun the tests that failed for the "without patch" |
1075 # suffix. | 1075 # suffix. |
1076 | 1076 |
1077 # For the time being, we assume all isolated_script_test are not idempotent | 1077 # For the time being, we assume all isolated_script_test are not idempotent |
1078 # TODO(nednguyen): make this configurable in isolated_scripts's spec. | 1078 # TODO(nednguyen): make this configurable in isolated_scripts's spec. |
1079 return api.swarming.isolated_script_task( | 1079 return api.swarming.isolated_script_task( |
1080 title=self._step_name(suffix), isolated_hash=isolated_hash, | 1080 title=self._step_name(suffix), isolated_hash=isolated_hash, |
1081 shards=self._shards, idempotent=False, extra_args=args) | 1081 shards=self._shards, idempotent=False, extra_args=args) |
1082 | 1082 |
1083 def validate_simplified_results(self, results): | |
1084 failures = results['failures'] | |
1085 valid = results['valid'] | |
Sergiy Byelozyorov
2016/10/05 15:36:06
Please remove two lines above... they are not need
nednguyen
2016/10/05 18:50:53
Done.
| |
1086 return results['valid'], results['failures'] | |
1087 | |
1088 def validate_json_test_results(self, api, results): | |
1089 test_results = api.test_utils.create_results_from_json(results) | |
1090 tests = test_results.tests | |
1091 failures = list(t for t in tests if | |
1092 tests[t]['expected'] != tests[t]['actual']) | |
Sergiy Byelozyorov
2016/10/05 15:36:06
AFAIK, 'expected' and 'actual' are lists of result
nednguyen
2016/10/05 18:50:53
I see. The spec says:
"actual" is an ordered space
Sergiy Byelozyorov
2016/10/09 14:43:10
I think, to get a list of failures, you'd need to
nednguyen
2016/10/10 13:24:51
Done.
| |
1093 valid = results['num_failures_by_type'].get('FAIL', 0) == len(failures) | |
Sergiy Byelozyorov
2016/10/05 15:36:05
FAIL is not the only type of failure.
nednguyen
2016/10/05 18:50:53
But is should be the only one we use for checking
Dirk Pranke
2016/10/05 19:39:46
"valid" is used to detect whether something went h
nednguyen
2016/10/05 20:14:29
Done. We have a try catch block at 1105 to check v
| |
1094 return valid, failures | |
1095 | |
1083 def validate_task_results(self, api, step_result): | 1096 def validate_task_results(self, api, step_result): |
1084 results = getattr(step_result, 'isolated_script_results', None) or {} | 1097 results = getattr(step_result, 'isolated_script_results', None) or {} |
1085 | 1098 valid = True |
1099 failures = [] | |
1086 try: | 1100 try: |
1087 failures = results['failures'] | 1101 if results.get('version', 0) == 3: |
1088 valid = results['valid'] | 1102 valid, failures = self.validate_json_test_results(api, results) |
1089 if not failures and step_result.retcode != 0: | 1103 else: |
1090 failures = ['%s (entire test suite)' % self.name] | 1104 valid, failures = self.validate_simplified_results(results) |
1091 valid = False | |
1092 | |
1093 except (ValueError, KeyError) as e: | 1105 except (ValueError, KeyError) as e: |
1094 step_result.presentation.logs['invalid_results_exc'] = [str(e)] | 1106 step_result.presentation.logs['invalid_results_exc'] = [str(e)] |
1095 valid = False | 1107 valid = False |
1096 failures = None | 1108 failures = None |
1109 if not failures and step_result.retcode != 0: | |
1110 failures = ['%s (entire test suite)' % self.name] | |
1111 valid = False | |
1097 if valid: | 1112 if valid: |
1098 step_result.presentation.step_text += api.test_utils.format_step_text([ | 1113 step_result.presentation.step_text += api.test_utils.format_step_text([ |
1099 ['failures:', failures] | 1114 ['failures:', failures] |
1100 ]) | 1115 ]) |
1101 # Check for chartjson results and upload to results dashboard if present. | 1116 # Check for chartjson results and upload to results dashboard if present. |
1102 self._output_chartjson_results_if_present(api, step_result) | 1117 self._output_chartjson_results_if_present(api, step_result) |
1103 return valid, failures | 1118 return valid, failures |
1104 | 1119 |
1105 def _output_chartjson_results_if_present(self, api, step_result): | 1120 def _output_chartjson_results_if_present(self, api, step_result): |
1106 results = \ | 1121 results = \ |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1791 args=args) | 1806 args=args) |
1792 api.gsutil.upload( | 1807 api.gsutil.upload( |
1793 temp_output_dir.join( | 1808 temp_output_dir.join( |
1794 '%s-android-chrome.json' % timestamp_string), | 1809 '%s-android-chrome.json' % timestamp_string), |
1795 'chromium-annotated-tests', 'android') | 1810 'chromium-annotated-tests', 'android') |
1796 | 1811 |
1797 GOMA_TESTS = [ | 1812 GOMA_TESTS = [ |
1798 GTestTest('base_unittests'), | 1813 GTestTest('base_unittests'), |
1799 GTestTest('content_unittests'), | 1814 GTestTest('content_unittests'), |
1800 ] | 1815 ] |
OLD | NEW |