blob: ef00821e99f393b3d320d3b62569df098c57330a [file] [log] [blame]
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to build the chromium master BuildFactory's.
Based on gclient_factory.py and adds chromium-specific steps."""
import re
from master.factory import chromium_commands
from master.factory import gclient_factory
import config
# This is kind of the wrong place for this, but it is the only place apart
# from master_config imported by all the configs that need this list.
blink_tests = [
'blink_heap_unittests',
'blink_platform_unittests',
'webkit',
'webkit_lint',
'webkit_python_tests',
'webkit_unit_tests',
'wtf_unittests',
]
def ForceComponent(target, project, gclient_env):
# Force all bots to specify the "Component" gyp variables, unless it is
# already set.
gyp_defines = gclient_env.setdefault('GYP_DEFINES', '')
if ('component=' not in gyp_defines and
# build_for_tool=drmemory wants the component build (crbug.com/137180).
'build_for_tool=memcheck' not in gyp_defines and
'build_for_tool=tsan' not in gyp_defines):
if target == 'Debug' or target == 'Debug_x64':
component = 'shared_library'
else:
component = 'static_library'
gclient_env['GYP_DEFINES'] = gyp_defines + ' component=' + component
class ChromiumFactory(gclient_factory.GClientFactory):
"""Encapsulates data and methods common to the chromium master.cfg files."""
DEFAULT_TARGET_PLATFORM = config.Master.default_platform
MEMORY_TOOLS_GYP_DEFINES = 'build_for_tool=memcheck'
# gclient custom vars
CUSTOM_VARS_GOOGLECODE_URL = ('googlecode_url', config.Master.googlecode_url)
CUSTOM_VARS_SOURCEFORGE_URL = ('sourceforge_url',
config.Master.sourceforge_url)
CUSTOM_VARS_LLVM_URL = ('llvm_url', config.Master.llvm_url)
CUSTOM_VARS_WEBKIT_MIRROR = ('webkit_trunk', config.Master.webkit_trunk_url)
CUSTOM_VARS_NACL_TRUNK_URL = ('nacl_trunk', config.Master.nacl_trunk_url)
# safe sync urls
SAFESYNC_URL_CHROMIUM = 'http://chromium-status.appspot.com/lkgr'
# gclient additional custom deps
CUSTOM_DEPS_AVPERF = ('src/chrome/test/data/media/avperf',
config.Master.trunk_url + '/deps/avperf')
CUSTOM_VARS_NACL_LATEST = [
('nacl_revision', '$$NACL_REV$$'),
]
CUSTOM_DEPS_VALGRIND = ('src/third_party/valgrind',
config.Master.trunk_url + '/deps/third_party/valgrind/binaries')
CUSTOM_DEPS_DEVTOOLS_PERF = [
('src/third_party/WebKit/PerformanceTests',
config.Master.webkit_trunk_url + '/PerformanceTests'),
('src/third_party/WebKit/LayoutTests/http/tests/inspector',
config.Master.webkit_trunk_url + '/LayoutTests/http/tests/inspector'),
('src/third_party/WebKit/LayoutTests/inspector',
config.Master.webkit_trunk_url + '/LayoutTests/inspector'),
]
CUSTOM_DEPS_TSAN_WIN = ('src/third_party/tsan',
config.Master.trunk_url + '/deps/third_party/tsan')
CUSTOM_DEPS_NACL_VALGRIND = ('src/third_party/valgrind/bin',
config.Master.nacl_trunk_url + '/src/third_party/valgrind/bin')
CUSTOM_DEPS_WEBDRIVER_JAVA_TESTS = (
'src/chrome/test/chromedriver/third_party/java_tests',
config.Master.trunk_url + '/deps/third_party/webdriver')
CUSTOM_DEPS_GYP = [
('src/tools/gyp', 'http://gyp.googlecode.com/svn/trunk')]
CUSTOM_DEPS_GIT_INTERNAL = [
('src/third_party/adobe/flash/symbols/ppapi/mac', None),
('src/third_party/adobe/flash/symbols/ppapi/mac_64', None),
('src/third_party/adobe/flash/symbols/ppapi/linux', None),
('src/third_party/adobe/flash/symbols/ppapi/linux_x64', None),
('src/third_party/adobe/flash/symbols/ppapi/win', None),
('src/third_party/adobe/flash/symbols/ppapi/win_x64', None),
]
# Mapping of repositories to got_xx_revision variables.
CHROMIUM_GOT_REVISION_MAPPINGS = {
'src': 'got_revision',
'src/third_party/WebKit': 'got_webkit_revision',
'src/tools/swarming_client': 'got_swarming_client_revision',
'src/v8': 'got_v8_revision',
}
# A map used to skip dependencies when a test is not run.
# The map key is the test name. The map value is an array containing the
# dependencies that are not needed when this test is not run.
NEEDED_COMPONENTS = {
'^(webkit)$':
[('src/third_party/WebKit/LayoutTests', None)],
}
NEEDED_COMPONENTS_INTERNAL = {
'memory':
[('src/data/memory_test', None)],
'page_cycler':
[('src/data/page_cycler', None)],
'selenium':
[('src/data/selenium_core', None)],
'browser_tests':
[('src/chrome/test/data/firefox2_profile/searchplugins', None),
('src/chrome/test/data/firefox2_searchplugins', None),
('src/chrome/test/data/firefox3_profile/searchplugins', None),
('src/chrome/test/data/firefox3_searchplugins', None),
('src/chrome/test/data/ssl/certs', None)],
'unit':
[('src/chrome/test/data/osdd', None)],
'^(webkit|content_unittests)$':
[('src/webkit/data/bmp_decoder', None),
('src/webkit/data/ico_decoder', None),
('src/webkit/data/test_shell/plugins', None),
('src/webkit/data/xbm_decoder', None)],
'mach_ports':
[('src/data/mach_ports', None)],
# Unused stuff:
'autodiscovery':
[('src/data/autodiscovery', None)],
'esctf':
[('src/data/esctf', None)],
'grit':
[('src/tools/grit/grit/test/data', None)],
'mozilla_js':
[('src/data/mozilla_js_tests', None)],
}
# pylint: disable=E1101
if config.Master.trunk_internal_url:
CUSTOM_DEPS_DEVTOOLS_PERF.append(('src/data/devtools_test_pages',
config.Master.trunk_internal_url +
'/data/devtools_test_pages'))
def __init__(self, build_dir, target_platform=None, pull_internal=True,
full_checkout=False, additional_repos=None, name=None,
custom_deps_list=None, nohooks_on_update=False, target_os=None,
swarm_client_canary=False, internal_custom_deps_list=None,
got_revision_mapping_overrides=None):
if full_checkout:
needed_components = None
else:
needed_components = self.NEEDED_COMPONENTS
main = gclient_factory.GClientSolution(config.Master.trunk_url_src,
needed_components=needed_components,
name=name,
custom_deps_list=custom_deps_list,
custom_vars_list=[self.CUSTOM_VARS_WEBKIT_MIRROR,
self.CUSTOM_VARS_GOOGLECODE_URL,
self.CUSTOM_VARS_SOURCEFORGE_URL,
self.CUSTOM_VARS_LLVM_URL,
self.CUSTOM_VARS_NACL_TRUNK_URL])
solutions = [main]
if config.Master.trunk_internal_url_src and pull_internal:
if full_checkout:
needed_components = None
else:
needed_components = self.NEEDED_COMPONENTS_INTERNAL
internal = gclient_factory.GClientSolution(
config.Master.trunk_internal_url_src,
needed_components=needed_components,
custom_deps_list=internal_custom_deps_list)
solutions.append(internal)
additional_repos = additional_repos or []
for name, url in additional_repos:
solution = gclient_factory.GClientSolution(url, name=name)
solutions.append(solution)
got_rev_mappings = self.CHROMIUM_GOT_REVISION_MAPPINGS
if got_revision_mapping_overrides:
# We need to reverse the key/value in the got revision mapping dict
# because values are unique and keys are not.
bw_mappings = dict(
(v, k) for k, v in got_rev_mappings.iteritems())
bw_mapping_overrides = dict(
(v, k) for k, v in got_revision_mapping_overrides.iteritems())
bw_mappings.update(bw_mapping_overrides)
got_rev_mappings = dict(
(v, k) for k, v in bw_mappings.iteritems())
got_rev_mappings.update(got_revision_mapping_overrides)
gclient_factory.GClientFactory.__init__(self,
build_dir, solutions, target_platform=target_platform,
nohooks_on_update=nohooks_on_update, target_os=target_os,
revision_mapping=got_rev_mappings)
if swarm_client_canary:
# Contrary to other canaries like blink, v8, we don't really care about
# having one build per swarm_client commits by having an additional source
# change listener so just fetching @ToT all the time is good enough.
self._solutions[0].custom_vars_list.append(('swarming_revision', ''))
def _AddTests(self, factory_cmd_obj, tests, mode=None,
factory_properties=None):
"""Add the tests listed in 'tests' to the factory_cmd_obj."""
factory_properties = factory_properties or {}
tests = (tests or [])[:]
# This function is too crowded, try to simplify it a little.
def R(*testnames):
for test in testnames:
if gclient_factory.ShouldRunTest(tests, test):
tests.remove(test)
return True
f = factory_cmd_obj
fp = factory_properties
# Copy perf expectations from slave to master for use later.
if factory_properties.get('expectations'):
f.AddUploadPerfExpectations(factory_properties)
# When modifying the order of the tests here, please take
# http://build.chromium.org/buildbot/waterfall/stats into account.
# Tests that fail more often should be earlier in the queue.
# Check for goma
if R('diagnose_goma'):
f.AddDiagnoseGomaStep()
# Run interactive_ui_tests first to make sure it does not fail if another
# test running before it leaks a window or a popup (crash dialog, etc).
if R('interactive_ui_tests'):
f.AddGTestTestStep('interactive_ui_tests', fp)
if R('interactive_ui_tests_br'):
f.AddBuildrunnerGTest('interactive_ui_tests', fp)
# interactive_ui_tests specifically for Instant Extended.
if R('instant_extended_manual_tests'):
arg_list = [
'--gtest_filter=InstantExtendedManualTest.*',
'--run-manual',
'--enable-benchmarking',
'--enable-stats-table',
'--ignore-certificate-errors',
]
f.AddBuildrunnerGTest('interactive_ui_tests', factory_properties=fp,
arg_list=arg_list)
# Scripted checks to verify various properties of the codebase:
if R('check_deps'):
f.AddCheckDepsStep()
if R('check_deps_br'):
f.AddBuildrunnerCheckDepsStep()
if R('check_bins'):
f.AddCheckBinsStep()
if R('check_bins_br'):
f.AddBuildrunnerCheckBinsStep()
if R('check_perms'):
f.AddCheckPermsStep()
if R('check_perms_br'):
f.AddBuildrunnerCheckPermsStep()
if R('check_licenses'):
f.AddCheckLicensesStep(fp)
if R('check_licenses_br'):
f.AddBuildrunnerCheckLicensesStep(fp)
# Small ("module") unit tests:
if R('accessibility_unittests'):
f.AddGTestTestStep('accessibility_unittests', fp)
if R('accessibility_unittests_br'):
f.AddBuildrunnerGTest('accessibility_unittests', fp)
if R('base_unittests'):
f.AddGTestTestStep('base_unittests', fp)
if R('base_unittests_br'):
f.AddBuildrunnerGTest('base_unittests', fp)
if R('cacheinvalidation_unittests'):
f.AddGTestTestStep('cacheinvalidation_unittests', fp)
if R('cacheinvalidation_br'):
f.AddBuildrunnerGTest('cacheinvalidation_unittests', fp)
if R('cast', 'cast_unittests'):
f.AddGTestTestStep('cast_unittests', fp)
if R('cast_br'):
f.AddBuildrunnerGTest('cast_unittests', fp)
if R('cc_unittests'):
f.AddGTestTestStep('cc_unittests', fp)
if R('cc_unittests_br'):
f.AddBuildrunnerGTest('cc_unittests', fp)
if R('chromedriver_unittests'):
f.AddGTestTestStep('chromedriver_unittests', fp)
if R('chromedriver_unittests_br'):
f.AddBuildrunnerGTest('chromedriver_unittests', fp)
if R('chromeos_unittests'):
f.AddGTestTestStep('chromeos_unittests', fp)
if R('chromeos_unittests_br'):
f.AddBuildrunnerGTest('chromeos_unittests', fp)
if R('chrome_elf_unittests'):
f.AddGTestTestStep('chrome_elf_unittests', fp)
if R('chrome_elf_unittests_br'):
f.AddBuildrunnerGTest('chrome_elf_unittests', fp)
if R('components_unittests'):
f.AddGTestTestStep('components_unittests', fp)
if R('components_unittests_br'):
f.AddBuildrunnerGTest('components_unittests', fp)
if R('courgette_unittests'):
f.AddGTestTestStep('courgette_unittests', fp)
if R('courgette_br'):
f.AddBuildrunnerGTest('courgette_unittests', fp)
if R('crypto_unittests'):
f.AddGTestTestStep('crypto_unittests', fp)
if R('crypto_br'):
f.AddBuildrunnerGTest('crypto_unittests', fp)
if R('dbus'):
f.AddGTestTestStep('dbus_unittests', fp)
if R('dbus_br'):
f.AddBuildrunnerGTest('dbus_unittests', fp)
if R('display_unittests'):
f.AddGTestTestStep('display_unittests', fp)
if R('display_unittests_br'):
f.AddBuildrunnerGTest('display_unittests', fp)
if R('extensions_unittests'):
f.AddGTestTestStep('extensions_unittests', fp)
if R('extensions_unittests_br'):
f.AddBuildrunnerGTest('extensions_unittests', fp)
if R('gcm_unit_tests'):
f.AddGTestTestStep('gcm_unit_tests', fp)
if R('gcm_unit_tests_br'):
f.AddBuildrunnerGTest('gcm_unit_tests', fp)
if R('gfx_unittests'):
f.AddGTestTestStep('gfx_unittests', fp)
if R('gfx_unittests_br'):
f.AddBuildrunnerGTest('gfx_unittests', fp)
if R('google_apis_unittests'):
f.AddGTestTestStep('google_apis_unittests', fp)
if R('google_apis_unittests_br'):
f.AddBuildrunnerGTest('google_apis_unittests', fp)
if R('gpu', 'gpu_unittests'):
f.AddGTestTestStep(
'gpu_unittests', fp, arg_list=['--gmock_verbose=error'])
if R('gpu_br'):
f.AddBuildrunnerGTest(
'gpu_unittests', fp, arg_list=['--gmock_verbose=error'])
if R('url_unittests', 'url_unittests'):
f.AddGTestTestStep('url_unittests', fp)
if R('url_unittests_br'):
f.AddBuildrunnerGTest('url_unittests', fp)
if R('jingle', 'jingle_unittests'):
f.AddGTestTestStep('jingle_unittests', fp)
if R('jingle_br'):
f.AddBuildrunnerGTest('jingle_unittests', fp)
if R('content_unittests'):
f.AddGTestTestStep('content_unittests', fp)
if R('content_unittests_br'):
f.AddBuildrunnerGTest('content_unittests', fp)
if R('keyboard_unittests'):
f.AddGTestTestStep('keyboard_unittests', fp)
if R('keyboard_unittests_br'):
f.AddBuildrunnerGTest('keyboard_unittests', fp)
if R('device_unittests'):
f.AddGTestTestStep('device_unittests', fp)
if R('device_unittests_br'):
f.AddBuildrunnerGTest('device_unittests', fp)
if R('media', 'media_unittests'):
f.AddGTestTestStep('media_unittests', fp)
if R('media_br'):
f.AddBuildrunnerGTest('media_unittests', fp)
if R('mojo_common_unittests'):
f.AddBuildrunnerGTest('mojo_common_unittests', fp)
if R('mojo_public_bindings_unittests'):
f.AddBuildrunnerGTest('mojo_public_bindings_unittests', fp)
if R('mojo_public_system_unittests'):
f.AddBuildrunnerGTest('mojo_public_system_unittests', fp)
if R('mojo_service_manager_unittests'):
f.AddBuildrunnerGTest('mojo_service_manager_unittests', fp)
if R('mojo_system_unittests'):
f.AddBuildrunnerGTest('mojo_system_unittests', fp)
if R('nacl_loader_unittests'):
f.AddGTestTestStep('nacl_loader_unittests', fp)
if R('nacl_loader_unittests_br'):
f.AddBuildrunnerGTest('nacl_loader_unittests', fp)
if R('net', 'net_unittests'):
f.AddGTestTestStep('net_unittests', fp)
if R('net_br'):
f.AddBuildrunnerGTest('net_unittests', fp)
if R('ppapi_unittests'):
f.AddGTestTestStep('ppapi_unittests', fp)
if R('ppapi_unittests_br'):
f.AddBuildrunnerGTest('ppapi_unittests', fp)
if R('printing', 'printing_unittests'):
f.AddGTestTestStep('printing_unittests', fp)
if R('printing_br'):
f.AddBuildrunnerGTest('printing_unittests', fp)
if R('remoting', 'remoting_unittests'):
f.AddGTestTestStep('remoting_unittests', fp)
if R('remoting_br'):
f.AddBuildrunnerGTest('remoting_unittests', fp)
# Windows sandbox
if R('sbox_unittests'):
f.AddGTestTestStep('sbox_unittests', fp)
if R('sbox_unittests_br'):
f.AddBuildrunnerGTest('sbox_unittests', fp)
if R('sbox_integration_tests'):
f.AddGTestTestStep('sbox_integration_tests', fp)
if R('sbox_integration_tests_br'):
f.AddBuildrunnerGTest('sbox_integration_tests', fp)
if R('sbox_validation_tests'):
f.AddBuildrunnerGTest('sbox_validation_tests', fp)
if R('sbox_validation_tests_br'):
f.AddBuildrunnerGTest('sbox_validation_tests', fp)
if R('sandbox'):
f.AddGTestTestStep('sbox_unittests', fp)
f.AddGTestTestStep('sbox_integration_tests', fp)
f.AddGTestTestStep('sbox_validation_tests', fp)
if R('sandbox_br'):
f.AddBuildrunnerGTest('sbox_unittests', fp)
f.AddBuildrunnerGTest('sbox_integration_tests', fp)
f.AddBuildrunnerGTest('sbox_validation_tests', fp)
# Linux sandbox
if R('sandbox_linux_unittests'):
f.AddGTestTestStep('sandbox_linux_unittests', fp)
if R('sandbox_linux_unittests_br'):
f.AddBuildrunnerGTest('sandbox_linux_unittests', fp)
if R('telemetry_unittests'):
f.AddTelemetryUnitTests()
if R('telemetry_unittests_br'):
f.AddBuildrunnerTelemetryUnitTests()
if R('telemetry_perf_unittests'):
f.AddTelemetryPerfUnitTests()
if R('telemetry_perf_unittests_br'):
f.AddBuildrunnerTelemetryPerfUnitTests()
if R('ui_base_unittests'):
f.AddGTestTestStep('ui_base_unittests', fp)
if R('ui_base_unittests_br'):
f.AddBuildrunnerGTest('ui_base_unittests', fp)
if R('views', 'views_unittests'):
f.AddGTestTestStep('views_unittests', fp)
if R('views_br'):
f.AddBuildrunnerGTest('views_unittests', fp)
if R('wm_unittests_br'):
f.AddBuildrunnerGTest('wm_unittests', fp)
if R('aura'):
f.AddGTestTestStep('aura_unittests', fp)
if R('aura_br'):
f.AddBuildrunnerGTest('aura_unittests', fp)
if R('aura_shell') or R('ash') or R('ash_unittests'):
f.AddGTestTestStep('ash_unittests', fp)
if R('aura_shell_br', 'ash_br', 'ash_unittests_br'):
f.AddBuildrunnerGTest('ash_unittests', fp)
if R('app_list_unittests'):
f.AddGTestTestStep('app_list_unittests', fp)
if R('app_list_unittests_br'):
f.AddBuildrunnerGTest('app_list_unittests', fp)
if R('message_center_unittests'):
f.AddGTestTestStep('message_center_unittests', fp)
if R('message_center_unittests_br'):
f.AddBuildrunnerGTest('message_center_unittests', fp)
if R('compositor'):
f.AddGTestTestStep('compositor_unittests', fp)
if R('compositor_br'):
f.AddBuildrunnerGTest('compositor_unittests', fp)
if R('events'):
f.AddGTestTestStep('events_unittests', fp)
if R('events_br'):
f.AddBuildrunnerGTest('events_unittests', fp)
if R('ui_touch_selection'):
f.AddGTestTestStep('ui_touch_selection_unittests', fp)
if R('ui_touch_selection_br'):
f.AddBuildrunnerGTest('ui_touch_selection_unittests', fp)
# Medium-sized tests (unit and browser):
if R('unit'):
f.AddChromeUnitTests(fp)
if R('unit_br'):
f.AddBuildrunnerChromeUnitTests(fp)
# A snapshot of the "ChromeUnitTests" available for individual selection
if R('ipc_tests'):
f.AddGTestTestStep('ipc_tests', fp)
if R('ipc_tests_br'):
f.AddBuildrunnerGTest('ipc_tests', fp)
if R('unit_sync', 'sync_unit_tests'):
f.AddGTestTestStep('sync_unit_tests', fp)
if R('unit_sync_br'):
f.AddBuildrunnerGTest('sync_unit_tests', fp)
if R('unit_unit', 'unit_tests'):
f.AddGTestTestStep('unit_tests', fp)
if R('unit_unit_br'):
f.AddBuildrunnerGTest('unit_tests', fp)
if R('unit_sql', 'sql_unittests'):
f.AddGTestTestStep('sql_unittests', fp)
if R('unit_sql_br'):
f.AddBuildrunnerGTest('sql_unittests', fp)
if R('browser_tests'):
f.AddBrowserTests(fp)
if R('browser_tests_br'):
f.AddBuildrunnerBrowserTests(fp)
if R('push_canary_tests'):
f.AddPushCanaryTests(fp)
if R('chromedriver_tests'):
f.AddGTestTestStep('chromedriver_tests', fp)
if R('chromedriver_tests_br'):
f.AddBuildrunnerGTest('chromedriver_tests', fp)
if R('content_browsertests'):
f.AddGTestTestStep('content_browsertests', fp)
if R('content_browsertests_br'):
f.AddBuildrunnerGTest('content_browsertests', fp)
if R('ash_browsertests'):
ash_fp = fp.copy()
ash_fp['browser_tests_extra_options'] = ['--ash-browsertests']
f.AddBuildrunnerBrowserTests(ash_fp)
if self._target_platform == 'win32':
if R('installer_util_unittests'):
f.AddGTestTestStep('installer_util_unittests', fp)
if R('installer_util_unittests_br'):
f.AddBuildrunnerGTest('installer_util_unittests', fp)
if R('installer'):
f.AddInstallerTests(fp)
if R('installer_br'):
f.AddBuildrunnerInstallerTests(fp)
if R('test_installer'):
f.AddMiniInstallerTestStep(fp)
if R('test_installer_br'):
f.AddBuildrunnerMiniInstallerTestStep(fp)
# WebKit-related tests:
if R('webkit_unit_tests'):
f.AddGTestTestStep('webkit_unit_tests', fp)
if R('webkit_unit_tests_br'):
f.AddBuildrunnerGTest('webkit_unit_tests', fp)
if R('wtf_unittests'):
f.AddGTestTestStep('wtf_unittests', fp)
if R('wtf_unittests_br'):
f.AddBuildrunnerGTest('wtf_unittests', fp)
if R('blink_platform_unittests'):
f.AddGTestTestStep('blink_platform_unittests', fp)
if R('blink_platform_unittests_br'):
f.AddBuildrunnerGTest('blink_platform_unittests', fp)
if R('blink_heap_unittests'):
f.AddGTestTestStep('blink_heap_unittests', fp)
if R('blink_heap_unittests_br'):
f.AddBuildrunnerGTest('blink_heap_unittests', fp)
if R('webkit_lint'):
f.AddWebkitLint(factory_properties=fp)
if R('webkit_lint_br'):
f.AddBuildrunnerWebkitLint(factory_properties=fp)
if R('webkit_python_tests'):
f.AddWebkitPythonTests(factory_properties=fp)
if R('webkit_python_tests_br'):
f.AddBuildrunnerWebkitPythonTests(factory_properties=fp)
if R('webkit'):
f.AddWebkitTests(factory_properties=fp)
if R('devtools_perf'):
f.AddDevToolsTests(factory_properties=fp)
# Android device test
if R('device_status'):
f.AddDeviceStatus(factory_properties=fp)
# Other benchmarks:
if R('tab_capture_performance'):
f.AddTabCapturePerformanceTests(fp)
if R('sizes'):
f.AddSizesTests(fp)
if R('sizes_br'):
f.AddBuildrunnerSizesTests(fp)
if R('mach_ports'):
f.AddMachPortsTests(fp)
if R('cc_perftests'):
f.AddCCPerfTests(fp)
if R('media_perftests'):
f.AddMediaPerfTests(fp)
if R('load_library_perf_tests'):
f.AddLoadLibraryPerfTests(fp)
if R('sync_integration'):
f.AddSyncIntegrationTests(fp)
if R('sync_integration_br'):
f.AddBuildrunnerSyncIntegrationTests(fp)
def S(test, prefix, add_functor, br_functor=None):
"""Find any tests with a specific prefix and add them to the build.
S() looks for prefix attached to a test, strips the prefix, and performs a
prefix-specific add function via add_functor. If the test is also a
buildrunner test (ends in _br), it uses a buildrunner functor. Thus,
instead of ash_unittests, valgrind_ash_unittests is ash_unittests added
with a special function (one that wraps it with a valgrind driver.
"""
if test.startswith(prefix):
test_name = test[len(prefix):]
tests.remove(test)
if br_functor and test_name.endswith('_br'):
br_functor(test_name[:-3])
else:
add_functor(test_name)
return True
def M(test, prefix, test_type, fp):
"""A special case of S() that operates on memory tests."""
return S(
test, prefix, lambda test_name:
f.AddMemoryTest(test_name, test_type, factory_properties=fp),
lambda test_name:
f.AddBuildrunnerMemoryTest(
test_name, test_type, factory_properties=fp))
# Valgrind tests:
for test in tests[:]:
# TODO(timurrrr): replace 'valgrind' with 'memcheck'
# below and in master.chromium/master.cfg
if M(test, 'valgrind_', 'memcheck', fp):
continue
# Run TSan in two-stage RaceVerifier mode.
if M(test, 'tsan_rv_', 'tsan_rv', fp):
continue
if M(test, 'tsan_', 'tsan', fp):
continue
if M(test, 'drmemory_light_', 'drmemory_light', fp):
continue
if M(test, 'drmemory_full_', 'drmemory_full', fp):
continue
if M(test, 'drmemory_pattern_', 'drmemory_pattern', fp):
continue
if R('chromedriver_tests'):
f.AddChromeDriverTest()
if R('webdriver_tests'):
f.AddWebDriverTest()
# Dynamorio coverage.
if R('trigger_coverage_tests'):
f.AddTriggerCoverageTests(fp)
if R('extract_dynamorio_build'):
f.AddExtractDynamorioBuild(fp)
if R('coverage_tests'):
f.AddCoverageTests(fp)
# When adding a test that uses a new executable, update kill_processes.py.
# Coverage tests. Add coverage processing absoluely last, after
# all tests have run. Tests which run after coverage processing
# don't get counted.
if R('process_coverage'):
f.AddProcessCoverage(fp)
# Add nacl integration tests (do these toward the end as they use the
# annotator).
if R('nacl_integration'):
f.AddNaClIntegrationTestStep(fp)
if R('nacl_integration_br'):
f.AddBuildrunnerNaClIntegrationTestStep(fp)
if R('nacl_integration_memcheck'):
f.AddNaClIntegrationTestStep(fp, None, 'memcheck-browser-tests')
if R('nacl_integration_tsan'):
f.AddNaClIntegrationTestStep(fp, None, 'tsan-browser-tests')
if R('buildrunner_tests'):
f.AddBuildStep(factory_properties, name='buildrunner_tests')
# Add bisection test (if this is specified, it should be the only test)
if R('bisect_revisions'):
f.AddBisectTest()
# Add an optional set of annotated steps.
# NOTE: This really should go last as it can be confusing if the annotator
# isn't the last thing to run.
if R('annotated_steps'):
f.AddAnnotatedSteps(fp)
# If this assert triggers and the test name is valid, make sure R() is used.
# If you are using a subclass, make sure the tests list provided to
# _AddTests() had the factory-specific tests stripped off.
assert not tests, 'Did you make a typo? %s wasn\'t processed' % tests
def ChromiumFactory(self, target='Release', clobber=False, tests=None,
mode=None, slave_type='BuilderTester',
options=None, compile_timeout=1200, build_url=None,
project=None, factory_properties=None, gclient_deps=None,
run_default_swarm_tests=None):
factory_properties = (factory_properties or {}).copy()
run_default_swarm_tests = run_default_swarm_tests or []
# Default to the configuration of Blink appropriate for Chromium patches.
factory_properties.setdefault('blink_config', 'chromium')
if factory_properties['blink_config'] == 'blink':
# This will let builders embed their webkit revision in their output
# filename and will let testers look for zip files containing a webkit
# revision in their filename. For this to work correctly, the testers
# need to be on a Triggerable that's activated by their builder.
factory_properties.setdefault('webkit_dir', 'third_party/WebKit/Source')
factory_properties['gclient_env'] = \
factory_properties.get('gclient_env', {}).copy()
tests = tests or []
if factory_properties.get('needs_valgrind'):
self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_VALGRIND]
elif factory_properties.get('needs_tsan_win'):
self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_TSAN_WIN]
elif factory_properties.get('needs_webdriver_java_tests'):
self._solutions[0].custom_deps_list = [
self.CUSTOM_DEPS_WEBDRIVER_JAVA_TESTS
]
if 'devtools_perf' in tests:
self._solutions[0].custom_deps_list.extend(self.CUSTOM_DEPS_DEVTOOLS_PERF)
if factory_properties.get('safesync_url'):
self._solutions[0].safesync_url = factory_properties.get('safesync_url')
elif factory_properties.get('lkgr'):
self._solutions[0].safesync_url = self.SAFESYNC_URL_CHROMIUM
tests_for_build = [
re.match('^(?:valgrind_)?(.*)$', t).group(1) for t in tests]
# Ensure that component is set correctly in the gyp defines.
ForceComponent(target, project, factory_properties['gclient_env'])
factory = self.BuildFactory(target, clobber, tests_for_build, mode,
slave_type, options, compile_timeout, build_url,
project, factory_properties,
gclient_deps=gclient_deps,
skip_archive_steps=False)
# Get the factory command object to create new steps to the factory.
chromium_cmd_obj = chromium_commands.ChromiumCommands(factory,
target,
self._build_dir,
self._target_platform)
# Add this archive build step.
if factory_properties.get('archive_build'):
chromium_cmd_obj.AddArchiveBuild(factory_properties=factory_properties)
# TODO(thakis): Remove this after a while.
assert not factory_properties.get('cf_archive_build')
# Add a trigger step if needed.
self.TriggerFactory(factory, slave_type=slave_type,
factory_properties=factory_properties)
# Add all the tests.
self._AddTests(chromium_cmd_obj, tests, mode, factory_properties)
# TODO(thakis): Remove this after a while.
assert not factory_properties.get('late_cf_archive_build')
if factory_properties.get('process_dumps'):
chromium_cmd_obj.AddProcessDumps()
return factory