2011-12-21 13:29:42 +01:00
|
|
|
#!/usr/bin/env python
|
2012-01-24 14:38:42 +01:00
|
|
|
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-12-21 13:29:42 +01:00
|
|
|
#
|
|
|
|
# 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__ = 'ivinnichenko@webrtc.org (Illya Vinnichenko)'
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
2012-02-15 15:39:51 +01:00
|
|
|
import urlparse
|
2012-02-21 15:32:49 +01:00
|
|
|
from buildbot.process import factory
|
|
|
|
from buildbot.process import properties
|
|
|
|
from buildbot.process.properties import WithProperties
|
|
|
|
from buildbot.steps import shell
|
|
|
|
from buildbot.steps.shell import ShellCommand
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-04 10:41:26 +01:00
|
|
|
# Defines the order of the booleans of the supported platforms in the test
|
|
|
|
# dictionaries in master.cfg.
|
2012-02-15 15:39:51 +01:00
|
|
|
SUPPORTED_PLATFORMS = ('Linux', 'Mac', 'Windows')
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
SVN_LOCATION = 'http://webrtc.googlecode.com/svn/trunk'
|
|
|
|
VALGRIND_CMD = ['tools/valgrind-webrtc/webrtc_tests.sh', '-t', 'cmdline']
|
2012-02-07 16:51:18 +01:00
|
|
|
|
2012-02-16 15:04:14 +01:00
|
|
|
DEFAULT_COVERAGE_DIR = '/var/www/coverage/'
|
2012-02-14 09:51:11 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
# Copied from trunk/tools/build/scripts/master/factory/chromium_factory.py
|
2012-02-07 16:51:18 +01:00
|
|
|
# but converted to a list since we set defines instead of using an environment
|
|
|
|
# variable.
|
|
|
|
#
|
|
|
|
# On valgrind bots, override the optimizer settings so we don't inline too
|
|
|
|
# much and make the stacks harder to figure out. Use the same settings
|
|
|
|
# on all buildbot masters to make it easier to move bots.
|
|
|
|
MEMORY_TOOLS_GYP_DEFINES = [
|
2012-02-21 15:32:49 +01:00
|
|
|
# GCC flags
|
|
|
|
'mac_debug_optimization=1 ',
|
|
|
|
'mac_release_optimization=1 ',
|
|
|
|
'release_optimize=1 ',
|
|
|
|
'no_gc_sections=1 ',
|
|
|
|
'debug_extra_cflags="-g -fno-inline -fno-omit-frame-pointer '
|
|
|
|
'-fno-builtin -fno-optimize-sibling-calls" ',
|
|
|
|
'release_extra_cflags="-g -fno-inline -fno-omit-frame-pointer '
|
|
|
|
'-fno-builtin -fno-optimize-sibling-calls" ',
|
|
|
|
# MSVS flags
|
|
|
|
'win_debug_RuntimeChecks=0 ',
|
|
|
|
'win_debug_disable_iterator_debugging=1 ',
|
|
|
|
'win_debug_Optimization=1 ',
|
|
|
|
'win_debug_InlineFunctionExpansion=0 ',
|
|
|
|
'win_release_InlineFunctionExpansion=0 ',
|
|
|
|
'win_release_OmitFramePointers=0 ',
|
|
|
|
|
|
|
|
'linux_use_tcmalloc=1 ',
|
|
|
|
'release_valgrind_build=1 ',
|
|
|
|
'werror= ',
|
2012-02-07 16:51:18 +01:00
|
|
|
]
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-21 15:32:49 +01:00
|
|
|
|
2011-12-21 13:29:42 +01:00
|
|
|
class WebRTCFactory(factory.BuildFactory):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Abstract superclass for all build factories.
|
|
|
|
|
|
|
|
A build factory defines a sequence of steps to take in a build process.
|
|
|
|
This class provides some helper methods and some abstract methods that
|
|
|
|
can be overridden to create customized build sequences.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
factory.BuildFactory.__init__(self)
|
2012-01-24 18:40:21 +01:00
|
|
|
|
2011-12-21 13:29:42 +01:00
|
|
|
self.properties = properties.Properties()
|
2012-02-15 15:39:51 +01:00
|
|
|
self.build_enabled = False
|
2011-12-21 13:29:42 +01:00
|
|
|
self.force_sync = False
|
|
|
|
self.gyp_params = []
|
|
|
|
self.release = False
|
|
|
|
|
|
|
|
def EnableBuild(self, force_sync):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Adds steps for building WebRTC [must be overridden].
|
|
|
|
|
|
|
|
Implementations of this method must add clean and build steps so that
|
|
|
|
when all steps have been run, we have an up-to-date, complete and correct
|
|
|
|
build of WebRTC for the platform. It is up to the method how to do this.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
force_sync: the method must pass --force to 'gclient sync' if it is
|
2012-02-20 16:21:44 +01:00
|
|
|
used.
|
2012-02-15 15:39:51 +01:00
|
|
|
"""
|
2011-12-21 13:29:42 +01:00
|
|
|
pass
|
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def EnableTests(self, tests):
|
|
|
|
"""Adds test run steps for all tests in the list.
|
|
|
|
|
|
|
|
This method must be run after enabling the build.
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
Args:
|
|
|
|
tests: list of test to be run.
|
2011-12-21 13:29:42 +01:00
|
|
|
"""
|
2012-02-15 15:39:51 +01:00
|
|
|
for test in tests:
|
|
|
|
self.EnableTest(test)
|
|
|
|
|
|
|
|
def AddCommonStep(self, cmd, descriptor='', workdir='build',
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=True, warn_on_failure=False):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Adds a common step which will run as a shell command on the slave.
|
|
|
|
|
|
|
|
A common step can be anything except a test execution step.
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
Args:
|
|
|
|
cmd: The command to run. This command follows the contract for
|
2012-02-20 16:21:44 +01:00
|
|
|
ShellCommand, so see that documentation for more details.
|
2012-02-15 15:39:51 +01:00
|
|
|
descriptor: A string, or a list of strings, describing what the step
|
2012-02-20 16:21:44 +01:00
|
|
|
does. The descriptor gets printed in the waterfall display.
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir: The working directory to run the command in.
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure: Stops the build dead in its tracks if this step
|
|
|
|
fails. Use for critical steps. This option does not make sense with
|
|
|
|
warn_on_failure.
|
|
|
|
warn_on_failure: If true, this step isn't that important and will not
|
|
|
|
cause a failed build on failure.
|
2012-02-15 15:39:51 +01:00
|
|
|
"""
|
2012-02-21 15:32:49 +01:00
|
|
|
flunk_on_failure = not warn_on_failure
|
|
|
|
|
2012-01-24 14:38:42 +01:00
|
|
|
if type(descriptor) is str:
|
|
|
|
descriptor = [descriptor]
|
2012-02-21 15:32:49 +01:00
|
|
|
# Add spaces to wrap long test names to make waterfall output more compact.
|
|
|
|
wrapped_text = self._WrapLongLines(descriptor)
|
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
self.addStep(shell.ShellCommand(command=cmd, workdir=workdir,
|
2012-02-21 15:32:49 +01:00
|
|
|
description=wrapped_text + ['running...'],
|
|
|
|
descriptionDone=wrapped_text,
|
2012-02-15 15:39:51 +01:00
|
|
|
warnOnFailure=warn_on_failure,
|
|
|
|
flunkOnFailure=flunk_on_failure,
|
2012-02-20 16:21:44 +01:00
|
|
|
haltOnFailure=halt_build_on_failure,
|
2012-02-20 17:49:55 +01:00
|
|
|
name='_'.join(descriptor)))
|
2012-02-15 15:39:51 +01:00
|
|
|
|
|
|
|
def AddCommonTestRunStep(self, test, descriptor='', cmd=None,
|
|
|
|
workdir='build/trunk'):
|
|
|
|
"""Adds a step for running a single test [must be overridden].
|
|
|
|
|
2012-02-20 16:21:44 +01:00
|
|
|
In general, failing tests should not halt the build and allow other tests
|
|
|
|
to execute. A failing test should fail, or 'flunk', the build though.
|
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
Args:
|
|
|
|
test: The test binary name. The step will attempt to execute this
|
2012-02-20 16:21:44 +01:00
|
|
|
binary in the binary output folder, except if the cmd argument is
|
|
|
|
defined (in that case, we will run cmd instead and just use the
|
|
|
|
test name in the descriptor).
|
2012-02-15 15:39:51 +01:00
|
|
|
descriptor: This should either be a string or a list of strings. The
|
2012-02-20 16:21:44 +01:00
|
|
|
descriptor or descriptors are appended to the test name and
|
|
|
|
displayed in the waterfall.
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd: If necessary, you can specify this argument to override the
|
2012-02-20 16:21:44 +01:00
|
|
|
default behavior, which is to just run the binary specified in
|
|
|
|
test without arguments.
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir: The base working directory to run the command in. This
|
2012-02-20 16:21:44 +01:00
|
|
|
directory will map to the WebRTC project root, e.g. the trunk
|
|
|
|
directory. This method will make sure that the test binary is run
|
|
|
|
in the correct output directory for the platform.
|
2012-02-15 15:39:51 +01:00
|
|
|
"""
|
2011-12-21 13:29:42 +01:00
|
|
|
pass
|
|
|
|
|
|
|
|
def EnableTest(self, test):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Makes a test run in the build sequence. May be overridden.
|
2012-02-04 10:41:26 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
Override to handle special cases for specific platforms, for instance if
|
|
|
|
a particular test binary requires command line arguments.
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
Args:
|
|
|
|
test: The test name to enable.
|
2011-12-21 13:29:42 +01:00
|
|
|
"""
|
2012-02-04 10:41:26 +01:00
|
|
|
self.AddCommonTestRunStep(test)
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def AddCommonGYPStep(self, gyp_file, gyp_params=[], descriptor='gyp'):
|
|
|
|
"""Helper method for invoking GYP on WebRTC.
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
GYP will generate makefiles or its equivalent in a platform-specific
|
2012-02-20 16:21:44 +01:00
|
|
|
manner. A failed GYP step will halt the build.
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
Args:
|
|
|
|
gyp_file: The root GYP file to use.
|
|
|
|
gyp_params: Custom GYP parameters (same semantics as the GYP_PARAMS
|
2012-02-20 16:21:44 +01:00
|
|
|
environment variable).
|
2012-02-15 15:39:51 +01:00
|
|
|
descriptor: The descriptor to use for the step.
|
|
|
|
"""
|
|
|
|
cmd = ['./build/gyp_chromium', '--depth=.', gyp_file]
|
|
|
|
cmd += gyp_params + self.gyp_params
|
2012-02-21 15:32:49 +01:00
|
|
|
self.AddCommonStep(cmd=cmd, workdir='build/trunk', descriptor=descriptor)
|
|
|
|
|
|
|
|
def _WrapLongLines(self, string_list, max_line_length=25, wrap_character='_'):
|
|
|
|
""" Creates a list with wrapped strings for lines that are too long.
|
|
|
|
|
|
|
|
This is done by inserting spaces to long lines with the wrap character
|
|
|
|
in. It's a simple way to make long test targets wrap nicer in the
|
|
|
|
waterfall display.
|
|
|
|
|
|
|
|
This method should only be used for lists that are displayed in the web
|
|
|
|
interface!
|
|
|
|
|
|
|
|
Args:
|
|
|
|
string_list: List of strings where each string represents one line.
|
|
|
|
max_line_length: Number of characters a line may have to avoid
|
|
|
|
getting wrapped.
|
|
|
|
wrap_character: The character we're looking for when inserting a
|
|
|
|
space if a string is larger than max_line_length. If no such
|
|
|
|
character is found, no space will be inserted.
|
|
|
|
Returns:
|
|
|
|
A new list of the same length as the input list, but with strings
|
|
|
|
that may contain extra spaces in them, if longer than the max
|
|
|
|
length.
|
|
|
|
"""
|
|
|
|
result = []
|
|
|
|
for line in string_list:
|
|
|
|
if len(line) > max_line_length:
|
|
|
|
index = line.rfind(wrap_character)
|
|
|
|
if index != -1:
|
|
|
|
line = line[:index] + ' ' + line[index:]
|
|
|
|
result.append(line)
|
|
|
|
return result
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
class GenerateCodeCoverage(ShellCommand):
|
|
|
|
"""This custom shell command generates coverage HTML using genhtml.
|
|
|
|
|
|
|
|
The command will dump the HTML output into coverage_dir, in a directory
|
|
|
|
whose name is generated from the build number and slave name. We will
|
2012-02-16 15:04:14 +01:00
|
|
|
expect that the coverage directory is somewhere under the web server root
|
|
|
|
(i.e. public html root) that corresponds to the web server URL. That is, if
|
|
|
|
we write Foo to the coverage directory we expect that directory to be
|
|
|
|
reachable from url/Foo.
|
2012-02-15 15:39:51 +01:00
|
|
|
"""
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def __init__(self, coverage_url, coverage_dir, coverage_file, **kwargs):
|
|
|
|
"""Prepares the coverage command.
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
Args:
|
|
|
|
coverage_url: The base URL for the serving web server we will use
|
2012-02-20 16:21:44 +01:00
|
|
|
when we generate the link to the coverage. This will generally
|
|
|
|
be the slave's URL (something like http://slave-hostname/).
|
2012-02-15 15:39:51 +01:00
|
|
|
coverage_dir: Where to write coverage HTML.
|
|
|
|
coverage_file: The LCOV file to generate the coverage from.
|
|
|
|
"""
|
2011-12-21 13:29:42 +01:00
|
|
|
ShellCommand.__init__(self, **kwargs)
|
|
|
|
self.addFactoryArguments(coverage_url=coverage_url,
|
2012-02-15 15:39:51 +01:00
|
|
|
coverage_dir=coverage_dir,
|
|
|
|
coverage_file=coverage_file)
|
2012-02-20 17:49:55 +01:00
|
|
|
self.setDefaultWorkdir('build/trunk')
|
2011-12-21 13:29:42 +01:00
|
|
|
self.coverage_url = coverage_url
|
|
|
|
self.coverage_dir = coverage_dir
|
2012-02-15 15:39:51 +01:00
|
|
|
self.coverage_file = coverage_file
|
2012-02-20 17:49:55 +01:00
|
|
|
self.description = ['Coverage Report']
|
2012-02-20 16:21:44 +01:00
|
|
|
self.warnOnFailure = True
|
|
|
|
self.flunkOnFailure = False
|
2012-02-15 15:39:51 +01:00
|
|
|
output_dir = os.path.join(coverage_dir,
|
|
|
|
'%(buildername)s_%(buildnumber)s')
|
|
|
|
self.setCommand(['./tools/continuous_build/generate_coverage_html.sh',
|
|
|
|
coverage_file, WithProperties(output_dir)])
|
2011-12-21 13:29:42 +01:00
|
|
|
|
|
|
|
def createSummary(self, log):
|
2012-02-15 15:39:51 +01:00
|
|
|
coverage_url = urlparse.urljoin(self.coverage_url,
|
|
|
|
'%s_%s' % (self.getProperty('buildername'),
|
|
|
|
self.getProperty('buildnumber')))
|
|
|
|
self.addURL('click here', coverage_url)
|
2012-01-24 18:40:21 +01:00
|
|
|
|
2011-12-21 13:29:42 +01:00
|
|
|
def start(self):
|
|
|
|
ShellCommand.start(self)
|
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
|
2012-01-24 14:38:42 +01:00
|
|
|
class WebRTCAndroidFactory(WebRTCFactory):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Sets up the Android build."""
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def __init__(self):
|
|
|
|
WebRTCFactory.__init__(self)
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def EnableBuild(self, product='toro'):
|
|
|
|
prefix = 'rm -rf out/target/product/%s/obj/' % product
|
2012-01-24 14:38:42 +01:00
|
|
|
cleanup_list = [
|
2012-02-21 15:32:49 +01:00
|
|
|
'rm -rf external/webrtc',
|
|
|
|
prefix + 'STATIC_LIBRARIES/libwebrtc_*',
|
|
|
|
prefix + 'SHARE_LIBRARIES/libwebrtc_*',
|
|
|
|
prefix + 'EXECUTABLES/webrtc_*'
|
|
|
|
]
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd = ' ; '.join(cleanup_list)
|
|
|
|
self.addStep(shell.Compile(command=(cmd), workdir='build/trunk',
|
2012-02-20 16:21:44 +01:00
|
|
|
description=['cleanup', 'running...'],
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptionDone=['cleanup'], name='cleanup'))
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd = 'svn checkout %s external/webrtc' % SVN_LOCATION
|
2012-01-24 14:38:42 +01:00
|
|
|
self.addStep(shell.Compile(command=(cmd),
|
2012-02-20 17:49:55 +01:00
|
|
|
workdir='build/trunk', description=['svn checkout', 'running...'],
|
|
|
|
descriptionDone=['svn checkout'], name='svn (checkout)'))
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd = ('source build/envsetup.sh && lunch full_%s-eng '
|
|
|
|
'&& mmm external/webrtc showcommands' % product)
|
2012-01-24 14:38:42 +01:00
|
|
|
self.addStep(shell.Compile(command=(cmd),
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir='build/trunk', description=['build', 'running...'],
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptionDone=['build'], name='build'))
|
2012-01-24 14:38:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
class WebRTCChromeFactory(WebRTCFactory):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Sets up the Chrome OS build."""
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def __init__(self):
|
|
|
|
WebRTCFactory.__init__(self)
|
2012-01-24 14:38:42 +01:00
|
|
|
|
|
|
|
def EnableBuild(self):
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['rm', '-rf', 'src'], descriptor='Cleanup')
|
|
|
|
cmd = ['gclient', 'sync', '--force']
|
|
|
|
self.AddCommonStep(cmd, descriptor='Sync')
|
|
|
|
self.AddCommonMakeStep('chrome')
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2012-02-20 17:49:55 +01:00
|
|
|
def AddCommonMakeStep(self, target, make_extra=None):
|
|
|
|
descriptor = ['make ' + target]
|
|
|
|
cmd = ['make', target, '-j100']
|
2012-01-24 14:38:42 +01:00
|
|
|
if make_extra is not None:
|
|
|
|
cmd.append(make_extra)
|
2012-02-21 15:32:49 +01:00
|
|
|
self.AddCommonStep(cmd=cmd, descriptor=descriptor, workdir='build/src')
|
2012-02-15 15:39:51 +01:00
|
|
|
|
2012-01-24 14:38:42 +01:00
|
|
|
|
2011-12-21 13:29:42 +01:00
|
|
|
class WebRTCLinuxFactory(WebRTCFactory):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Sets up the Linux build.
|
|
|
|
|
|
|
|
This factory is quite configurable and can run a variety of builds.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, valgrind_enabled=False):
|
|
|
|
WebRTCFactory.__init__(self)
|
|
|
|
|
|
|
|
self.coverage_enabled = False
|
|
|
|
self.valgrind_enabled = valgrind_enabled
|
|
|
|
|
|
|
|
def EnableCoverage(self, coverage_url, coverage_dir=DEFAULT_COVERAGE_DIR):
|
|
|
|
"""Enables coverage measurements using LCOV/GCOV.
|
|
|
|
|
|
|
|
This method must be called before enabling build.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
coverage_url: See the GenerateCodeCoverage command's contract for
|
2012-02-20 16:21:44 +01:00
|
|
|
this argument.
|
2012-02-15 15:39:51 +01:00
|
|
|
coverage_dir: See the GenerateCodeCoverage command's contract for
|
2012-02-20 16:21:44 +01:00
|
|
|
this argument.
|
2012-02-15 15:39:51 +01:00
|
|
|
"""
|
|
|
|
assert self.build_enabled is False
|
|
|
|
|
|
|
|
self.coverage_enabled = True
|
|
|
|
self.coverage_url = coverage_url
|
|
|
|
self.coverage_dir = coverage_dir
|
2011-12-21 13:29:42 +01:00
|
|
|
|
|
|
|
def EnableBuild(self, force_sync=False, release=False, build32=False,
|
|
|
|
chrome_os=False, clang=False):
|
|
|
|
if build32:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.gyp_params.append('-Dtarget_arch=ia32')
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
self.build_enabled = True
|
2011-12-21 13:29:42 +01:00
|
|
|
self.force_sync = force_sync
|
|
|
|
self.release = release
|
2012-02-13 13:16:50 +01:00
|
|
|
|
2012-02-20 16:21:44 +01:00
|
|
|
self.AddCommonStep(['rm', '-rf', 'trunk'], descriptor='Cleanup',
|
|
|
|
warn_on_failure=True, halt_build_on_failure=False)
|
2012-02-13 13:16:50 +01:00
|
|
|
|
2012-02-07 16:51:18 +01:00
|
|
|
# Valgrind bots need special GYP defines to enable memory profiling
|
2012-02-15 15:39:51 +01:00
|
|
|
# friendly compilation. They already has a custom .gclient configuration
|
|
|
|
# file created so they don't need one being generated like the other bots.
|
|
|
|
if self.valgrind_enabled:
|
2012-02-07 16:51:18 +01:00
|
|
|
for gyp_define in MEMORY_TOOLS_GYP_DEFINES:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.gyp_params.append('-D' + gyp_define)
|
2012-02-07 16:51:18 +01:00
|
|
|
else:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['gclient', 'config', SVN_LOCATION],
|
|
|
|
descriptor='gclient_config')
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd = ['gclient', 'sync']
|
2011-12-21 13:29:42 +01:00
|
|
|
if force_sync:
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd.append('--force')
|
|
|
|
self.AddCommonStep(cmd, descriptor='Sync')
|
2011-12-21 13:29:42 +01:00
|
|
|
if chrome_os:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.gyp_params.append('-Dchromeos=1')
|
2011-12-21 13:29:42 +01:00
|
|
|
|
|
|
|
if clang:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.gyp_params.append('-Dclang=1')
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
if self.coverage_enabled:
|
|
|
|
self.gyp_params.append('-Dcoverage=1')
|
|
|
|
self.AddCommonGYPStep('webrtc.gyp', descriptor='CommonGYP')
|
2011-12-21 13:29:42 +01:00
|
|
|
|
|
|
|
if clang:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['trunk/tools/clang/scripts/update.sh'],
|
|
|
|
descriptor='Update_Clang')
|
2012-01-24 18:40:21 +01:00
|
|
|
|
2011-12-21 13:29:42 +01:00
|
|
|
if self.release:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonMakeStep('all', make_extra='BUILDTYPE=Release')
|
2011-12-21 13:29:42 +01:00
|
|
|
else:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonMakeStep('all')
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-20 17:49:55 +01:00
|
|
|
def AddCommonTestRunStep(self, test, extra_text=None, cmd=None,
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir='build/trunk'):
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptor = [test, extra_text] if extra_text else [test]
|
2011-12-21 13:29:42 +01:00
|
|
|
if cmd is None:
|
2012-02-20 17:49:55 +01:00
|
|
|
test_folder = 'Release' if self.release else 'Debug'
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd = ['out/%s/%s' % (test_folder, test)]
|
|
|
|
if self.valgrind_enabled:
|
2012-02-07 16:51:18 +01:00
|
|
|
cmd = VALGRIND_CMD + cmd
|
2012-02-21 15:32:49 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor=descriptor, workdir=workdir,
|
|
|
|
halt_build_on_failure=False)
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-14 15:00:12 +01:00
|
|
|
def AddXvfbTestRunStep(self, test_name, test_binary, test_arguments=''):
|
|
|
|
""" Adds a test to be run inside a XVFB window manager."""
|
|
|
|
cmd = ('xvfb-run '
|
|
|
|
'--server-args="-screen 0 800x600x24 -extension Composite" '
|
|
|
|
'%s %s' % (test_binary, test_arguments))
|
|
|
|
self.AddCommonTestRunStep(test=test_name, cmd=cmd)
|
|
|
|
|
2012-02-20 17:49:55 +01:00
|
|
|
def AddCommonMakeStep(self, target, extra_text=None, make_extra=None):
|
|
|
|
descriptor = ['make ' + target, extra_text] if extra_text else ['make ' +
|
|
|
|
target]
|
|
|
|
cmd = ['make', target, '-j100']
|
|
|
|
if make_extra:
|
2011-12-21 13:29:42 +01:00
|
|
|
cmd.append(make_extra)
|
2012-02-21 15:32:49 +01:00
|
|
|
self.AddCommonStep(cmd=cmd, descriptor=descriptor, workdir='build/trunk')
|
2012-02-15 15:39:51 +01:00
|
|
|
|
|
|
|
def AddStepsToEstablishCoverageBaseline(self):
|
|
|
|
self.AddCommonStep(['lcov', '--directory', '.', '--capture', '-b',
|
|
|
|
'.', '--initial',
|
|
|
|
'--output-file', 'webrtc_base.info'],
|
|
|
|
workdir='build/trunk',
|
|
|
|
warn_on_failure=True,
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptor='LCOV (Baseline Capture)')
|
2012-01-24 14:38:42 +01:00
|
|
|
self.AddCommonStep(['lcov', '--extract', 'webrtc_base.info', '*/src/*',
|
|
|
|
'--output', 'filtered.info'],
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir='build/trunk',
|
|
|
|
warn_on_failure=True,
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptor='LCOV (Baseline Extract)')
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['lcov', '--remove', 'filtered.info', '*/usr/include/*',
|
|
|
|
'/third*', '/testing/*', '*/test/*', '*_unittest.*',
|
|
|
|
'*/mock/*', '--output',
|
|
|
|
'webrtc_base_filtered_final.info'],
|
|
|
|
workdir='build/trunk',
|
|
|
|
warn_on_failure=True,
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptor='LCOV (Baseline Filter)')
|
2012-02-15 15:39:51 +01:00
|
|
|
|
|
|
|
def AddStepsToComputeCoverage(self):
|
2012-01-24 14:38:42 +01:00
|
|
|
"""Enable coverage data."""
|
2012-02-13 13:16:50 +01:00
|
|
|
|
|
|
|
# Delete all third-party .gcda files to save time and work around a bug
|
|
|
|
# in lcov which tends to hang when capturing on libjpgturbo.
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['./tools/continuous_build/clean_third_party_gcda.sh'],
|
|
|
|
warn_on_failure=True,
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
workdir='build/trunk',
|
|
|
|
descriptor='LCOV (Delete 3rd party)')
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['lcov', '--directory', '.', '--capture', '-b',
|
|
|
|
'.', '--output-file', 'webrtc.info'],
|
|
|
|
warn_on_failure=True,
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
workdir='build/trunk',
|
|
|
|
descriptor='LCOV (Capture)')
|
2011-12-21 13:29:42 +01:00
|
|
|
self.AddCommonStep(['lcov', '--extract', 'webrtc.info', '*/src/*',
|
2012-02-20 16:21:44 +01:00
|
|
|
'--output', 'test.info'],
|
|
|
|
warn_on_failure=True,
|
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
workdir='build/trunk',
|
|
|
|
descriptor='LCOV (Extract)')
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['lcov', '--remove', 'test.info', '*/usr/include/*',
|
|
|
|
'/third*', '/testing/*', '*/test/*', '*_unittest.*',
|
|
|
|
'*/mock/*', '--output',
|
2012-02-20 16:21:44 +01:00
|
|
|
'final.info'],
|
|
|
|
warn_on_failure=True,
|
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
workdir='build/trunk',
|
|
|
|
descriptor='LCOV (Filter)')
|
2012-01-24 14:38:42 +01:00
|
|
|
self.AddCommonStep(['lcov', '-a', 'webrtc_base_filtered_final.info', '-a',
|
2012-02-20 16:21:44 +01:00
|
|
|
'final.info', '-o', 'final.info'],
|
|
|
|
warn_on_failure=True,
|
|
|
|
halt_build_on_failure=False,
|
2012-02-20 17:49:55 +01:00
|
|
|
workdir='build/trunk',
|
|
|
|
descriptor='LCOV (Merge)')
|
2011-12-21 13:29:42 +01:00
|
|
|
self.addStep(GenerateCodeCoverage(coverage_url=self.coverage_url,
|
2012-02-15 15:39:51 +01:00
|
|
|
coverage_dir=self.coverage_dir,
|
|
|
|
coverage_file='final.info'))
|
|
|
|
|
|
|
|
def EnableTests(self, tests):
|
|
|
|
if self.coverage_enabled:
|
|
|
|
self.AddStepsToEstablishCoverageBaseline()
|
|
|
|
|
|
|
|
WebRTCFactory.EnableTests(self, tests)
|
|
|
|
|
|
|
|
if self.coverage_enabled:
|
|
|
|
self.AddStepsToComputeCoverage()
|
2011-12-21 13:29:42 +01:00
|
|
|
|
|
|
|
def EnableTest(self, test):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Adds a step for running a test on Linux.
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
In general, this method will interpret the name as the name of a binary
|
|
|
|
in the default build output directory, except for a few special cases
|
|
|
|
which require custom command lines.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
test: the test name as a string.
|
2011-12-21 13:29:42 +01:00
|
|
|
"""
|
2012-02-15 15:39:51 +01:00
|
|
|
if test == 'audioproc_unittest':
|
2012-01-24 18:40:21 +01:00
|
|
|
self.AddCommonTestRunStep(test)
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonGYPStep('webrtc.gyp', gyp_params=['-Dprefer_fixed_point=1'],
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptor='GYP fixed point')
|
|
|
|
self.AddCommonMakeStep(test, extra_text='(fixed point)')
|
|
|
|
self.AddCommonTestRunStep(test, extra_text='(fixed point)')
|
2012-02-15 15:39:51 +01:00
|
|
|
elif test == 'vie_auto_test':
|
2012-02-07 13:13:58 +01:00
|
|
|
# TODO(phoglund): Enable the full stack test once it is completed and
|
|
|
|
# nonflaky.
|
2012-02-20 17:49:55 +01:00
|
|
|
binary = 'out/Debug/vie_auto_test'
|
2012-02-14 15:00:12 +01:00
|
|
|
args = (
|
|
|
|
'--automated --gtest_filter="'
|
|
|
|
'-ViEVideoVerificationTest.RunsFullStackWithoutErrors:'
|
|
|
|
'ViEExtendedIntegrationTest.*" '
|
|
|
|
'--capture_test_ensure_resolution_alignment_in_capture_device=false')
|
|
|
|
self.AddXvfbTestRunStep(test_name=test, test_binary=binary,
|
|
|
|
test_arguments=args)
|
2012-02-20 17:49:55 +01:00
|
|
|
elif test == 'video_render_module_test':
|
2012-02-14 15:00:12 +01:00
|
|
|
self.AddXvfbTestRunStep(test_name=test,
|
2012-02-15 15:39:51 +01:00
|
|
|
test_binary='out/Debug/video_render_module_test')
|
2012-02-20 17:49:55 +01:00
|
|
|
elif test == 'voe_auto_test':
|
2012-02-07 13:13:58 +01:00
|
|
|
# TODO(phoglund): Remove this notice and take appropriate action when
|
|
|
|
# http://code.google.com/p/webrtc/issues/detail?id=266 is concluded.
|
2012-02-21 15:32:49 +01:00
|
|
|
cmd = 'out/Debug/voe_auto_test --automated --gtest_filter="-VolumeTest.*"'
|
|
|
|
self.AddCommonTestRunStep(test=test, cmd=cmd)
|
2011-12-21 13:29:42 +01:00
|
|
|
else:
|
2012-02-04 10:41:26 +01:00
|
|
|
self.AddCommonTestRunStep(test)
|
2011-12-21 13:29:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
class WebRTCMacFactory(WebRTCFactory):
|
2012-02-15 15:39:51 +01:00
|
|
|
"""Sets up the Mac build, both for make and xcode."""
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def __init__(self):
|
|
|
|
WebRTCFactory.__init__(self)
|
|
|
|
self.build_type = 'both'
|
|
|
|
self.allowed_build_types = ['both', 'xcode', 'make']
|
2011-12-21 13:29:42 +01:00
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
def EnableBuild(self, force_sync=True, build_type='both', release=False):
|
|
|
|
self.build_enabled = True
|
2011-12-21 13:29:42 +01:00
|
|
|
self.force_sync = force_sync
|
|
|
|
self.release = release
|
2012-02-20 16:21:44 +01:00
|
|
|
|
2011-12-21 13:29:42 +01:00
|
|
|
if build_type not in self.allowed_build_types:
|
2012-02-15 15:39:51 +01:00
|
|
|
print '*** INCORRECT BUILD TYPE (%s)!!! ***' % build_type
|
2011-12-21 13:29:42 +01:00
|
|
|
sys.exit(0)
|
|
|
|
else:
|
|
|
|
self.build_type = build_type
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['rm', '-rf', 'trunk'], descriptor='Cleanup')
|
|
|
|
self.AddCommonStep(['gclient', 'config', SVN_LOCATION],
|
|
|
|
descriptor='gclient_config')
|
|
|
|
cmd = ['gclient', 'sync']
|
2011-12-21 13:29:42 +01:00
|
|
|
if force_sync:
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd.append('--force')
|
|
|
|
self.AddCommonStep(cmd, descriptor='Sync')
|
|
|
|
if self.build_type == 'make' or self.build_type == 'both':
|
|
|
|
self.AddCommonGYPStep('webrtc.gyp', gyp_params=['-f', 'make'],
|
|
|
|
descriptor='EnableMake')
|
|
|
|
self.AddCommonMakeStep('all')
|
|
|
|
|
2012-02-20 17:49:55 +01:00
|
|
|
def AddCommonTestRunStep(self, test, extra_text=None, cmd=None,
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir='build/trunk'):
|
2012-02-20 17:49:55 +01:00
|
|
|
descriptor = [test, extra_text] if extra_text else [test]
|
2011-12-21 13:29:42 +01:00
|
|
|
if cmd is None:
|
2012-02-20 17:49:55 +01:00
|
|
|
test_folder = 'Release' if self.release else 'Debug'
|
2012-02-15 15:39:51 +01:00
|
|
|
if self.build_type == 'xcode' or self.build_type == 'both':
|
|
|
|
cmd = ['xcodebuild/%s/%s' % (test_folder, test)]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor=descriptor + ['(xcode)'],
|
2012-02-21 15:32:49 +01:00
|
|
|
halt_build_on_failure=False,
|
|
|
|
workdir=workdir)
|
2012-02-15 15:39:51 +01:00
|
|
|
if self.build_type == 'make' or self.build_type == 'both':
|
|
|
|
cmd = ['out/%s/%s' % (test_folder, test)]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor=descriptor + ['(make)'],
|
2012-02-21 15:32:49 +01:00
|
|
|
halt_build_on_failure=False,
|
|
|
|
workdir=workdir)
|
2012-02-15 15:39:51 +01:00
|
|
|
|
2012-02-20 17:49:55 +01:00
|
|
|
def AddCommonMakeStep(self, target, extra_text=None, make_extra=None):
|
|
|
|
descriptor = [target, extra_text] if extra_text else [target]
|
2012-02-15 15:39:51 +01:00
|
|
|
if self.build_type == 'make' or self.build_type == 'both':
|
2012-02-20 17:49:55 +01:00
|
|
|
cmd = ['make', target, '-j100']
|
2011-12-21 13:29:42 +01:00
|
|
|
if make_extra is not None:
|
|
|
|
cmd.append(make_extra)
|
2012-02-08 15:36:22 +01:00
|
|
|
if self.release:
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd.append('BUILDTYPE=Release')
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor=descriptor + ['(make)'],
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir='build/trunk')
|
|
|
|
if self.build_type == 'xcode' or self.build_type == 'both':
|
|
|
|
configuration = 'Release' if self.release else 'Debug'
|
|
|
|
cmd = ['xcodebuild', '-project', 'webrtc.xcodeproj', '-configuration',
|
|
|
|
configuration, '-target', 'All']
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor=descriptor + ['(xcode)'],
|
2012-02-15 15:39:51 +01:00
|
|
|
workdir='build/trunk')
|
|
|
|
|
2011-12-21 13:29:42 +01:00
|
|
|
class WebRTCWinFactory(WebRTCFactory):
|
2012-02-20 17:49:55 +01:00
|
|
|
"""Sets up the Windows build.
|
|
|
|
|
2012-02-21 15:32:49 +01:00
|
|
|
Allows building with Debug, Release or both in sequence.
|
|
|
|
"""
|
2012-02-15 15:39:51 +01:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
WebRTCFactory.__init__(self)
|
|
|
|
self.configuration = 'Debug'
|
|
|
|
self.platform = 'x64'
|
|
|
|
self.allowed_platforms = ['x64', 'Win32']
|
|
|
|
self.allowed_configurations = ['Debug', 'Release', 'both']
|
|
|
|
|
|
|
|
def EnableBuild(self, force_sync=True, platform='Win32',
|
|
|
|
configuration='Debug', build_only=False):
|
|
|
|
self.build_enabled = True
|
2011-12-21 13:29:42 +01:00
|
|
|
self.force_sync = force_sync
|
|
|
|
if platform not in self.allowed_platforms:
|
2012-02-15 15:39:51 +01:00
|
|
|
print '*** INCORRECT PLATFORM (%s)!!! ***' % platform
|
2011-12-21 13:29:42 +01:00
|
|
|
sys.exit(0)
|
|
|
|
else:
|
|
|
|
self.platform = platform
|
|
|
|
if configuration not in self.allowed_configurations:
|
2012-02-15 15:39:51 +01:00
|
|
|
print '*** INCORRECT CONFIGURATION (%s)!!! ***' % configuration
|
2011-12-21 13:29:42 +01:00
|
|
|
sys.exit(0)
|
|
|
|
else:
|
|
|
|
self.configuration = configuration
|
|
|
|
if not build_only:
|
2012-02-15 15:39:51 +01:00
|
|
|
self.AddCommonStep(['rm', '-rf', 'trunk'], descriptor='Cleanup')
|
|
|
|
self.AddCommonStep(['gclient', 'config', SVN_LOCATION],
|
|
|
|
descriptor='gclient_config')
|
|
|
|
cmd = ['gclient', 'sync']
|
2011-12-21 13:29:42 +01:00
|
|
|
if force_sync:
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd.append('--force')
|
|
|
|
self.AddCommonStep(cmd, descriptor='Sync')
|
|
|
|
|
|
|
|
if self.configuration == 'Debug' or self.configuration == 'both':
|
|
|
|
cmd = ['msbuild', 'webrtc.sln', '/t:Clean',
|
|
|
|
'/p:Configuration=Debug;Platform=%s' % (self.platform)]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor='Build(Clean)', workdir='build/trunk')
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd = ['msbuild', 'webrtc.sln',
|
|
|
|
'/p:Configuration=Debug;Platform=%s' % (self.platform)]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor='Build(Debug)', workdir='build/trunk')
|
2012-02-15 15:39:51 +01:00
|
|
|
if self.configuration == 'Release' or self.configuration == 'both':
|
|
|
|
cmd = ['msbuild', 'webrtc.sln', '/t:Clean',
|
|
|
|
'/p:Configuration=Release;Platform=%s' % (self.platform)]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor='Build(Clean)', workdir='build/trunk')
|
2012-02-15 15:39:51 +01:00
|
|
|
cmd = ['msbuild', 'webrtc.sln',
|
|
|
|
'/p:Configuration=Release;Platform=%s' % (self.platform)]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor='Build(Release)',
|
|
|
|
workdir='build/trunk')
|
2012-02-15 15:39:51 +01:00
|
|
|
|
2012-02-20 17:49:55 +01:00
|
|
|
def AddCommonTestRunStep(self, test, cmd=None, workdir='build/trunk'):
|
|
|
|
descriptor = [test]
|
2011-12-21 13:29:42 +01:00
|
|
|
if cmd is None:
|
2012-02-15 15:39:51 +01:00
|
|
|
if self.configuration == 'Debug' or self.configuration == 'both':
|
|
|
|
cmd = ['build\Debug\%s.exe' % test]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor=descriptor,
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=False,
|
2011-12-21 13:29:42 +01:00
|
|
|
workdir=workdir)
|
2012-02-15 15:39:51 +01:00
|
|
|
if self.configuration == 'Release' or self.configuration == 'both':
|
|
|
|
cmd = ['build\Release\%s.exe' % test]
|
2012-02-20 17:49:55 +01:00
|
|
|
self.AddCommonStep(cmd, descriptor=descriptor,
|
2012-02-20 16:21:44 +01:00
|
|
|
halt_build_on_failure=False,
|
2011-12-21 13:29:42 +01:00
|
|
|
workdir=workdir)
|
|
|
|
|
2012-02-04 10:41:26 +01:00
|
|
|
# Utility functions
|
|
|
|
|
2012-02-15 15:39:51 +01:00
|
|
|
|
2012-02-04 10:41:26 +01:00
|
|
|
class UnsupportedPlatformError(Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def GetEnabledTests(test_dict, platform):
|
|
|
|
"""Returns a list of enabled test names for the provided platform.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
test_dict: Dictionary mapping test names to tuples representing if the
|
2012-02-20 16:21:44 +01:00
|
|
|
test shall be enabled on each platform. Each tuple contains one
|
|
|
|
boolean for each platform. The platforms are in the order specified
|
|
|
|
by SUPPORTED_PLATFORMS.
|
2012-02-04 10:41:26 +01:00
|
|
|
platform: The platform we're looking to get the tests for.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
A list of test names, sorted alphabetically.
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
UnsupportedPlatformError: if the platform supplied is not supported.
|
|
|
|
"""
|
|
|
|
if platform not in SUPPORTED_PLATFORMS:
|
2012-02-15 15:39:51 +01:00
|
|
|
raise UnsupportedPlatformError('*** UNSUPPORTED PLATFORM (%s)!!! ***' %
|
2012-02-04 10:41:26 +01:00
|
|
|
platform)
|
|
|
|
result = []
|
|
|
|
platform_index = SUPPORTED_PLATFORMS.index(platform)
|
|
|
|
for test_name, enabled_platforms in test_dict.iteritems():
|
|
|
|
if enabled_platforms[platform_index]:
|
|
|
|
result.append(test_name)
|
|
|
|
result.sort()
|
2012-02-07 16:51:18 +01:00
|
|
|
return result
|