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

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: 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 35
frankf 2013/04/23 19:06:47 no blank line
36 from pylib.utils import repo_utils
37
36 38
37 # The JSONResultsGenerator gets the filesystem.join operation from the Port 39 # The JSONResultsGenerator gets the filesystem.join operation from the Port
38 # object. Creating a Port object requires specifying information that only 40 # object. Creating a Port object requires specifying information that only
39 # makes sense for running WebKit layout tests, so we provide a dummy object 41 # makes sense for running WebKit layout tests, so we provide a dummy object
40 # that contains the fields required by the generator. 42 # that contains the fields required by the generator.
41 class PortDummy(object): 43 class PortDummy(object):
42 def __init__(self): 44 def __init__(self):
43 self._executive = executive.Executive() 45 self._executive = executive.Executive()
44 self._filesystem = filesystem.FileSystem() 46 self._filesystem = filesystem.FileSystem()
45 47
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 Args: 86 Args:
85 in_directory: The directory path to be tested. 87 in_directory: The directory path to be tested.
86 """ 88 """
87 if os.path.exists(os.path.join(in_directory, '.git')): 89 if os.path.exists(os.path.join(in_directory, '.git')):
88 return True 90 return True
89 parent = os.path.dirname(in_directory) 91 parent = os.path.dirname(in_directory)
90 if parent == constants.CHROME_DIR or parent == in_directory: 92 if parent == constants.CHROME_DIR or parent == in_directory:
91 return False 93 return False
92 return _is_git_directory(parent) 94 return _is_git_directory(parent)
93 95
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) 96 in_directory = os.path.join(constants.CHROME_DIR, in_directory)
105 97
106 if not os.path.exists(os.path.join(in_directory, '.svn')): 98 if not os.path.exists(os.path.join(in_directory, '.svn')):
107 if _is_git_directory(in_directory): 99 if _is_git_directory(in_directory):
108 return _get_git_revision(in_directory) 100 return repo_utils.GetGitHeadSHA1(in_directory)
109 else: 101 else:
110 return '' 102 return ''
111 103
112 output = cmd_helper.GetCmdOutput(['svn', 'info', '--xml'], cwd=in_directory) 104 output = cmd_helper.GetCmdOutput(['svn', 'info', '--xml'], cwd=in_directory)
113 try: 105 try:
114 dom = xml.dom.minidom.parseString(output) 106 dom = xml.dom.minidom.parseString(output)
115 return dom.getElementsByTagName('entry')[0].getAttribute('revision') 107 return dom.getElementsByTagName('entry')[0].getAttribute('revision')
116 except xml.parsers.expat.ExpatError: 108 except xml.parsers.expat.ExpatError:
117 return '' 109 return ''
118 return '' 110 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. 198 """Reports test results to the flakiness dashboard for Chrome for Android.
207 199
208 Args: 200 Args:
209 results: test results. 201 results: test results.
210 flakiness_dashboard_server: the server to upload the results to. 202 flakiness_dashboard_server: the server to upload the results to.
211 test_type: the type of the tests (as displayed by the flakiness dashboard). 203 test_type: the type of the tests (as displayed by the flakiness dashboard).
212 """ 204 """
213 uploader = ResultsUploader(test_type) 205 uploader = ResultsUploader(test_type)
214 uploader.AddResults(results) 206 uploader.AddResults(results)
215 uploader.Upload(flakiness_dashboard_server) 207 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