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

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

Issue 2330133002: Updating the SwarmingIsolatedScriptTest to upload chartjson results to the (Closed)
Patch Set: Updating steps.py to utilize new swarming api Created 4 years, 3 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
« no previous file with comments | « no previous file | scripts/slave/runtest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 re 6 import re
7 import string 7 import string
8 8
9 from slave import slave_utils
10 from slave import results_dashboard
9 11
10 class Test(object): 12 class Test(object):
11 """ 13 """
12 Base class for tests that can be retried after deapplying a previously 14 Base class for tests that can be retried after deapplying a previously
13 applied patch. 15 applied patch.
14 """ 16 """
15 17
16 def __init__(self): 18 def __init__(self):
17 super(Test, self).__init__() 19 super(Test, self).__init__()
18 self._test_runs = {} 20 self._test_runs = {}
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 1077
1076 def validate_task_results(self, api, step_result): 1078 def validate_task_results(self, api, step_result):
1077 results = getattr(step_result, 'isolated_script_results', None) or {} 1079 results = getattr(step_result, 'isolated_script_results', None) or {}
1078 1080
1079 try: 1081 try:
1080 failures = results['failures'] 1082 failures = results['failures']
1081 valid = results['valid'] 1083 valid = results['valid']
1082 if not failures and step_result.retcode != 0: 1084 if not failures and step_result.retcode != 0:
1083 failures = ['%s (entire test suite)' % self.name] 1085 failures = ['%s (entire test suite)' % self.name]
1084 valid = False 1086 valid = False
1087 # Check for chartjson results and upload to results dashboard if present.
1088 self._output_charjson_results_if_present(api, step_result)
Ken Russell (switch to Gerrit) 2016/09/13 19:41:00 charjson -> chartjson
eyaich1 2016/09/14 18:42:29 Done.
1085 except (ValueError, KeyError) as e: 1089 except (ValueError, KeyError) as e:
1086 step_result.presentation.logs['invalid_results_exc'] = [str(e)] 1090 step_result.presentation.logs['invalid_results_exc'] = [str(e)]
1087 valid = False 1091 valid = False
1088 failures = None 1092 failures = None
1089 if valid: 1093 if valid:
1090 step_result.presentation.step_text += api.test_utils.format_step_text([ 1094 step_result.presentation.step_text += api.test_utils.format_step_text([
1091 ['failures:', failures] 1095 ['failures:', failures]
1092 ]) 1096 ])
1093 return valid, failures 1097 return valid, failures
1094 1098
1099 def _output_charjson_results_if_present(self, api, step_result):
Ken Russell (switch to Gerrit) 2016/09/13 19:40:59 Is this code path tested? Have you sent a CQ dry r
eyaich1 2016/09/14 18:42:29 Ah, so this is where they are called! Ok making s
1100 results = getattr(step_result, 'isolated_script_chart_results', None) or {}
Ken Russell (switch to Gerrit) 2016/09/13 19:41:00 Also, for clarity, how about chart -> chartjson?
eyaich1 2016/09/14 18:42:29 Done.
1101 try:
1102 if not 'charts' in results:
1103 print 'Info: No chart json present'
1104 return
1105
1106 main_revision = \
1107 GetMainRevision(api.properties, api.chromium.c.build_dir)
1108 blink_revision = GetBlinkRevision(api.chromium.c.build_dir)
1109 revisions = slave_utils.GetTelemetryRevisions(
1110 api.properties, main_revision, blink_revision)
1111 reference_build = 'reference' in self.name
1112 stripped_test_name = self.name.replace('.reference', '')
1113 dashboard_json = results_dashboard.MakeDashboardJsonV1(
1114 results,
1115 revisions, stripped_test_name, api.properties['perf-id'],
1116 api.properties['buildername'], api.properties['buildnumber'],
1117 None, reference_build)
1118 if dashboard_json :
1119 logging.debug(json.dumps(dashboard_json , indent=2))
1120 results_dashboard.SendResults(
1121 dashboard_json ,
1122 api.properties['results-url'],
1123 api.chromium.c.build_dir)
1124 else:
1125 print 'Error: No json output from telemetry.'
1126 print '@@@STEP_FAILURE@@@'
1127
1128 except (ValueError, KeyError) as e:
1129 print 'Error: Unable to upload chartjson results to perf dashboard'
1130
1095 1131
1096 def generate_isolated_script(api, chromium_tests_api, mastername, buildername, 1132 def generate_isolated_script(api, chromium_tests_api, mastername, buildername,
1097 test_spec, bot_update_step, enable_swarming=False, 1133 test_spec, bot_update_step, enable_swarming=False,
1098 swarming_dimensions=None, 1134 swarming_dimensions=None,
1099 scripts_compile_targets=None): 1135 scripts_compile_targets=None):
1100 for spec in test_spec.get(buildername, {}).get('isolated_scripts', []): 1136 for spec in test_spec.get(buildername, {}).get('isolated_scripts', []):
1101 use_swarming = False 1137 use_swarming = False
1102 swarming_shards = 1 1138 swarming_shards = 1
1103 swarming_dimension_sets = None 1139 swarming_dimension_sets = None
1104 swarming_priority = None 1140 swarming_priority = None
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 args=args) 1781 args=args)
1746 api.gsutil.upload( 1782 api.gsutil.upload(
1747 temp_output_dir.join( 1783 temp_output_dir.join(
1748 '%s-android-chrome.json' % timestamp_string), 1784 '%s-android-chrome.json' % timestamp_string),
1749 'chromium-annotated-tests', 'android') 1785 'chromium-annotated-tests', 'android')
1750 1786
1751 GOMA_TESTS = [ 1787 GOMA_TESTS = [
1752 GTestTest('base_unittests'), 1788 GTestTest('base_unittests'),
1753 GTestTest('content_unittests'), 1789 GTestTest('content_unittests'),
1754 ] 1790 ]
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/runtest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698