Fixed comments and added new flags for the PyAuto test.

The ChromeBloat bot will now also be ignored for LKGRs.

BUG=
TEST=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2169 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org
2012-05-03 14:21:14 +00:00
parent 54536bb6d4
commit 0b7ba967f5

View File

@@ -73,9 +73,9 @@ MEMORY_TOOLS_GYP_DEFINES = [
class WebRTCFactory(factory.BuildFactory): class WebRTCFactory(factory.BuildFactory):
"""Abstract superclass for all build factories. """Abstract superclass for all build factories.
A build factory defines a sequence of steps to take in a build process. 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 This class provides some helper methods and some abstract methods that
can be overridden to create customized build sequences. can be overridden to create customized build sequences.
""" """
def __init__(self, build_status_oracle, is_try_slave=False, def __init__(self, build_status_oracle, is_try_slave=False,
@@ -84,17 +84,17 @@ class WebRTCFactory(factory.BuildFactory):
custom_deps_list=None, safesync_url=None): custom_deps_list=None, safesync_url=None):
"""Creates the abstract factory. """Creates the abstract factory.
Args: Args:
build_status_oracle: An instance of BuildStatusOracle which is used to build_status_oracle: An instance of BuildStatusOracle which is used to
keep track of our build state. keep track of our build state.
is_try_slave: If this bot is a try slave. Needed since we're handling is_try_slave: If this bot is a try slave. Needed since we're handling
some things differently between normal slaves and try slaves. some things differently between normal slaves and try slaves.
gclient_solution_name: The name of the solution used for gclient. gclient_solution_name: The name of the solution used for gclient.
svn_url: The Subversion URL for gclient to sync agains. svn_url: The Subversion URL for gclient to sync agains.
custom_deps_list: Content to be put in the custom_deps entry of the custom_deps_list: Content to be put in the custom_deps entry of the
.gclient file. The parameter must be a list of tuples with two .gclient file. The parameter must be a list of tuples with two
strings in each: path and remote URL. strings in each: path and remote URL.
safesync_url: If a LKGR URL shall be used for the gclient sync command. safesync_url: If a LKGR URL shall be used for the gclient sync command.
""" """
factory.BuildFactory.__init__(self) factory.BuildFactory.__init__(self)
@@ -113,19 +113,19 @@ class WebRTCFactory(factory.BuildFactory):
def EnableBuild(self): def EnableBuild(self):
"""Adds steps for building WebRTC [must be overridden]. """Adds steps for building WebRTC [must be overridden].
Implementations of this method must add clean and build steps so that 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 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. build of WebRTC for the platform. It is up to the method how to do this.
""" """
pass pass
def EnableTests(self, tests): def EnableTests(self, tests):
"""Adds test run steps for all tests in the list. """Adds test run steps for all tests in the list.
This method must be run after enabling the build. This method must be run after enabling the build.
Args: Args:
tests: list of test to be run. tests: list of test to be run.
""" """
for test in tests: for test in tests:
self.EnableTest(test) self.EnableTest(test)
@@ -135,35 +135,35 @@ class WebRTCFactory(factory.BuildFactory):
timeout=1200, use_pty=True): timeout=1200, use_pty=True):
"""Adds a step which will run as a shell command on the slave. """Adds a step which will run as a shell command on the slave.
NOTE: you are recommended to use this method to add new shell commands NOTE: you are recommended to use this method to add new shell commands
instead of the base-class addStep method, since steps added here will instead of the base-class addStep method, since steps added here will
work with the smart-clean system (e.g. only do a full rebuild if the work with the smart-clean system (e.g. only do a full rebuild if the
previous build failed). Steps handled outside this method will not lead previous build failed). Steps handled outside this method will not lead
to a full rebuild on the next build if they fail. to a full rebuild on the next build if they fail.
Args: Args:
cmd: The command to run. This command follows the contract for cmd: The command to run. This command follows the contract for
ShellCommand, so see that documentation for more details. ShellCommand, so see that documentation for more details.
descriptor: A string, or a list of strings, describing what the step descriptor: A string, or a list of strings, describing what the step
does. The descriptor gets printed in the waterfall display. does. The descriptor gets printed in the waterfall display.
workdir: The working directory to run the command in, relative to workdir: The working directory to run the command in, relative to
the bot's build name directory. The WebRTC root will generally be the bot's build name directory. The WebRTC root will generally be
in build/trunk/ relative to that directory. The caller is in build/trunk/ relative to that directory. The caller is
responsible for making sure that the slashes are flipped the right responsible for making sure that the slashes are flipped the right
way depending on platform, which means you can't use the default way depending on platform, which means you can't use the default
value if the step will run on a Windows machine. value if the step will run on a Windows machine.
halt_build_on_failure: Stops the build dead in its tracks if this step 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 fails. Use for critical steps. This option does not make sense with
warn_on_failure. warn_on_failure.
warn_on_failure: If true, this step isn't that important and will not warn_on_failure: If true, this step isn't that important and will not
cause a failed build on failure. cause a failed build on failure.
timeout: The timeout for the command, in seconds. timeout: The timeout for the command, in seconds.
use_pty: If Pseudo-terminal shall be enabled for the command. This is use_pty: If Pseudo-terminal shall be enabled for the command. This is
needed if stdout and stderr output shall be collected needed if stdout and stderr output shall be collected
separately, which is useful to make it possible to color-code separately, which is useful to make it possible to color-code
stderr output with red in the web interface. Some shell stderr output with red in the web interface. Some shell
commands seem to fail when Pseudo-terminal is enabled on commands seem to fail when Pseudo-terminal is enabled on
Linux. Linux.
""" """
flunk_on_failure = not warn_on_failure flunk_on_failure = not warn_on_failure
@@ -189,8 +189,8 @@ class WebRTCFactory(factory.BuildFactory):
def AddSmartCleanStep(self): def AddSmartCleanStep(self):
"""Adds a smart clean step. """Adds a smart clean step.
Smart clean only cleans the whole repository if the build status oracle Smart clean only cleans the whole repository if the build status oracle
thinks the last build failed. Otherwise it cleans just the build output. thinks the last build failed. Otherwise it cleans just the build output.
""" """
self.addStep(SmartClean(self.build_status_oracle, self.is_try_slave, self.addStep(SmartClean(self.build_status_oracle, self.is_try_slave,
self.path_joiner, workdir=WEBRTC_BUILD_DIR)) self.path_joiner, workdir=WEBRTC_BUILD_DIR))
@@ -198,37 +198,37 @@ class WebRTCFactory(factory.BuildFactory):
def AddCommonTestRunStep(self, test, descriptor='', cmd=None): def AddCommonTestRunStep(self, test, descriptor='', cmd=None):
"""Adds a step for running a single test [must be overridden]. """Adds a step for running a single test [must be overridden].
In general, failing tests should not halt the build and allow other tests 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. to execute. A failing test should fail, or 'flunk', the build though.
The working directory for this command will be the WebRTC root directory The working directory for this command will be the WebRTC root directory
(generally build/trunk). (generally build/trunk).
Implementations of this method must add new steps through AddCommonStep Implementations of this method must add new steps through AddCommonStep
and not by calling addStep. and not by calling addStep.
Args: Args:
test: The test binary name. The step will attempt to execute this test: The test binary name. The step will attempt to execute this
binary in the binary output folder, except if the cmd argument is 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 defined (in that case, we will run cmd instead and just use the
test name in the descriptor). test name in the descriptor).
descriptor: This should either be a string or a list of strings. The descriptor: This should either be a string or a list of strings. The
descriptor or descriptors are appended to the test name and descriptor or descriptors are appended to the test name and
displayed in the waterfall. displayed in the waterfall.
cmd: If necessary, you can specify this argument to override the cmd: If necessary, you can specify this argument to override the
default behavior, which is to just run the binary specified in default behavior, which is to just run the binary specified in
test without arguments. test without arguments.
""" """
raise NotImplementedError('Must be overridden') raise NotImplementedError('Must be overridden')
def EnableTest(self, test): def EnableTest(self, test):
"""Makes a test run in the build sequence. May be overridden. """Makes a test run in the build sequence. May be overridden.
Override to handle special cases for specific platforms, for instance if Override to handle special cases for specific platforms, for instance if
a particular test binary requires command line arguments. a particular test binary requires command line arguments.
Args: Args:
test: The test name to enable. test: The test name to enable.
""" """
self.AddCommonTestRunStep(test) self.AddCommonTestRunStep(test)
@@ -237,12 +237,12 @@ class WebRTCFactory(factory.BuildFactory):
"""Helper method for invoking gclient sync. """Helper method for invoking gclient sync.
Args: Args:
workdir: The name of the directory to checkout the source into. workdir: The name of the directory to checkout the source into.
The default is 'build' which is the base working dir of The default is 'build' which is the base working dir of
most build slaves. most build slaves.
always_use_latest: Set to true to always use the latest build, always_use_latest: Set to true to always use the latest build,
otherwise the highest revision in the changeset will otherwise the highest revision in the changeset will
be used for sync. be used for sync.
""" """
gclient_spec = self._ConfigureWhatToBuild() gclient_spec = self._ConfigureWhatToBuild()
env = self._GetEnvironmentWithDisabledDepotToolsUpdate() env = self._GetEnvironmentWithDisabledDepotToolsUpdate()
@@ -267,17 +267,17 @@ class WebRTCFactory(factory.BuildFactory):
def AddCommonGYPStep(self, gyp_file, gyp_params=[], descriptor='gyp'): def AddCommonGYPStep(self, gyp_file, gyp_params=[], descriptor='gyp'):
"""Helper method for invoking GYP on WebRTC. """Helper method for invoking GYP on WebRTC.
GYP will generate makefiles or its equivalent in a platform-specific GYP will generate makefiles or its equivalent in a platform-specific
manner. A failed GYP step will halt the build. manner. A failed GYP step will halt the build.
This command will run in the WebRTC root directory This command will run in the WebRTC root directory
(generally build/trunk). (generally build/trunk).
Args: Args:
gyp_file: The root GYP file to use. gyp_file: The root GYP file to use.
gyp_params: Custom GYP parameters (same semantics as the GYP_PARAMS gyp_params: Custom GYP parameters (same semantics as the GYP_PARAMS
environment variable). environment variable).
descriptor: The descriptor to use for the step. descriptor: The descriptor to use for the step.
""" """
cmd = ['./build/gyp_chromium', '--depth=.', gyp_file] cmd = ['./build/gyp_chromium', '--depth=.', gyp_file]
cmd += gyp_params + self.gyp_params cmd += gyp_params + self.gyp_params
@@ -299,24 +299,23 @@ class WebRTCFactory(factory.BuildFactory):
def _WrapLongLines(self, string_list, max_line_length=25, wrap_character='_'): def _WrapLongLines(self, string_list, max_line_length=25, wrap_character='_'):
""" Creates a list with wrapped strings for lines that are too long. """ 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 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 in. It's a simple way to make long test targets wrap nicer in the
waterfall display. waterfall display.
This method should only be used for lists that are displayed in the web This method should only be used for lists that are displayed in the web
interface! interface!
Args: Args:
string_list: List of strings where each string represents one line. string_list: List of strings where each string represents one line.
max_line_length: Number of characters a line may have to avoid max_line_length: Number of characters a line may have to avoid
getting wrapped. getting wrapped.
wrap_character: The character we're looking for when inserting a wrap_character: The character we're looking for when inserting a
space if a string is larger than max_line_length. If no such space if a string is larger than max_line_length. If no such
character is found, no space will be inserted. character is found, no space will be inserted.
Returns: Returns:
A new list of the same length as the input list, but with strings 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 that may contain extra spaces in them, if longer than the max length.
length.
""" """
result = [] result = []
for line in string_list: for line in string_list:
@@ -331,17 +330,17 @@ class WebRTCFactory(factory.BuildFactory):
class BuildStatusOracle: class BuildStatusOracle:
"""Keeps track of a particular build's state. """Keeps track of a particular build's state.
The oracle uses files in the default master work directory to keep track The oracle uses files in the default master work directory to keep track
of whether a build has failed. It only keeps track of the most recent build of whether a build has failed. It only keeps track of the most recent build
until told to forget it. until told to forget it.
""" """
def __init__(self, builder_name): def __init__(self, builder_name):
"""Creates the oracle. """Creates the oracle.
Args: Args:
builder_name: The name of the associated builder. This name is used builder_name: The name of the associated builder. This name is used
in the filename on disk. This name should be unique. in the filename on disk. This name should be unique.
""" """
self.builder_name = builder_name self.builder_name = builder_name
self.master_work_dir = DEFAULT_MASTER_WORK_DIR self.master_work_dir = DEFAULT_MASTER_WORK_DIR
@@ -380,10 +379,10 @@ class SmartClean(ShellCommand):
def __init__(self, build_status_oracle, is_try_slave, path_joiner, **kwargs): def __init__(self, build_status_oracle, is_try_slave, path_joiner, **kwargs):
"""Args: """Args:
build_status_oracle: class that knows if the previous build failed. build_status_oracle: class that knows if the previous build failed.
is_try_slave: if the current factory is a try slave. is_try_slave: if the current factory is a try slave.
path_joiner: function to create paths for the current platform, given path_joiner: function to create paths for the current platform, given
a number of path elements in string form. a number of path elements in string form.
""" """
ShellCommand.__init__(self, **kwargs) ShellCommand.__init__(self, **kwargs)
@@ -414,25 +413,25 @@ class SmartClean(ShellCommand):
class GenerateCodeCoverage(ShellCommand): class GenerateCodeCoverage(ShellCommand):
"""This custom shell command generates coverage HTML using genhtml. """This custom shell command generates coverage HTML using genhtml.
The command will dump the HTML output into coverage_dir, in a directory 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 whose name is generated from the build number and slave name. We will
expect that the coverage directory is somewhere under the web server root 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 (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 we write Foo to the coverage directory we expect that directory to be
reachable from url/Foo. reachable from url/Foo.
""" """
def __init__(self, build_status_oracle, coverage_url, coverage_dir, def __init__(self, build_status_oracle, coverage_url, coverage_dir,
coverage_file, **kwargs): coverage_file, **kwargs):
"""Prepares the coverage command. """Prepares the coverage command.
Args: Args:
build_status_oracle: class that knows if the current build has failed. build_status_oracle: class that knows if the current build has failed.
coverage_url: The base URL for the serving web server we will use coverage_url: The base URL for the serving web server we will use
when we generate the link to the coverage. This will generally when we generate the link to the coverage. This will generally
be the slave's URL (something like http://slave-hostname/). be the slave's URL (something like http://slave-hostname/).
coverage_dir: Where to write coverage HTML. coverage_dir: Where to write coverage HTML.
coverage_file: The LCOV file to generate the coverage from. coverage_file: The LCOV file to generate the coverage from.
""" """
ShellCommand.__init__(self, **kwargs) ShellCommand.__init__(self, **kwargs)
self.addFactoryArguments(build_status_oracle=build_status_oracle, self.addFactoryArguments(build_status_oracle=build_status_oracle,
@@ -589,14 +588,15 @@ class WebRTCChromeFactory(WebRTCFactory):
# Replace any slashes in the test's path with underscores for the name since # Replace any slashes in the test's path with underscores for the name since
# the buildbot web pages will become confused otherwise. # the buildbot web pages will become confused otherwise.
descriptor = test.replace('/', '_') descriptor = test.replace('/', '_')
pyauto_flags = ' --chrome-flags --enable-media-stream' pyauto_flags = (' --chrome-flags "--enable-media-stream'
' --enable-peer-connection"')
cmd = MakeCommandToRunTestInXvfb(test + pyauto_flags) cmd = MakeCommandToRunTestInXvfb(test + pyauto_flags)
self.AddCommonStep(cmd=cmd, descriptor=descriptor, workdir='build/src') self.AddCommonStep(cmd=cmd, descriptor=descriptor, workdir='build/src')
class WebRTCLinuxFactory(WebRTCFactory): class WebRTCLinuxFactory(WebRTCFactory):
"""Sets up the Linux build. """Sets up the Linux build.
This factory is quite configurable and can run a variety of builds. This factory is quite configurable and can run a variety of builds.
""" """
def __init__(self, build_status_oracle, is_try_slave=False, def __init__(self, build_status_oracle, is_try_slave=False,
@@ -611,13 +611,13 @@ class WebRTCLinuxFactory(WebRTCFactory):
def EnableCoverage(self, coverage_url, coverage_dir=DEFAULT_COVERAGE_DIR): def EnableCoverage(self, coverage_url, coverage_dir=DEFAULT_COVERAGE_DIR):
"""Enables coverage measurements using LCOV/GCOV. """Enables coverage measurements using LCOV/GCOV.
This method must be called before enabling build. This method must be called before enabling build.
Args: Args:
coverage_url: See the GenerateCodeCoverage command's contract for coverage_url: See the GenerateCodeCoverage command's contract for
this argument. this argument.
coverage_dir: See the GenerateCodeCoverage command's contract for coverage_dir: See the GenerateCodeCoverage command's contract for
this argument. this argument.
""" """
assert self.build_enabled is False assert self.build_enabled is False
@@ -674,7 +674,7 @@ class WebRTCLinuxFactory(WebRTCFactory):
def AddXvfbTestRunStep(self, test_name, test_binary, test_arguments=''): def AddXvfbTestRunStep(self, test_name, test_binary, test_arguments=''):
""" Adds a test to be run inside a XVFB window manager.""" """ Adds a test to be run inside a XVFB window manager."""
cmd = MakeCommandToRunTestInXvfb("%s %s" % (test_binary, test_arguments)) cmd = MakeCommandToRunTestInXvfb('%s %s' % (test_binary, test_arguments))
self.AddCommonTestRunStep(test=test_name, cmd=cmd) self.AddCommonTestRunStep(test=test_name, cmd=cmd)
def AddCommonMakeStep(self, target, extra_text=None, make_extra=None): def AddCommonMakeStep(self, target, extra_text=None, make_extra=None):
@@ -759,12 +759,12 @@ class WebRTCLinuxFactory(WebRTCFactory):
def EnableTest(self, test): def EnableTest(self, test):
"""Adds a step for running a test on Linux. """Adds a step for running a test on Linux.
In general, this method will interpret the name as the name of a binary 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 in the default build output directory, except for a few special cases
which require custom command lines. which require custom command lines.
Args: Args:
test: the test name as a string. test: the test name as a string.
""" """
if test == 'audioproc_unittest': if test == 'audioproc_unittest':
self.AddCommonTestRunStep(test) self.AddCommonTestRunStep(test)
@@ -850,7 +850,7 @@ class WebRTCMacFactory(WebRTCFactory):
class WebRTCWinFactory(WebRTCFactory): class WebRTCWinFactory(WebRTCFactory):
"""Sets up the Windows build. """Sets up the Windows build.
Allows building with Debug, Release or both in sequence. Allows building with Debug, Release or both in sequence.
""" """
# Must provide full path to the command since we cannot add custom paths to # Must provide full path to the command since we cannot add custom paths to
@@ -961,18 +961,18 @@ class UnsupportedConfigurationError(Exception):
def GetEnabledTests(test_dict, platform): def GetEnabledTests(test_dict, platform):
"""Returns a list of enabled test names for the provided platform. """Returns a list of enabled test names for the provided platform.
Args: Args:
test_dict: Dictionary mapping test names to tuples representing if the test_dict: Dictionary mapping test names to tuples representing if the
test shall be enabled on each platform. Each tuple contains one test shall be enabled on each platform. Each tuple contains one
boolean for each platform. The platforms are in the order specified boolean for each platform. The platforms are in the order specified
by SUPPORTED_PLATFORMS. by SUPPORTED_PLATFORMS.
platform: The platform we're looking to get the tests for. platform: The platform we're looking to get the tests for.
Returns: Returns:
A list of test names, sorted alphabetically. A list of test names, sorted alphabetically.
Raises: Raises:
UnsupportedConfigurationError: if the platform supplied is not supported. UnsupportedConfigurationError: if the platform supplied is not supported.
""" """
if platform not in SUPPORTED_PLATFORMS: if platform not in SUPPORTED_PLATFORMS:
raise UnsupportedConfigurationError('Platform %s is not supported.' raise UnsupportedConfigurationError('Platform %s is not supported.'