Added Chrome+WebRTC bots based on Chrome scripts, for all platforms.

Also removed the old Linux Chrome and Chrome Bloat bots from utils.py.

Some of these changes may seem a bit confusing and messy but they must be considered a step on the way to moving away from our inheritance based Factories into the style Chrome users, where most configuration is in the .cfg files, factory setup is in the factories and step details are put into the commands-files.

BUG=None
TEST=Tested with local master and production slaves.

Review URL: https://webrtc-codereview.appspot.com/581006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2238 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org
2012-05-15 09:29:22 +00:00
parent cf2cd7e4c4
commit c5ad6092fa
10 changed files with 345 additions and 165 deletions

View File

@@ -35,8 +35,6 @@ WEBRTC_BUILD_DIR = 'build'
MEMCHECK_CMD = ['tools/valgrind-webrtc/webrtc_tests.sh', '-t']
DEFAULT_COVERAGE_DIR = '/var/www/coverage'
DEFAULT_BLOAT_DIR = '/var/www/bloat'
DEFAULT_BLOAT_URL = 'http://webrtc-chrome.lul/bloat/webrtc_bloat.html'
DEFAULT_MASTER_WORK_DIR = '.'
GCLIENT_RETRIES = 3
@@ -467,17 +465,6 @@ class GenerateCodeCoverage(ShellCommand):
ShellCommand.start(self)
class ShellCommandWithUrl(ShellCommand):
"""A regular shell command which posts a link when it's done."""
def __init__(self, url, **kwargs):
ShellCommand.__init__(self, **kwargs)
self.addFactoryArguments(url=url)
self.url = url
def createSummary(self, log):
self.addURL('click here', self.url)
class WebRTCAndroidFactory(WebRTCFactory):
"""Sets up the Android build."""
@@ -525,89 +512,6 @@ class WebRTCAndroidNDKFactory(WebRTCFactory):
self.AddCommonStep(cmd=full_cmd, descriptor=descriptor)
class WebRTCChromeFactory(WebRTCFactory):
"""Sets up the Chrome Browser+WebRTC build."""
def __init__(self, build_status_oracle,
gclient_solution_name,
svn_url,
custom_deps_list=None,
safesync_url=None):
WebRTCFactory.__init__(self, build_status_oracle=build_status_oracle,
gclient_solution_name=gclient_solution_name,
svn_url=svn_url,
custom_deps_list=custom_deps_list,
safesync_url=safesync_url)
self.build_enabled = False
def EnableBuild(self, release=False, enable_profiling=False):
self.AddCommonStep(['rm', '-rf', 'src'], workdir=WEBRTC_BUILD_DIR,
descriptor='Cleanup')
self.AddGclientSyncStep(always_use_latest=True)
if enable_profiling:
self.AddCommonStep(['./build/gyp_chromium', '-Dprofiling=1'],
descriptor="gyp_chromium",
warn_on_failure=True, workdir='build/src')
chrome_targets = ['chrome', 'pyautolib']
if release:
self.AddCommonMakeStep(chrome_targets, 'BUILDTYPE=Release')
else:
self.AddCommonMakeStep(chrome_targets)
self.build_enabled = True
self.release = release
self.profiling = enable_profiling
def EnableBloatCalculation(self):
"""Runs a bloat calculation, which will yield a size breakdown for Chrome.
If running in Release mode, you should also run with profiling to get the
symbols right. Running this on Debug mode will work but it will probably
take hours.
"""
assert self.build_enabled is True
assert (self.release and self.profiling) or not self.release
bloat_path = PosixPathJoin(WEBRTC_BUILD_DIR, '..', '..', '..', '..', '..',
'..', 'build_internal', 'symsrc',
'calculate_bloat.py')
output_filename = PosixPathJoin(DEFAULT_BLOAT_DIR, 'bloat_latest.json')
build_directory = 'Release' if self.release else 'Debug'
chrome_binary = PosixPathJoin('out', build_directory, 'chrome')
cmd = [bloat_path, '--binary', chrome_binary, '--source-path', '.',
'--output-file', output_filename]
self.addStep(ShellCommandWithUrl(command=cmd,
url=DEFAULT_BLOAT_URL,
description='calculate_bloat.py',
warnOnFailure=True,
workdir='build/src',
timeout=7200))
def AddCommonMakeStep(self, targets, make_extra=None):
descriptor = ['make'] + targets
cmd = ['make', '-j100'] + targets
if make_extra is not None:
cmd.append(make_extra)
self.AddCommonStep(cmd=cmd, descriptor=descriptor,
warn_on_failure=True, workdir='build/src')
def AddCommonTestRunStep(self, test):
# We currently only support PyAuto tests on this bot.
self._AddPyAutoTestRunStep(test)
def _AddPyAutoTestRunStep(self, test):
assert self.build_enabled
# Set up the test under Xvfb since it will probably launch browser windows.
# Replace any slashes in the test's path with underscores for the name since
# the buildbot web pages will become confused otherwise.
descriptor = test.replace('/', '_')
pyauto_flags = (' --chrome-flags "--enable-media-stream'
' --enable-peer-connection"')
cmd = MakeCommandToRunTestInXvfb(test + pyauto_flags)
self.AddCommonStep(cmd=cmd, descriptor=descriptor, workdir='build/src')
class WebRTCLinuxFactory(WebRTCFactory):
"""Sets up the Linux build.

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
__author__ = 'kjellander@webrtc.org (Henrik Kjellander)'
"""Utility class to build Chromium with the latest WebRTC.
Based on chromium_factory.py and adds WebRTC-specific custom_deps."""
from master.factory import chromium_factory
from webrtc_buildbot import webrtc_commands
class ChromiumWebRTCFactory(chromium_factory.ChromiumFactory):
# gclient additional custom deps
CUSTOM_DEPS_WEBRTC_LATEST = ('src/third_party/webrtc',
'http://webrtc.googlecode.com/svn/stable/src')
def ChromiumWebRTCLatestFactory(self, target='Release', clobber=False,
tests=None, mode=None,
slave_type='BuilderTester', options=None,
compile_timeout=1200, build_url=None,
project=None, factory_properties=None):
self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_WEBRTC_LATEST]
factory = self.ChromiumFactory(target, clobber, tests, mode, slave_type,
options, compile_timeout, build_url, project,
factory_properties)
webrtc_cmd_obj = webrtc_commands.WebRTCCommands(factory, target,
self._build_dir,
self._target_platform)
webrtc_cmd_obj.AddCompilePeerConnectionServerStep()
webrtc_cmd_obj.AddPyAutoTests(factory_properties)
return factory
def ChromiumWebRTCBloatFactory(self, target='Release', clobber=False,
tests=None, mode=None,
slave_type='BuilderTester', options=None,
compile_timeout=1200, build_url=None,
project=None, factory_properties=None):
self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_WEBRTC_LATEST]
factory = self.ChromiumFactory(target, clobber, tests, mode, slave_type,
options, compile_timeout, build_url, project,
factory_properties)
webrtc_cmd_obj = webrtc_commands.WebRTCCommands(factory, target,
self._build_dir,
self._target_platform)
webrtc_cmd_obj.AddBloatCalculationStep(factory_properties)
return factory

View File

@@ -0,0 +1,108 @@
#!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
__author__ = 'kjellander@webrtc.org (Henrik Kjellander)'
"""Set of utilities to add commands to a buildbot factory.
This is based on chromium_commands.py and adds WebRTC-specific commands."""
from buildbot.steps.shell import ShellCommand
from master.factory import chromium_commands
from webrtc_buildbot import utils
DEFAULT_BLOAT_DIR = '/var/www/bloat'
DEFAULT_BLOAT_URL = 'http://webrtc-chrome.lul/bloat/webrtc_bloat.html'
class PlatformNotSupportedException(Exception): pass
class MissingGypDefineException(Exception): pass
class WebRTCCommands(chromium_commands.ChromiumCommands):
"""Encapsulates methods to add WebRTC commands to a buildbot factory."""
def __init__(self, factory=None, target=None, build_dir=None,
target_platform=None, target_arch=None):
chromium_commands.ChromiumCommands.__init__(self, factory, target,
build_dir, target_platform)
self._arch = target_arch
self._factory = factory
def AddPyAutoTests(self, factory_properties=None, timeout=1200):
"""Adds WebRTC PyAuto test steps."""
# The WEBRTC group lists the PyAuto tests we have written for WebRTC.
# It's located at: src/chrome/test/functional/PYAUTO_TESTS
self.AddPyAutoFunctionalTest('WebRTC functional PyAuto test',
suite='WEBRTC', timeout=timeout, perf=False,
factory_properties=factory_properties)
def AddCompilePeerConnectionServerStep(self):
# Add platform dependent peerconnection_server compilation:
solution = None
options = None
if self._target_platform.startswith('linux'):
options=['peerconnection_server']
elif self._target_platform.startswith('win'):
solution=r'..\third_party\libjingle\libjingle.sln;peerconnection_server'
elif self._target_platform is 'mac':
options=['--', '-project', '../third_party/libjingle/libjingle.xcodeproj',
'-target', 'peerconnection_server'],
else:
raise PlatformNotSupportedException(
'Platform "%s" is not currently supported.' % self._target_platform)
self.AddCompileStep(solution=solution,
options=options,
description='compiling peerconnection_server',
descriptionDone='compile peerconnection_server')
def AddBloatCalculationStep(self, factory_properties):
"""Runs a bloat calculation, which will yield a size breakdown for Chrome.
If running in Release mode, you should also run with profiling to get the
symbols right. Running this on Debug mode will work but it will probably
take hours.
This step command is only supported on Linux platforms.
"""
if self._target is 'Release':
factory = factory_properties
if not (factory.has_key('gclient_env') and
factory['gclient_env'].has_key('GYP_DEFINES') and
factory['gclient_env']['GYP_DEFINES'].find('profiling=1') != -1):
raise MissingGypDefineException(
'You must add a dictionary to the gclient_env factory property'
'containing a key GYP_DEFINES and a value containing profiling=1.')
bloat_path = self.PathJoin(utils.WEBRTC_BUILD_DIR, '..', '..', '..', '..',
'..', '..', 'build_internal', 'symsrc',
'calculate_bloat.py')
output_filename = self.PathJoin(DEFAULT_BLOAT_DIR, 'bloat_latest.json')
chrome_binary = self.PathJoin('out', self._target, 'chrome')
cmd = [bloat_path, '--binary', chrome_binary, '--source-path', '.',
'--output-file', output_filename]
self._factory.addStep(ShellCommandWithUrl(command=cmd,
url=DEFAULT_BLOAT_URL,
description='calculate bloat',
warnOnFailure=True,
workdir='build/src',
timeout=7200))
class ShellCommandWithUrl(ShellCommand):
"""A regular shell command which posts a link when it's done."""
def __init__(self, url, **kwargs):
ShellCommand.__init__(self, **kwargs)
self.addFactoryArguments(url=url)
self.url = url
def createSummary(self, log):
self.addURL('click here', self.url)