diff --git a/tools/continuous_build/OWNERS b/tools/continuous_build/OWNERS new file mode 100644 index 000000000..60e166ca0 --- /dev/null +++ b/tools/continuous_build/OWNERS @@ -0,0 +1,3 @@ +ivinnichenko@webrtc.org +phoglund@webrtc.org +kjellander@webrtc.org diff --git a/tools/continuous_build/master.cfg b/tools/continuous_build/master.cfg new file mode 100755 index 000000000..a9782a3dc --- /dev/null +++ b/tools/continuous_build/master.cfg @@ -0,0 +1,343 @@ +#!/usr/bin/env python +# Copyright (c) 2011 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__ = 'ivinnichenko@webrtc.org (Illya Vinnichenko)' + +# This is a buildmaster config file for WebRTC project. It must be installed as +# 'master.cfg' in your buildmaster's base directory (although the filename +# can be changed with the --basedir option to 'mktap buildbot master'). + +# It has one job: define a dictionary named BuildmasterConfig. This +# dictionary has a variety of keys to control different aspects of the +# buildmaster. They are documented in docs/config.xhtml . + +# This is the dictionary that the buildmaster pays attention to. We also use +# a shorter alias to save typing. +c = BuildmasterConfig = {} + +####### BUILDSLAVES + +# the 'slaves' list defines the set of allowable buildslaves. Each element is +# a BuildSlave object, which is created with bot-name, bot-password. These +# correspond to values given to the buildslave's mktap invocation. + +from buildbot.buildslave import BuildSlave + +c['slaves'] = [BuildSlave("chromeos", "pass", max_builds=1), + BuildSlave("linux-clang", "pass", max_builds=1), + BuildSlave("linux-slave-1", "pass", max_builds=1), + BuildSlave("linux-slave-2", "pass", max_builds=1), + BuildSlave("linux-slave-4", "pass", max_builds=1), + BuildSlave("linux-slave-5", "pass", max_builds=1), + BuildSlave("linux_video", "pass", max_builds=1), + BuildSlave("mac-slave-1", "pass", max_builds=1), + BuildSlave("win-slave", "pass", max_builds=1), + BuildSlave("win-slave32", "pass", max_builds=1)] + +# 'slavePortnum' defines the TCP port to listen on. This must match the value +# configured into the buildslaves (with their --master option) + +c['slavePortnum'] = 9989 + +####### CHANGESOURCES + +# the 'change_source' setting tells the buildmaster how it should find out +# about source code changes. Any class which implements IChangeSource can be +# put here: there are several in buildbot/changes/*.py to choose from. + +from buildbot.changes.pb import PBChangeSource +from buildbot.changes.svnpoller import SVNPoller + +source_code_svn_url = 'http://webrtc.googlecode.com/svn/trunk' +svn_poller = SVNPoller(svnurl=source_code_svn_url, pollinterval=15*60, + histmax=10, svnbin='/usr/bin/svn') +c['change_source'] = svn_poller + +####### SCHEDULERS + +## configure the Schedulers + +from buildbot.scheduler import Scheduler +webrtc_scheduler = Scheduler(name="all", branch=None, treeStableTimer=2*60, + builderNames=["Win32Debug", + "Win32Release", + "MacOS", + "ChromeOS", + "LinuxCLANG", + "Linux64bitDBG", + "Linux32bitRelease", + "Linux64bitRelease", + "Linux32bitDBG", + "LinuxVideoTest"]) +c['schedulers'] = [webrtc_scheduler] + + +####### BUILDERS + +# the 'builders' list defines the Builders. Each one is configured with a +# dictionary, using the following keys: +# name (required): the name used to describe this builder +# slavename (required): which slave to use (must appear in c['bots']) +# builddir (required): which subdirectory to run the builder in +# factory (required): a BuildFactory to define how the build is run +# periodicBuildTime (optional): if set, force a build every N seconds + +# buildbot/process/factory.py provides several BuildFactory classes you can +# start with, which implement build processes for common targets (GNU +# autoconf projects, CPAN perl modules, etc). The factory.BuildFactory is the +# base class, and is configured with a series of BuildSteps. When the build +# is run, the appropriate buildslave is told to execute each Step in turn. + +# the first BuildStep is typically responsible for obtaining a copy of the +# sources. There are source-obtaining Steps in buildbot/steps/source.py for +# CVS, SVN, and others. + +from buildbot.process import factory +from buildbot.steps import shell +from webrtc_buildbot import utils + +DEFAULT_LINUX_TESTS = ["audio_coding_module_test", + "audio_conference_mixer_unittests", + "audio_device_test_api", + "audio_device_test_func", + "cng_unittests", + "g711_unittests", + "g722_unittests", + "libyuv_unittests", + "media_file_unittests", + "neteq_unittests", + "pcm16b_unittests" + "resampler_unittests", + "rtp_rtcp_unittests", + "signal_processing_unittests", + "system_wrappers_unittests", + "test_bwe", + "test_fec", + "udp_transport_unittests", + "vad_unittests", + "video_coding_unittests", + "video_processing_unittests", + "voice_engine_unittests", + "vp8_unittests", + "webrtc_utility_unittests"] +DEFAULT_MACOS_TESTS = ["audio_coding_module_test", + "audio_conference_mixer_unittests", + "audio_device_test_api", + "audio_device_test_func", + "cng_unittests", + "g711_unittests", + "g722_unittests", + "libyuv_unittests", + "media_file_unittests", + "neteq_unittests", + "pcm16b_unittests" + "resampler_unittests", + "rtp_rtcp_unittests", + "signal_processing_unittests", + "system_wrappers_unittests", + "test_bwe", + "test_fec", + "udp_transport_unittests", + "vad_unittests", + "video_coding_unittests", + "video_processing_unittests", + "voice_engine_unittests", + "vp8_unittests", + "webrtc_utility_unittests"] +DEFAULT_WIN_TESTS = ["libyuv_unittests", + "neteq_unittests", + "resampler_unittests", + "system_wrappers_unittests", + "vad_unittests", + "voice_engine_unittests", + "vp8_unittests"] + +HEADLESS_LINUX = ["audio_device_test_api" + "audio_device_test_func", + "audioproc_unittest", + "test_fec", + "video_processing_unittests"] +HEADLESS_MACOS = ["audio_device_test_api" + "audio_device_test_func", + "audioproc_unittest", + "video_processing_unittests"] +HEADLESS_WIN = ["audio_device_test_api" + "audio_device_test_func"] + +############# Linux Builders ####################################### +linux_factory_64_dbg = utils.WebRTCLinuxFactory(enable_coverage=True) +linux_factory_64_dbg.EnableBuild() +linux_factory_64_dbg.EnableHeadLess(HEADLESS_LINUX) +linux_factory_64_dbg.EnableTests(DEFAULT_LINUX_TESTS) + +linux_factory_32_release = utils.WebRTCLinuxFactory(enable_coverage=True) +linux_factory_32_release.EnableBuild(release=True, build32=True) +linux_factory_32_release.EnableHeadLess(HEADLESS_LINUX) +linux_factory_32_release.EnableTests(DEFAULT_LINUX_TESTS) + +linux_factory_64_release = utils.WebRTCLinuxFactory(enable_coverage=True) +linux_factory_64_release.EnableBuild(release=True) +linux_factory_64_release.EnableHeadLess(HEADLESS_LINUX) +linux_factory_64_release.EnableTests(DEFAULT_LINUX_TESTS) + +linux_factory_32_dbg = utils.WebRTCLinuxFactory(enable_coverage=True) +linux_factory_32_dbg.EnableBuild(build32=True) +linux_factory_32_dbg.EnableHeadLess(HEADLESS_LINUX) +linux_factory_32_dbg.EnableTests(DEFAULT_LINUX_TESTS) + +linux_factory_video = utils.WebRTCLinuxFactory() +linux_factory_video.EnableBuild() +linux_factory_video.EnableTests(["vie_auto_test", "voe_auto_test"]) + +chromeos_factory = utils.WebRTCLinuxFactory() +chromeos_factory.EnableBuild(chrome_os=True) +chromeos_factory.EnableHeadLess(HEADLESS_LINUX) +chromeos_factory.EnableTests(DEFAULT_LINUX_TESTS) + +linux_clang = utils.WebRTCLinuxFactory() +linux_clang.EnableBuild(clang=True) +linux_clang.EnableHeadLess(HEADLESS_LINUX) +linux_clang.EnableTests(DEFAULT_LINUX_TESTS) +############# Mac Builders ####################################### +mac_factory = utils.WebRTCMacFactory() +mac_factory.EnableBuild(build_type="both") +mac_factory.EnableHeadLess(HEADLESS_MACOS) +mac_factory.EnableTests(DEFAULT_MACOS_TESTS) + +############# Windows Builders ####################################### +win_factory_32_Debug = utils.WebRTCWinFactory() +win_factory_32_Debug.EnableBuild(configuration="Debug") +win_factory_32_Debug.EnableHeadLess(HEADLESS_WIN) +win_factory_32_Debug.EnableTests(DEFAULT_WIN_TESTS) + +win_factory_32_Release = utils.WebRTCWinFactory() +win_factory_32_Release.EnableBuild(configuration="Release") +win_factory_32_Release.EnableHeadLess(HEADLESS_WIN) +win_factory_32_Release.EnableTests(DEFAULT_WIN_TESTS) + +linux_builder_1 = { + 'name': "Linux64bitDBG", + 'slavename': "linux-slave-1", + 'builddir': "linux-slave-1", + 'factory': linux_factory_64_dbg, + } +linux_builder_2 = { + 'name': "Linux32bitRelease", + 'slavename': "linux-slave-2", + 'builddir': "linux-slave-2", + 'factory': linux_factory_32_release, + } +linux_builder_3 = { + 'name': "Linux64bitRelease", + 'slavename': "linux-slave-5", + 'builddir': "linux-slave-5", + 'factory': linux_factory_64_release, + } +linux_builder_4 = { + 'name': "Linux32bitDBG", + 'slavename': "linux-slave-4", + 'builddir': "linux-slave-4", + 'factory': linux_factory_32_dbg, + } +mac_builder_1 = { + 'name': "MacOS", + 'slavename': "mac-slave-1", + 'builddir': "mac-slave-1", + 'factory': mac_factory, + } +chromeos_builder = { + 'name': "ChromeOS", + 'slavename': "chromeos", + 'builddir': "chromeos", + 'factory': chromeos_factory, + } +win_builder_1 = { + 'name': "Win32Debug", + 'slavename': "win-slave", + 'builddir': "win-32-dbg", + 'factory': win_factory_32_Debug, + } +win_builder_2 = { + 'name': "Win32Release", + 'slavename': "win-slave32", + 'builddir': "win-32-release", + 'factory': win_factory_32_Release, + } +linux_video_builder = { + 'name': "LinuxVideoTest", + 'slavename': "linux_video", + 'builddir': "video", + 'factory': linux_factory_video, + } +linux_clang_builder = { + 'name': "LinuxCLANG", + 'slavename': "linux-clang", + 'builddir': "linux-clang", + 'factory': linux_clang, + } +c['builders'] = [win_builder_1, win_builder_2, mac_builder_1, chromeos_builder, + linux_builder_1, linux_clang_builder, linux_builder_2, linux_builder_3, + linux_builder_4, linux_video_builder] + + +####### STATUS TARGETS + +# 'status' is a list of Status Targets. The results of each build will be +# pushed to these targets. buildbot/status/*.py has a variety to choose from, +# including web pages, email senders, and IRC bots. + +from buildbot.status import html +from buildbot.status import mail + +web_page = html.WebStatus(http_port=8010, allowForce=True) +email_notification = mail.MailNotifier( + fromaddr="webrtc-cb-watchlist@google.com", + extraRecipients=["webrtc-cb-watchlist@google.com"], + sendToInterestedUsers=True, + mode='failing') +c['status'] = [web_page, email_notification] + +####### DEBUGGING OPTIONS + +# if you set 'debugPassword', then you can connect to the buildmaster with +# the diagnostic tool in contrib/debugclient.py . From this tool, you can +# manually force builds and inject changes, which may be useful for testing +# your buildmaster without actually committing changes to your repository (or +# before you have a functioning 'sources' set up). The debug tool uses the +# same port number as the slaves do: 'slavePortnum'. + +#c['debugPassword'] = "debugpassword" + +# if you set 'manhole', you can ssh into the buildmaster and get an +# interactive python shell, which may be useful for debugging buildbot +# internals. It is probably only useful for buildbot developers. You can also +# use an authorized_keys file, or plain telnet. +#from buildbot import manhole +#c['manhole'] = manhole.PasswordManhole("tcp:9999:interface=127.0.0.1", +# "admin", "password") + + +####### PROJECT IDENTITY + +# the 'projectName' string will be used to describe the project that this +# buildbot is working on. For example, it is used as the title of the +# waterfall HTML page. The 'projectURL' string will be used to provide a link +# from buildbot HTML pages to your project's home page. + +c['projectName'] = "WebRTC" +c['projectURL'] = "http://www.webrtc.org" + +# the 'buildbotURL' string should point to the location where the buildbot's +# internal web server (usually the html.Waterfall page) is visible. This +# typically uses the port number set in the Waterfall 'status' entry, but +# with an externally-visible host name which the buildbot cannot figure out +# without some help. + +#c['buildbotURL'] = "http://localhost:8010/" +c['buildbotURL'] = "http://webrtc-cb-linux-master.cbf.corp.google.com:8010/" diff --git a/tools/continuous_build/webrtc_buildbot/__init__.py b/tools/continuous_build/webrtc_buildbot/__init__.py new file mode 100755 index 000000000..869bd84b3 --- /dev/null +++ b/tools/continuous_build/webrtc_buildbot/__init__.py @@ -0,0 +1,2 @@ +# -*- python -*- +# ex: set syntax=python: diff --git a/tools/continuous_build/webrtc_buildbot/utils.py b/tools/continuous_build/webrtc_buildbot/utils.py new file mode 100755 index 000000000..d18251e72 --- /dev/null +++ b/tools/continuous_build/webrtc_buildbot/utils.py @@ -0,0 +1,559 @@ +#!/usr/bin/env python +# Copyright (c) 2011 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__ = 'ivinnichenko@webrtc.org (Illya Vinnichenko)' + +from buildbot.process import factory +from buildbot.steps import shell +from buildbot.steps.shell import ShellCommand +from buildbot.process import properties +from buildbot.process.properties import WithProperties +import os +import sys + + +SVN_LOCATION = "http://webrtc.googlecode.com/svn/trunk" + +class WebRTCFactory(factory.BuildFactory): + """A Build Factory affected by properties.""" + + def __init__(self, build_factory_properties=None, steps=None, + enable_coverage=False, account=None): + factory.BuildFactory.__init__(self, steps) + self.properties = properties.Properties() + self.enable_build = False + self.force_sync = False + self.headless_tests = [] + self.enable_coverage = enable_coverage + self.gyp_params = [] + self.account = account + self.coverage_dir = "" + self.coverage_url = "" + self.release = False + if self.account is None: + self.coverage_url = "http://www.corp.google.com/~webrtc-cb" + self.coverage_dir = "/home/webrtc-cb/www" + else: + self.coverage_url = "http://www.corp.google.com/~%s" % self.account + self.coverage_dir = "/home/%s/www" % self.account + + + def EnableBuild(self, force_sync): + """Build the binary [must be overridden].""" + pass + + def AddCommonTestSteps(self, test): + """Add common steps for test.[must be overridden] + + test: test to be run. + """ + pass + + def AddCommonStep(self): + """Define common step [must be overridden].""" + pass + + def AddCommonTestRunStep(self): + """Define common test run step [must be overridden].""" + pass + + def AddCommonMakeStep(self): + """Define common make step [must be overridden].""" + pass + + def AddCommonGYPStep(self): + """Define common gyp step [must be overridden].""" + pass + + def EnableTest(self, test): + """Enable Test to be run. [must be overridden] + + test: test to be run. + """ + pass + + def EnableTests(self, tests): + """Enable Test to be run. + + tests: list of test to be run. + """ + print "Headless tests:%s" % self.headless_tests + for test in tests: + self.EnableTest(test) + if self.enable_coverage: + self.EnableCoverage() + + def EnableHeadLess(self, tests): + """Add headless (build only) tests. + + tests: list of headless test. + """ + self.headless_tests += tests + + def EnableCoverage(self): + """Enable coverage data [must be overridden].""" + pass + + +class GenerateCodeCoverage(ShellCommand): + command = ["genhtml", "final.info", "--output-directory", + WithProperties("/home/webrtc-cb/www/%(buildername)s_%(buildnumber)s")] + name = "LCOV_GenHTML" + + def __init__(self, coverage_url=None, coverage_dir=None, **kwargs): + if coverage_url is None or coverage_dir is None: + raise TypeError("coverage location required") + print coverage_url, coverage_dir + ShellCommand.__init__(self, **kwargs) + self.addFactoryArguments(coverage_url=coverage_url, + coverage_dir=coverage_dir) + self.setDefaultWorkdir("build/trunk") + self.coverage_url = coverage_url + self.coverage_dir = coverage_dir + self.setCommand(["genhtml", "final.info", "--output-directory", + WithProperties(coverage_dir + "/%(buildername)s_%(buildnumber)s")]) + + def createSummary(self, log): + coverage_url = "%s/%s_%s" % (self.coverage_url, + self.getProperty("buildername"), self.getProperty("buildnumber")) + coverage_dir = "%s/%s_%s" % (self.coverage_dir, + self.getProperty("buildername"), self.getProperty("buildnumber")) + os.chmod(coverage_dir,0777) + for root, dirs, files in os.walk(coverage_dir): + for d in dirs: + os.chmod(os.path.join(root, d), 0777) + for f in files: + os.chmod(os.path.join(root, f), 0777) + self.addURL("coverage", coverage_url) + + def start(self): + ShellCommand.start(self) + +################################################################################ +class WebRTCLinuxFactory(WebRTCFactory): + """A Build Factory affected by properties.""" + + def __init__(self, build_factory_properties=None, steps=None, + enable_coverage=False, account=None): + WebRTCFactory.__init__(self, build_factory_properties, steps, + enable_coverage, account) + + def EnableBuild(self, force_sync=False, release=False, build32=False, + chrome_os=False, clang=False): + if build32: + self.gyp_params.append("-Dtarget_arch=ia32") + + self.enable_build = True + self.force_sync = force_sync + """Linux specific Build""" + self.release = release + self.AddCommonStep(["rm", "-rf", "trunk"], descriptor="Cleanup") + self.AddCommonStep(["gclient", "config", SVN_LOCATION], + descriptor="gclient_config") + + cmd = ["gclient", "sync"] + if force_sync: + cmd.append("--force") + self.AddCommonStep(cmd, descriptor="Sync") + if chrome_os: + self.gyp_params.append("-Dchromeos=1") + + if clang: + self.gyp_params.append("-Dclang=1") + + if self.enable_coverage: + self.gyp_params.append("-Dcoverage=1") + self.AddCommonGYPStep("webrtc.gyp", descriptor="CommonGYP") + + if clang: + self.AddCommonStep(["trunk/tools/clang/scripts/update.sh"], + descriptor="Update_Clang") + if self.release: + self.AddCommonMakeStep("all", make_extra="BUILDTYPE=Release") + else: + self.AddCommonMakeStep("all") + + def AddCommonStep(self, cmd, descriptor="", workdir="build"): + self.addStep(shell.ShellCommand(command=cmd, workdir=workdir, + description=[descriptor, "running..."], + descriptionDone=[descriptor, "done..."], + name="%s" % descriptor)) + + def AddCommonTestRunStep(self, test, descriptor="", cmd=None, + workdir="build/trunk"): + if test in self.headless_tests: + return + test_folder = "Release" if self.release else "Debug" + test_descriptor = test + descriptor + if cmd is None: + cmd = ["out/%s/%s" % (test_folder, test)] + self.addStep(shell.ShellCommand(command=cmd, + workdir=workdir, description=["Running", test_descriptor], + descriptionDone=[test_descriptor, "finished"], + name="run_test_%s" % test_descriptor)) + + def AddCommonMakeStep(self, make, descriptor="", make_extra=None): + make_descriptor = make + descriptor + #cpu = `grep -i \"processor\" /proc/cpuinfo | sort -u | wc -l` + cmd = ["make", make, "-j100"] + if make_extra is not None: + cmd.append(make_extra) + self.addStep(shell.ShellCommand(command=cmd, + workdir="build/trunk", description=["Making", make_descriptor], + descriptionDone=[make_descriptor, "built"], + name="make_%s" % make_descriptor)) + + def AddCommonGYPStep(self, gyp_file, gyp_params=[], descriptor="gyp"): + cmd = ["./build/gyp_chromium", "--depth=.", gyp_file] + cmd += gyp_params + self.gyp_params + self.addStep(shell.ShellCommand(command=cmd, workdir="build/trunk", + description=[descriptor, "running..."], + descriptionDone=[descriptor, "done..."], + name="gyp_%s" % descriptor)) + + def EnableCoverage(self): + """Enable coverage data [must be overridden].""" + self.AddCommonStep(["lcov", "--directory", ".", "--capture", "-b", + ".", "--output-file", "webrtc.info"], + workdir="build/trunk", descriptor="LCOV_Capture") + self.AddCommonStep(['lcov', '--extract', 'webrtc.info', '*/src/*', + '--output', 'test.info'], + workdir="build/trunk", descriptor="LCOV_Extract") + self.AddCommonStep(["lcov", "--remove", "test.info", "*/usr/include/*", + "/third*", "/testing/*", "--output", + "final.info"], + workdir="build/trunk", descriptor="LCOV_Filter") + self.addStep(GenerateCodeCoverage(coverage_url=self.coverage_url, + coverage_dir=self.coverage_dir)) + + + def AddCommonTestSteps(self, test): + """Add common steps for test. + + test: test to be run. + """ + self.AddCommonMakeStep(test, descriptor="_test") + self.AddCommonTestRunStep(test, descriptor="_test") + + def EnableTest(self, test): + """Enable Test to be run. + + test: test to be run. + """ + if test == "audioproc_unittest": + self.AddCommonMakeStep(test, descriptor="_test") + self.AddCommonTestRunStep(test, + cmd=["../../../out/Debug/audioproc_unittest"], + workdir="build/trunk/test/data/audio_processing") + # Fixed point run: + self.AddCommonGYPStep("src/modules/modules.gyp", + gyp_params=["-Dprefer_fixed_point=1"], + descriptor="tests_fp") + self.AddCommonMakeStep(test, "_test_(FP)") + self.AddCommonTestRunStep(test, descriptor="_(FP)", + cmd=["../../../out/Debug/audioproc_unittest"], + workdir="build/trunk/test/data/audio_processing") + elif test == "signal_processing_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "resampler_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "vad_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "rtp_rtcp_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "video_coding_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "test_bwe": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_device_test_api": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_device_test_func": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_coding_module_test": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "video_processing_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "test_fec": + self.AddCommonTestSteps(test) + elif test == "system_wrappers_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "cng_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "g711_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "g722_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "pcm16b_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_conference_mixer_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "media_file_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "udp_transport_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "webrtc_utility_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "neteq_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "vp8_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "libyuv_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "voice_engine_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "vie_auto_test": + self.addStep(shell.Compile(command=('xvfb-run --server-args="-screen 0 ' + '800x600x24 -extension Composite" out/Debug/vie_auto_test --automated ' + '--gtest_filter="ViEStandardIntegrationTest.*:ViEApiIntegrationTest.*" ' + '--capture_test_ensure_resolution_alignment_in_capture_device=false'), + workdir="build/trunk", description=[test, "running..."], + descriptionDone=[test, "done..."], name="%s" % test)) + elif test == "voe_auto_test": + self.addStep(shell.Compile(command=('out/Debug/voe_auto_test --automated ' + '--gtest_filter="-*Manual*"'), + workdir="build/trunk", description=[test, "running..."], + descriptionDone=[test, "done..."], name="%s" % test)) + else: + print "No supported tests are found..." + + +################################################################################ +class WebRTCMacFactory(WebRTCFactory): + """A Build Factory affected by properties.""" + + def __init__(self, build_factory_properties=None, steps=None, + enable_coverage=False, account=None): + WebRTCFactory.__init__(self, build_factory_properties, steps, + enable_coverage, account) + self.build_type = "both" + self.allowed_build_types = ["both", "xcode", "make"] + + def EnableBuild(self, force_sync=True, build_type="both", release=False): + self.enable_build = True + self.force_sync = force_sync + self.release = release + """Mac specific Build""" + if build_type not in self.allowed_build_types: + print "*** INCORRECT BUILD TYPE (%s)!!! ***" % build_type + sys.exit(0) + else: + self.build_type = build_type + self.AddCommonStep(["rm", "-rf", "trunk"], descriptor="Cleanup") + self.AddCommonStep(["gclient", "config", SVN_LOCATION], + descriptor="gclient_config") + cmd = ["gclient", "sync"] + if force_sync: + 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") + + def AddCommonStep(self, cmd, descriptor="", workdir="build"): + self.addStep(shell.ShellCommand(command=cmd, workdir=workdir, + description=[descriptor, "running..."], + descriptionDone=[descriptor, "done..."], + name="%s" % descriptor)) + + def AddCommonTestRunStep(self, test, descriptor="", cmd=None, + workdir="build/trunk"): + if test in self.headless_tests: + return + test_folder = "Release" if self.release else "Debug" + test_descriptor = test + descriptor + if cmd is None: + if self.build_type == "xcode" or self.build_type == "both": + cmd = ["xcodebuild/%s/%s" % (test_folder, test)] + self.AddCommonStep(cmd, descriptor=test_descriptor+"(xcode)", + workdir="build/trunk") + if self.build_type == "make" or self.build_type == "both": + cmd = ["out/%s/%s" % (test_folder, test)] + self.AddCommonStep(cmd, descriptor=test_descriptor+"(make)", + workdir="build/trunk") + + def AddCommonMakeStep(self, make, descriptor="", make_extra=None): + make_descriptor = make + descriptor + cpu = "`sysctl -n hw.logicalcpu`" + if self.build_type == "make" or self.build_type == "both": + cmd = ["make", make, "-j100"] + if make_extra is not None: + cmd.append(make_extra) + self.AddCommonStep(cmd, descriptor=make_descriptor+"(make)", + workdir="build/trunk") + if self.build_type == "xcode" or self.build_type == "both": + cmd = ["xcodebuild", "-project", "webrtc.xcodeproj", "-configuration", + "Debug", "-target", "All"] + self.AddCommonStep(cmd, descriptor=make_descriptor+"(xcode)", + workdir="build/trunk") + + def AddCommonGYPStep(self, gyp_file, gyp_params=[], descriptor="gyp"): + cmd = ["./build/gyp_chromium", "--depth=.", gyp_file] + cmd += gyp_params + self.gyp_params + self.addStep(shell.ShellCommand(command=cmd, workdir="build/trunk", + description=[descriptor, "running..."], + descriptionDone=[descriptor, "done..."], + name="gyp_%s" % descriptor)) + + def AddCommonTestSteps(self, test): + """Add common steps for test. + + test: test to be run. + """ + self.AddCommonTestRunStep(test, descriptor="_test") + + def EnableTest(self, test): + """Enable Test to be run. + + test: test to be run. + """ + if test == "audioproc_unittest": + print "Does not run on Mac now" + elif test == "signal_processing_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "resampler_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "vad_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "rtp_rtcp_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "video_coding_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "test_bwe": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_device_test_api": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_device_test_func": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_coding_module_test": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "video_processing_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "test_fec": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "system_wrappers_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "audio_conference_mixer_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "media_file_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "udp_transport_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "webrtc_utility_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "neteq_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "vp8_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "libyuv_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "voice_engine_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + else: + print "No supported tests are found..." + +################################################################################ +class WebRTCWinFactory(WebRTCFactory): + """A Build Factory affected by properties.""" + + def __init__(self, build_factory_properties=None, steps=None, + enable_coverage=False, account=None): + WebRTCFactory.__init__(self, build_factory_properties, steps, + enable_coverage, account) + 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.enable_build = True + self.force_sync = force_sync + """Win specific Build""" + if platform not in self.allowed_platforms: + print "*** INCORRECT PLATFORM (%s)!!! ***" % platform + sys.exit(0) + else: + self.platform = platform + if configuration not in self.allowed_configurations: + print "*** INCORRECT CONFIGURATION (%s)!!! ***" % configuration + sys.exit(0) + else: + self.configuration = configuration + if not build_only: + self.AddCommonStep(["rm", "-rf", "trunk"], descriptor="Cleanup") + self.AddCommonStep(["gclient", "config", SVN_LOCATION], + descriptor="gclient_config") + cmd = ["gclient", "sync"] + if force_sync: + 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)] + self.AddCommonStep(cmd, descriptor="Build_Clean", workdir="build/trunk") + cmd = ["msbuild", "webrtc.sln", + "/p:Configuration=Debug;Platform=%s" % (self.platform)] + self.AddCommonStep(cmd, descriptor="Build_Debug", workdir="build/trunk") + if self.configuration == "Release" or self.configuration == "both": + cmd = ["msbuild", "webrtc.sln", "/t:Clean", + "/p:Configuration=Release;Platform=%s" % (self.platform)] + self.AddCommonStep(cmd, descriptor="Build_Clean", workdir="build/trunk") + cmd = ["msbuild", "webrtc.sln", + "/p:Configuration=Release;Platform=%s" % (self.platform)] + self.AddCommonStep(cmd, descriptor="Build_Release", workdir="build/trunk") + + def AddCommonStep(self, cmd, descriptor="", workdir="build"): + self.addStep(shell.ShellCommand(command=cmd, workdir=workdir, + description=[descriptor, "running..."], + descriptionDone=[descriptor, "done..."], + name="%s" % descriptor)) + + def AddCommonTestRunStep(self, test, descriptor="", cmd=None, + workdir="build/trunk"): + if test in self.headless_tests: + return + test_descriptor = test + descriptor + if cmd is None: + if self.configuration == "Debug" or self.configuration == "both": + cmd = ["build\Debug\%s.exe" % test] + self.AddCommonStep(cmd, descriptor=test_descriptor+"_Debug", + workdir=workdir) + if self.configuration == "Release" or self.configuration == "both": + cmd = ["build\Release\%s.exe" % test] + self.AddCommonStep(cmd, descriptor=test_descriptor+"_Release", + workdir=workdir) + + + def EnableTest(self, test): + """Enable Test to be run. + + test: test to be run. + """ + if test == "audioproc_unittest": + print "Does not run on Mac now" + elif test == "resampler_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "vad_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "system_wrappers_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "neteq_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "vp8_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "libyuv_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + elif test == "voice_engine_unittests": + self.AddCommonTestRunStep(test, descriptor="_test") + else: + print "No supported tests are found..." + +