Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: scripts/slave/recipe_modules/chromium_tests/steps.py

Issue 2410613002: Change SwarmingIsolatedScriptTest to upload json format results (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 1090
1091 def validate_json_test_results(self, api, results): 1091 def validate_json_test_results(self, api, results):
1092 test_results = api.test_utils.create_results_from_json(results) 1092 test_results = api.test_utils.create_results_from_json(results)
1093 tests = test_results.tests 1093 tests = test_results.tests
1094 failures = list( 1094 failures = list(
1095 t for t in tests 1095 t for t in tests
1096 if all(res not in tests[t]['expected'].split() 1096 if all(res not in tests[t]['expected'].split()
1097 for res in tests[t]['actual'].split())) 1097 for res in tests[t]['actual'].split()))
1098 return True, failures 1098 return True, failures
1099 1099
1100 def upload_json_format_results(self, api, results):
1101 chrome_revision_cp = api.bot_update.last_returned_properties.get(
1102 'got_revision_cp', 'x@{#0}')
1103 chrome_revision = str(api.commit_position.parse_revision(
1104 chrome_revision_cp))
1105 api.test_results.upload(
1106 api.json.input(results), chrome_revision=chrome_revision,
1107 test_type=self.name,
1108 test_results_server='test-results.appspot.com')
1109
1100 def validate_task_results(self, api, step_result): 1110 def validate_task_results(self, api, step_result):
1101 results = getattr(step_result, 'isolated_script_results', None) or {} 1111 results = getattr(step_result, 'isolated_script_results', None) or {}
1102 valid = True 1112 valid = True
1103 failures = [] 1113 failures = []
1104 try: 1114 try:
1105 if results.get('version', 0) == 3: 1115 if results.get('version', 0) == 3:
1106 valid, failures = self.validate_json_test_results(api, results) 1116 valid, failures = self.validate_json_test_results(api, results)
1107 else: 1117 else:
1108 valid, failures = self.validate_simplified_results(results) 1118 valid, failures = self.validate_simplified_results(results)
1109 except (ValueError, KeyError) as e: 1119 except (ValueError, KeyError) as e:
1110 step_result.presentation.logs['invalid_results_exc'] = [repr(e)] 1120 step_result.presentation.logs['invalid_results_exc'] = [repr(e)]
1111 valid = False 1121 valid = False
1112 failures = None 1122 failures = None
1113 if not failures and step_result.retcode != 0: 1123 if not failures and step_result.retcode != 0:
1114 failures = ['%s (entire test suite)' % self.name] 1124 failures = ['%s (entire test suite)' % self.name]
1115 valid = False 1125 valid = False
1116 if valid: 1126 if valid:
1117 step_result.presentation.step_text += api.test_utils.format_step_text([ 1127 step_result.presentation.step_text += api.test_utils.format_step_text([
1118 ['failures:', failures] 1128 ['failures:', failures]
1119 ]) 1129 ])
1130 # Only upload json format results.
Sergiy Byelozyorov 2016/10/11 14:39:29 Why is it done in validate_task_results? What if t
Paweł Hajdan Jr. 2016/10/11 18:04:11 +1 ; post_run would be better place
nednguyen 2016/10/13 17:58:03 Swarming.post_run(..) calls validate_task_results:
1131 if results.get('version', 0) == 3:
1132 self.upload_json_format_results(api, results)
1133
1120 # Check for chartjson results and upload to results dashboard if present. 1134 # Check for chartjson results and upload to results dashboard if present.
1121 self._output_chartjson_results_if_present(api, step_result) 1135 self._output_chartjson_results_if_present(api, step_result)
1122 return valid, failures 1136 return valid, failures
1123 1137
1124 def _output_chartjson_results_if_present(self, api, step_result): 1138 def _output_chartjson_results_if_present(self, api, step_result):
1125 results = \ 1139 results = \
1126 getattr(step_result, 'isolated_script_chartjson_results', None) or {} 1140 getattr(step_result, 'isolated_script_chartjson_results', None) or {}
1127 try: 1141 try:
1128 if not 'charts' in results: 1142 if not 'charts' in results:
1129 print 'Info: No chart json present' 1143 print 'Info: No chart json present'
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 args=args) 1829 args=args)
1816 api.gsutil.upload( 1830 api.gsutil.upload(
1817 temp_output_dir.join( 1831 temp_output_dir.join(
1818 '%s-android-chrome.json' % timestamp_string), 1832 '%s-android-chrome.json' % timestamp_string),
1819 'chromium-annotated-tests', 'android') 1833 'chromium-annotated-tests', 'android')
1820 1834
1821 GOMA_TESTS = [ 1835 GOMA_TESTS = [
1822 GTestTest('base_unittests'), 1836 GTestTest('base_unittests'),
1823 GTestTest('content_unittests'), 1837 GTestTest('content_unittests'),
1824 ] 1838 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698