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

Side by Side Diff: build/android/pylib/results/flakiness_dashboard/results_uploader.py

Issue 2238443002: Fix stack trace when uploading android test results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Uploads the results to the flakiness dashboard server.""" 5 """Uploads the results to the flakiness dashboard server."""
6 # pylint: disable=E1002,R0201 6 # pylint: disable=E1002,R0201
7 7
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return dom.getElementsByTagName('entry')[0].getAttribute('revision') 79 return dom.getElementsByTagName('entry')[0].getAttribute('revision')
80 except xml.parsers.expat.ExpatError: 80 except xml.parsers.expat.ExpatError:
81 return '' 81 return ''
82 return '' 82 return ''
83 83
84 84
85 class ResultsUploader(object): 85 class ResultsUploader(object):
86 """Handles uploading buildbot tests results to the flakiness dashboard.""" 86 """Handles uploading buildbot tests results to the flakiness dashboard."""
87 def __init__(self, tests_type): 87 def __init__(self, tests_type):
88 self._build_number = os.environ.get('BUILDBOT_BUILDNUMBER') 88 self._build_number = os.environ.get('BUILDBOT_BUILDNUMBER')
89 self._master_name = os.environ.get('BUILDBOT_MASTERNAME')
89 self._builder_name = os.environ.get('BUILDBOT_BUILDERNAME') 90 self._builder_name = os.environ.get('BUILDBOT_BUILDERNAME')
90 self._tests_type = tests_type 91 self._tests_type = tests_type
92 self._build_name = None
91 93
92 if not self._build_number or not self._builder_name: 94 if not self._build_number or not self._builder_name:
93 raise Exception('You should not be uploading tests results to the server' 95 raise Exception('You should not be uploading tests results to the server'
94 'from your local machine.') 96 'from your local machine.')
95 97
96 upstream = (tests_type != 'Chromium_Android_Instrumentation') 98 upstream = (tests_type != 'Chromium_Android_Instrumentation')
97 if upstream: 99 if not upstream:
98 # TODO(frankf): Use factory properties (see buildbot/bb_device_steps.py)
99 # This requires passing the actual master name (e.g. 'ChromiumFYI' not
100 # 'chromium.fyi').
101 from slave import slave_utils # pylint: disable=F0401
102 self._build_name = slave_utils.SlaveBuildName(host_paths.DIR_SOURCE_ROOT)
103 self._master_name = slave_utils.GetActiveMaster()
104 else:
105 self._build_name = 'chromium-android' 100 self._build_name = 'chromium-android'
106 buildbot_branch = os.environ.get('BUILDBOT_BRANCH') 101 buildbot_branch = os.environ.get('BUILDBOT_BRANCH')
107 if not buildbot_branch: 102 if not buildbot_branch:
108 buildbot_branch = 'master' 103 buildbot_branch = 'master'
109 else: 104 else:
110 # Ensure there's no leading "origin/" 105 # Ensure there's no leading "origin/"
111 buildbot_branch = buildbot_branch[buildbot_branch.find('/') + 1:] 106 buildbot_branch = buildbot_branch[buildbot_branch.find('/') + 1:]
112 self._master_name = '%s-%s' % (self._build_name, buildbot_branch) 107 self._master_name = '%s-%s' % (self._build_name, buildbot_branch)
113 108
114 self._test_results_map = {} 109 self._test_results_map = {}
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 """Reports test results to the flakiness dashboard for Chrome for Android. 167 """Reports test results to the flakiness dashboard for Chrome for Android.
173 168
174 Args: 169 Args:
175 results: test results. 170 results: test results.
176 flakiness_dashboard_server: the server to upload the results to. 171 flakiness_dashboard_server: the server to upload the results to.
177 test_type: the type of the tests (as displayed by the flakiness dashboard). 172 test_type: the type of the tests (as displayed by the flakiness dashboard).
178 """ 173 """
179 uploader = ResultsUploader(test_type) 174 uploader = ResultsUploader(test_type)
180 uploader.AddResults(results) 175 uploader.AddResults(results)
181 uploader.Upload(flakiness_dashboard_server) 176 uploader.Upload(flakiness_dashboard_server)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698