summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorfrankf@google.com <frankf@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-14 23:59:38 +0000
committerfrankf@google.com <frankf@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-14 23:59:38 +0000
commitc1efc7d902ca0d4b79f70232447f682c38bcd60b (patch)
tree90a8d838fd2561db0322f11ecccddf1bdea8078b /build
parent516f6f88bc0334651fbc9a8d861983318fd30fa5 (diff)
downloadchromium_src-c1efc7d902ca0d4b79f70232447f682c38bcd60b.zip
chromium_src-c1efc7d902ca0d4b79f70232447f682c38bcd60b.tar.gz
chromium_src-c1efc7d902ca0d4b79f70232447f682c38bcd60b.tar.bz2
[Android] Enable uploading instrumentation tests to flakiness dashboard.
This is the client-side change for uploading the following instrumentation test types: androidwebview_instrumentation_tests chromiumtestshell_instrumentation_tests contentshell_instrumentation_tests Actuall uploading of results will first be done on a staging server. BUG=150801 Review URL: https://codereview.chromium.org/11885010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176758 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r--build/android/pylib/test_result.py35
-rw-r--r--build/android/pylib/utils/flakiness_dashboard_results_uploader.py (renamed from build/android/pylib/flakiness_dashboard_results_uploader.py)87
2 files changed, 96 insertions, 26 deletions
diff --git a/build/android/pylib/test_result.py b/build/android/pylib/test_result.py
index 28258da..d5426b4 100644
--- a/build/android/pylib/test_result.py
+++ b/build/android/pylib/test_result.py
@@ -12,7 +12,10 @@ import traceback
import buildbot_report
import constants
-import flakiness_dashboard_results_uploader
+from pylib.utils import flakiness_dashboard_results_uploader
+
+
+_STAGING_SERVER = 'chrome-android-staging'
class BaseTestResult(object):
@@ -167,11 +170,31 @@ class TestResults(object):
def _LogToFlakinessDashboard(self, test_type, test_package, flakiness_server):
"""Upload results to the flakiness dashboard"""
- # TODO(frankf): Fix upstream/downstream reporting for both test types.
- logging.info('Upload %s %s to %s' % (test_type, test_package,
- flakiness_server))
- flakiness_dashboard_results_uploader.Upload(
- flakiness_server, 'Chromium_Android_Instrumentation', self)
+ logging.info('Upload results for test type "%s", test package "%s" to %s' %
+ (test_type, test_package, flakiness_server))
+
+ # TODO(frankf): Enable uploading for gtests.
+ if test_type != 'Instrumentation':
+ logging.warning('Invalid test type.')
+ return
+
+ try:
+ # TODO(frankf): Temp server for initial testing upstream.
+ # Use http://test-results.appspot.com once we're confident this works.
+ if _STAGING_SERVER in flakiness_server:
+ assert test_package in ['ContentShellTest',
+ 'ChromiumTestShellTest',
+ 'AndroidWebViewTest']
+ dashboard_test_type = ('%s_instrumentation_tests' %
+ test_package.lower().rstrip('test'))
+ # Downstream prod server.
+ else:
+ dashboard_test_type = 'Chromium_Android_Instrumentation'
+
+ flakiness_dashboard_results_uploader.Upload(
+ flakiness_server, dashboard_test_type, self)
+ except Exception as e:
+ logging.error(e)
def LogFull(self, test_type, test_package, annotation=None,
build_type='Debug', all_tests=None, flakiness_server=None):
diff --git a/build/android/pylib/flakiness_dashboard_results_uploader.py b/build/android/pylib/utils/flakiness_dashboard_results_uploader.py
index 900af4c..4dd846c 100644
--- a/build/android/pylib/flakiness_dashboard_results_uploader.py
+++ b/build/android/pylib/utils/flakiness_dashboard_results_uploader.py
@@ -11,11 +11,16 @@ import subprocess
import sys
import tempfile
-sys.path.append(os.path.join(sys.path[0], '..', '..', 'third_party',
- 'WebKit', 'Tools', 'Scripts'))
+sys.path.append(
+ os.path.abspath(os.path.join(os.path.dirname(__file__ ),
+ os.pardir, os.pardir, os.pardir, os.pardir,
+ 'third_party', 'WebKit', 'Tools', 'Scripts')))
from webkitpy.common.system import executive, filesystem
from webkitpy.layout_tests.layout_package import json_results_generator
+#TODO(craigdh): pylib/utils/ should not depend on pylib/.
+from pylib import constants
+
# The JSONResultsGenerator gets the filesystem.join operation from the Port
# object. Creating a Port object requires specifying information that only
@@ -56,21 +61,53 @@ class JSONResultsGenerator(json_results_generator.JSONResultsGeneratorBase):
#override
def _get_svn_revision(self, in_directory):
- """Returns the git revision for the given directory.
+ """Returns the git/svn revision for the given directory.
Args:
- in_directory: The directory where git is to be run.
+ in_directory: The directory relative to src.
"""
- git_dir = self._filesystem.join(os.environ.get('CHROME_SRC'),
- in_directory,
- '.git')
- if self._filesystem.exists(git_dir):
- # Note: Not thread safe: http://bugs.python.org/issue2320
- output = subprocess.Popen(
- ['git', '--git-dir=%s' % git_dir, 'show-ref', '--head',
- '--hash=10', 'HEAD'],
- stdout=subprocess.PIPE).communicate()[0].strip()
- return output
+ def _is_git_directory(in_directory):
+ """Returns true if the given directory is in a git repository.
+
+ Args:
+ in_directory: The directory path to be tested.
+ """
+ if os.path.exists(os.path.join(in_directory, '.git')):
+ return True
+ parent = os.path.dirname(in_directory)
+ if parent == constants.CHROME_DIR or parent == in_directory:
+ return False
+ return _is_git_directory(parent)
+
+ def _get_git_revision(in_directory):
+ """Returns the git hash tag for the given directory.
+
+ Args:
+ in_directory: The directory where git is to be run.
+ """
+ command_line = ['git', 'log', '-1', '--pretty=format:%H']
+ output = subprocess.Popen(command_line,
+ cwd=in_directory,
+ stdout=subprocess.PIPE).communicate()[0]
+ return output[0:40]
+
+ in_directory = os.path.join(constants.CHROME_DIR, in_directory)
+
+ if not os.path.exists(os.path.join(in_directory, '.svn')):
+ if _is_git_directory(in_directory):
+ return _get_git_revision(in_directory)
+ else:
+ return ''
+
+ # Note: Not thread safe: http://bugs.python.org/issue2320
+ output = subprocess.Popen(['svn', 'info', '--xml'],
+ cwd=in_directory,
+ stdout=subprocess.PIPE).communicate()[0]
+ try:
+ dom = xml.dom.minidom.parseString(output)
+ return dom.getElementsByTagName('entry')[0].getAttribute('revision')
+ except xml.parsers.expat.ExpatError:
+ return ''
return ''
@@ -80,16 +117,26 @@ class ResultsUploader(object):
self._build_number = os.environ.get('BUILDBOT_BUILDNUMBER')
self._builder_name = os.environ.get('BUILDBOT_BUILDERNAME')
self._tests_type = tests_type
- self._build_name = 'chromium-android'
- if not self._builder_name:
+ if not self._build_number or not self._builder_name:
raise Exception('You should not be uploading tests results to the server'
'from your local machine.')
- buildbot_branch = os.environ.get('BUILDBOT_BRANCH')
- if not buildbot_branch:
- buildbot_branch = 'master'
- self._master_name = '%s-%s' % (self._build_name, buildbot_branch)
+ upstream = (tests_type != 'Chromium_Android_Instrumentation')
+ if upstream:
+ # TODO(frankf): Use factory properties (see buildbot/bb_device_steps.py)
+ # This requires passing the actual master name (e.g. 'ChromiumFYI' not
+ # 'chromium.fyi').
+ from slave import slave_utils
+ self._build_name = slave_utils.SlaveBuildName(constants.CHROME_DIR)
+ self._master_name = slave_utils.GetActiveMaster()
+ else:
+ self._build_name = 'chromium-android'
+ buildbot_branch = os.environ.get('BUILDBOT_BRANCH')
+ if not buildbot_branch:
+ buildbot_branch = 'master'
+ self._master_name = '%s-%s' % (self._build_name, buildbot_branch)
+
self._test_results_map = {}
def AddResults(self, test_results):