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

Side by Side Diff: build/android/pylib/utils/flakiness_dashboard_results_uploader.py

Issue 14118014: Android: extracts "repo_utils.py" from flakiness_dashboard_results_uploader.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove \n Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/utils/repo_utils.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 (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 6
7 import logging 7 import logging
8 import os 8 import os
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 14 matching lines...) Expand all
25 os.pardir, os.pardir, os.pardir, os.pardir, 25 os.pardir, os.pardir, os.pardir, os.pardir,
26 os.pardir, os.pardir, os.pardir, 26 os.pardir, os.pardir, os.pardir,
27 'Tools', 'Scripts'))) 27 'Tools', 'Scripts')))
28 28
29 from webkitpy.common.system import executive, filesystem 29 from webkitpy.common.system import executive, filesystem
30 from webkitpy.layout_tests.layout_package import json_results_generator 30 from webkitpy.layout_tests.layout_package import json_results_generator
31 31
32 #TODO(craigdh): pylib/utils/ should not depend on pylib/. 32 #TODO(craigdh): pylib/utils/ should not depend on pylib/.
33 from pylib import cmd_helper 33 from pylib import cmd_helper
34 from pylib import constants 34 from pylib import constants
35 from pylib.utils import repo_utils
35 36
36 37
37 # The JSONResultsGenerator gets the filesystem.join operation from the Port 38 # The JSONResultsGenerator gets the filesystem.join operation from the Port
38 # object. Creating a Port object requires specifying information that only 39 # object. Creating a Port object requires specifying information that only
39 # makes sense for running WebKit layout tests, so we provide a dummy object 40 # makes sense for running WebKit layout tests, so we provide a dummy object
40 # that contains the fields required by the generator. 41 # that contains the fields required by the generator.
41 class PortDummy(object): 42 class PortDummy(object):
42 def __init__(self): 43 def __init__(self):
43 self._executive = executive.Executive() 44 self._executive = executive.Executive()
44 self._filesystem = filesystem.FileSystem() 45 self._filesystem = filesystem.FileSystem()
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 Args: 85 Args:
85 in_directory: The directory path to be tested. 86 in_directory: The directory path to be tested.
86 """ 87 """
87 if os.path.exists(os.path.join(in_directory, '.git')): 88 if os.path.exists(os.path.join(in_directory, '.git')):
88 return True 89 return True
89 parent = os.path.dirname(in_directory) 90 parent = os.path.dirname(in_directory)
90 if parent == constants.CHROME_DIR or parent == in_directory: 91 if parent == constants.CHROME_DIR or parent == in_directory:
91 return False 92 return False
92 return _is_git_directory(parent) 93 return _is_git_directory(parent)
93 94
94 def _get_git_revision(in_directory):
95 """Returns the git hash tag for the given directory.
96
97 Args:
98 in_directory: The directory where git is to be run.
99 """
100 command_line = ['git', 'log', '-1', '--pretty=format:%H']
101 output = cmd_helper.GetCmdOutput(command_line, cwd=in_directory)
102 return output[0:40]
103
104 in_directory = os.path.join(constants.CHROME_DIR, in_directory) 95 in_directory = os.path.join(constants.CHROME_DIR, in_directory)
105 96
106 if not os.path.exists(os.path.join(in_directory, '.svn')): 97 if not os.path.exists(os.path.join(in_directory, '.svn')):
107 if _is_git_directory(in_directory): 98 if _is_git_directory(in_directory):
108 return _get_git_revision(in_directory) 99 return repo_utils.GetGitHeadSHA1(in_directory)
109 else: 100 else:
110 return '' 101 return ''
111 102
112 output = cmd_helper.GetCmdOutput(['svn', 'info', '--xml'], cwd=in_directory) 103 output = cmd_helper.GetCmdOutput(['svn', 'info', '--xml'], cwd=in_directory)
113 try: 104 try:
114 dom = xml.dom.minidom.parseString(output) 105 dom = xml.dom.minidom.parseString(output)
115 return dom.getElementsByTagName('entry')[0].getAttribute('revision') 106 return dom.getElementsByTagName('entry')[0].getAttribute('revision')
116 except xml.parsers.expat.ExpatError: 107 except xml.parsers.expat.ExpatError:
117 return '' 108 return ''
118 return '' 109 return ''
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 """Reports test results to the flakiness dashboard for Chrome for Android. 197 """Reports test results to the flakiness dashboard for Chrome for Android.
207 198
208 Args: 199 Args:
209 results: test results. 200 results: test results.
210 flakiness_dashboard_server: the server to upload the results to. 201 flakiness_dashboard_server: the server to upload the results to.
211 test_type: the type of the tests (as displayed by the flakiness dashboard). 202 test_type: the type of the tests (as displayed by the flakiness dashboard).
212 """ 203 """
213 uploader = ResultsUploader(test_type) 204 uploader = ResultsUploader(test_type)
214 uploader.AddResults(results) 205 uploader.AddResults(results)
215 uploader.Upload(flakiness_dashboard_server) 206 uploader.Upload(flakiness_dashboard_server)
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/utils/repo_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698