diff options
-rw-r--r-- | cbuildbot/config_dump.json | 380 | ||||
-rw-r--r-- | cbuildbot/config_lib.py | 109 | ||||
-rw-r--r-- | cbuildbot/config_lib_unittest.py | 21 | ||||
-rw-r--r-- | cbuildbot/constants.py | 3 | ||||
-rw-r--r-- | cbuildbot/generate_chromeos_config.py | 222 | ||||
-rw-r--r-- | cbuildbot/generate_chromeos_config_unittest.py | 33 | ||||
-rw-r--r-- | cbuildbot/stages/completion_stages_unittest.py | 10 | ||||
-rw-r--r-- | cbuildbot/stages/sync_stages_unittest.py | 3 | ||||
-rw-r--r-- | cbuildbot/validation_pool.py | 6 | ||||
-rw-r--r-- | scripts/summarize_build_stats_unittest.py | 2 |
10 files changed, 273 insertions, 516 deletions
diff --git a/cbuildbot/config_dump.json b/cbuildbot/config_dump.json index 4caa11dc8..4df959196 100644 --- a/cbuildbot/config_dump.json +++ b/cbuildbot/config_dump.json @@ -1,5 +1,6 @@ { "_default": { + "_template": null, "active_waterfall": null, "afdo_generate": false, "afdo_generate_min": false, @@ -158,7 +159,7 @@ "chroot_replace": true, "description": "Build with Address Sanitizer (Clang)", "disk_layout": "2gb-rootfs", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ChromiumOS-SDK", + "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Continuous", "name": "amd64-generic-asan", "profile": "asan", "trybot_list": true, @@ -171,14 +172,24 @@ "boards": [ "amd64-generic" ], - "build_type": "binary", + "build_type": "paladin", + "chrome_sdk": true, + "chrome_sdk_build_chrome": false, "chroot_replace": true, "description": "Paladin build with Address Sanitizer (Clang)", "disk_layout": "2gb-rootfs", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ChromiumOS-SDK", + "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ASAN", + "image_test": true, + "images": [ + "base", + "test" + ], + "manifest_version": true, "name": "amd64-generic-asan-paladin", + "prebuilts": "public", "profile": "asan", - "uprev": false, + "trybot_list": true, + "upload_standalone_images": false, "vm_tests": [ "smoke_suite" ] @@ -389,14 +400,15 @@ "smoke_suite" ] }, - "amd64-generic-telem-chrome-pfq-informational": { + "amd64-generic-telem-chromium-pfq-informational": { "boards": [ "amd64-generic" ], "build_type": "chrome", "chrome_rev": "tot", + "chroot_replace": true, "description": "Telemetry Builds", - "name": "amd64-generic-telem-chrome-pfq-informational", + "name": "amd64-generic-telem-chromium-pfq-informational", "uprev": false, "use_lkgm": true, "vm_tests": [ @@ -422,9 +434,9 @@ "build_type": "chrome", "chrome_rev": "tot", "chroot_replace": true, - "description": "Build with Address Sanitizer (Clang) on TOT", + "description": "Build TOT Chrome with Address Sanitizer (Clang)", "disk_layout": "2gb-rootfs", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ChromiumOS-SDK", + "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ASAN", "name": "amd64-generic-tot-asan-informational", "profile": "asan", "uprev": false, @@ -433,21 +445,6 @@ "smoke_suite" ] }, - "amd64-generic-tot-chrome-pfq-informational": { - "boards": [ - "amd64-generic" - ], - "build_type": "chrome", - "chrome_rev": "tot", - "chroot_replace": true, - "description": "Informational Chromium Uprev & Build (public)", - "name": "amd64-generic-tot-chrome-pfq-informational", - "uprev": false, - "use_lkgm": true, - "vm_tests": [ - "smoke_suite" - ] - }, "amd64-generic-tot-chromium-pfq-informational": { "boards": [ "amd64-generic" @@ -14188,11 +14185,19 @@ ], "build_type": "chrome", "chrome_rev": "tot", + "chromeos_official": true, "chroot_replace": true, - "description": "Informational Chromium Uprev & Build (public)", + "description": "Informational Chrome Uprev & Build (internal)", + "internal": true, + "manifest": "official.xml", + "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", "name": "daisy-tot-chrome-pfq-informational", + "overlays": "both", "uprev": false, "use_lkgm": true, + "useflags": [ + "chrome_internal" + ], "vm_tests": [] }, "daisy-tot-chromium-pfq-informational": { @@ -46555,286 +46560,6 @@ "cros_vm_test" ] }, - "pre-cq-group": { - "archive": false, - "boards": [ - "rambi" - ], - "build_packages_in_background": true, - "build_type": "binary", - "child_configs": [ - { - "archive": false, - "boards": [ - "rambi" - ], - "build_packages_in_background": true, - "build_type": "binary", - "chrome_sdk_build_chrome": false, - "chroot_replace": true, - "cpe_export": false, - "debug_symbols": false, - "description": "Verifies compilation, building an image, and vm/unit tests if supported.", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", - "grouped": true, - "health_alert_recipients": [ - "chromeos-infra-eng@grotations.appspotmail.com" - ], - "health_threshold": 3, - "image_test": true, - "images": [ - "base", - "test" - ], - "important": true, - "internal": true, - "manifest": "official.xml", - "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", - "manifest_version": true, - "name": "rambi-pre-cq", - "overlays": "both", - "pre_cq": true, - "trybot_list": true, - "upload_standalone_images": false, - "useflags": [ - "chrome_internal" - ], - "vm_tests": [ - "smoke_suite" - ] - }, - { - "archive": false, - "boards": [ - "daisy_spring" - ], - "build_packages_in_background": true, - "build_type": "binary", - "chrome_sdk_build_chrome": false, - "chroot_replace": true, - "compilecheck": true, - "cpe_export": false, - "debug_symbols": false, - "description": "Verifies compilation only", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", - "grouped": true, - "health_alert_recipients": [ - "chromeos-infra-eng@grotations.appspotmail.com" - ], - "health_threshold": 3, - "image_test": true, - "images": [ - "base", - "test" - ], - "important": true, - "internal": true, - "manifest": "official.xml", - "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", - "manifest_version": true, - "name": "daisy_spring-compile-only-pre-cq", - "overlays": "both", - "pre_cq": true, - "trybot_list": true, - "unittests": false, - "upload_standalone_images": false, - "useflags": [ - "chrome_internal" - ], - "vm_tests": [] - }, - { - "archive": false, - "boards": [ - "storm" - ], - "build_type": "binary", - "chrome_sdk_build_chrome": false, - "chroot_replace": true, - "compilecheck": true, - "cpe_export": false, - "debug_symbols": false, - "description": "Verifies compilation and unit tests only", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", - "grouped": true, - "health_alert_recipients": [ - "chromeos-infra-eng@grotations.appspotmail.com" - ], - "health_threshold": 3, - "image_test": true, - "images": [ - "base", - "test" - ], - "important": true, - "internal": true, - "manifest": "official.xml", - "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", - "manifest_version": true, - "name": "storm-pre-cq", - "overlays": "both", - "pre_cq": true, - "sync_chrome": false, - "trybot_list": true, - "upload_standalone_images": false, - "useflags": [ - "chrome_internal" - ], - "vm_tests": [] - }, - { - "archive": false, - "boards": [ - "samus" - ], - "build_packages_in_background": true, - "build_type": "binary", - "chrome_sdk_build_chrome": false, - "chroot_replace": true, - "compilecheck": true, - "cpe_export": false, - "debug_symbols": false, - "description": "Verifies compilation only", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", - "grouped": true, - "health_alert_recipients": [ - "chromeos-infra-eng@grotations.appspotmail.com" - ], - "health_threshold": 3, - "image_test": true, - "images": [ - "base", - "test" - ], - "important": true, - "internal": true, - "manifest": "official.xml", - "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", - "manifest_version": true, - "name": "samus-compile-only-pre-cq", - "overlays": "both", - "pre_cq": true, - "trybot_list": true, - "unittests": false, - "upload_standalone_images": false, - "useflags": [ - "chrome_internal" - ], - "vm_tests": [] - }, - { - "archive": false, - "boards": [ - "lumpy" - ], - "build_packages_in_background": true, - "build_type": "binary", - "chrome_sdk_build_chrome": false, - "chroot_replace": true, - "compilecheck": true, - "cpe_export": false, - "debug_symbols": false, - "description": "Verifies compilation only", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", - "grouped": true, - "health_alert_recipients": [ - "chromeos-infra-eng@grotations.appspotmail.com" - ], - "health_threshold": 3, - "image_test": true, - "images": [ - "base", - "test" - ], - "important": true, - "internal": true, - "manifest": "official.xml", - "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", - "manifest_version": true, - "name": "lumpy-compile-only-pre-cq", - "overlays": "both", - "pre_cq": true, - "trybot_list": true, - "unittests": false, - "upload_standalone_images": false, - "useflags": [ - "chrome_internal" - ], - "vm_tests": [] - }, - { - "archive": false, - "boards": [ - "rush_ryu" - ], - "build_packages_in_background": true, - "build_type": "binary", - "chrome_sdk_build_chrome": false, - "chroot_replace": true, - "compilecheck": true, - "cpe_export": false, - "debug_symbols": false, - "description": "Verifies compilation only", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", - "grouped": true, - "health_alert_recipients": [ - "chromeos-infra-eng@grotations.appspotmail.com" - ], - "health_threshold": 3, - "image_test": true, - "images": [ - "base", - "test" - ], - "important": true, - "internal": true, - "manifest": "official.xml", - "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", - "manifest_version": true, - "name": "rush_ryu-compile-only-pre-cq", - "overlays": "both", - "pre_cq": true, - "trybot_list": true, - "unittests": false, - "upload_standalone_images": false, - "useflags": [ - "chrome_internal" - ], - "vm_tests": [] - } - ], - "chrome_sdk_build_chrome": false, - "chroot_replace": true, - "cpe_export": false, - "debug_symbols": false, - "description": "Verifies compilation, building an image, and vm/unit tests if supported.", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", - "health_alert_recipients": [ - "chromeos-infra-eng@grotations.appspotmail.com" - ], - "health_threshold": 3, - "image_test": true, - "images": [ - "base", - "test" - ], - "important": true, - "internal": true, - "manifest": "official.xml", - "manifest_repo_url": "https://chrome-internal-review.googlesource.com/chromeos/manifest-internal", - "manifest_version": true, - "name": "pre-cq-group", - "overlays": "both", - "pre_cq": true, - "trybot_list": true, - "upload_standalone_images": false, - "useflags": [ - "chrome_internal" - ], - "vm_tests": [ - "smoke_suite" - ] - }, "pre-cq-launcher": { "active_waterfall": "chromeos", "boards": [], @@ -57059,13 +56784,13 @@ "boards": [ "storm" ], + "build_packages_in_background": true, "build_type": "binary", "chrome_sdk_build_chrome": false, "chroot_replace": true, - "compilecheck": true, "cpe_export": false, "debug_symbols": false, - "description": "Verifies compilation and unit tests only", + "description": "Verifies compilation, building an image, and vm/unit tests if supported.", "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Pre-CQ", "health_alert_recipients": [ "chromeos-infra-eng@grotations.appspotmail.com" @@ -74377,21 +74102,6 @@ "smoke_suite" ] }, - "x32-generic-tot-chrome-pfq-informational": { - "boards": [ - "x32-generic" - ], - "build_type": "chrome", - "chrome_rev": "tot", - "chroot_replace": true, - "description": "Informational Chromium Uprev & Build (public)", - "name": "x32-generic-tot-chrome-pfq-informational", - "uprev": false, - "use_lkgm": true, - "vm_tests": [ - "smoke_suite" - ] - }, "x32-generic-tot-chromium-pfq-informational": { "boards": [ "x32-generic" @@ -76869,7 +76579,7 @@ "chroot_replace": true, "description": "Build with Address Sanitizer (Clang)", "disk_layout": "2gb-rootfs", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ChromiumOS-SDK", + "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-Continuous", "name": "x86-generic-asan", "profile": "asan", "trybot_list": true, @@ -76888,7 +76598,7 @@ "chroot_replace": true, "description": "Paladin build with Address Sanitizer (Clang)", "disk_layout": "2gb-rootfs", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ChromiumOS-SDK", + "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ASAN", "image_test": true, "images": [ "base", @@ -77111,14 +76821,15 @@ "smoke_suite" ] }, - "x86-generic-telem-chrome-pfq-informational": { + "x86-generic-telem-chromium-pfq-informational": { "boards": [ "x86-generic" ], "build_type": "chrome", "chrome_rev": "tot", + "chroot_replace": true, "description": "Telemetry Builds", - "name": "x86-generic-telem-chrome-pfq-informational", + "name": "x86-generic-telem-chromium-pfq-informational", "uprev": false, "use_lkgm": true, "vm_tests": [ @@ -77144,9 +76855,9 @@ "build_type": "chrome", "chrome_rev": "tot", "chroot_replace": true, - "description": "Full build with Address Sanitizer (Clang) on TOT", + "description": "Build TOT Chrome with Address Sanitizer (Clang)", "disk_layout": "2gb-rootfs", - "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ChromiumOS-SDK", + "doc": "http://www.chromium.org/chromium-os/build/builder-overview#TOC-ASAN", "name": "x86-generic-tot-asan-informational", "profile": "asan", "uprev": false, @@ -77155,21 +76866,6 @@ "smoke_suite" ] }, - "x86-generic-tot-chrome-pfq-informational": { - "boards": [ - "x86-generic" - ], - "build_type": "chrome", - "chrome_rev": "tot", - "chroot_replace": true, - "description": "Informational Chromium Uprev & Build (public)", - "name": "x86-generic-tot-chrome-pfq-informational", - "uprev": false, - "use_lkgm": true, - "vm_tests": [ - "smoke_suite" - ] - }, "x86-generic-tot-chromium-pfq-informational": { "boards": [ "x86-generic" diff --git a/cbuildbot/config_lib.py b/cbuildbot/config_lib.py index 9fb8b581c..bbd3784c6 100644 --- a/cbuildbot/config_lib.py +++ b/cbuildbot/config_lib.py @@ -26,7 +26,6 @@ CONFIG_TYPE_RELEASE_AFDO = 'release-afdo' # This is only used for unitests... find a better solution? CONFIG_TYPE_DUMP_ORDER = ( CONFIG_TYPE_PALADIN, - constants.PRE_CQ_GROUP_CONFIG, CONFIG_TYPE_PRECQ, constants.PRE_CQ_LAUNCHER_CONFIG, 'incremental', @@ -184,27 +183,6 @@ class BuildConfig(dict): return new_config - def HideDefaults(self, default): - """Create a duplicate BuildConfig with default values missing. - - Args: - default: Dictionary of key/value pairs to remove, if present. - - Returns: - A copy BuildConfig, that only contains values different from defaults. - """ - d = BuildConfig() - for k, v in self.iteritems(): - # Recurse to children. - if k == 'child_configs': - v = [child.HideDefaults(default) for child in v] - - # Only store a value if it's different from default. - if k not in default or default[k] != v: - d[k] = v - - return d - class HWTestConfig(object): """Config object for hardware tests suites. @@ -291,10 +269,14 @@ class HWTestConfig(object): class SiteConfig(dict): """This holds a set of named BuildConfig values.""" - def __init__(self, defaults=None): + # Whether to use templates in config_dump.json. + ENABLE_TEMPLATES = False + + def __init__(self, defaults=None, templates=None): """Init.""" super(SiteConfig, self).__init__() self._defaults = {} if defaults is None else defaults + self._templates = {} if templates is None else templates def GetDefault(self): """Create the cannonical default build configuration.""" @@ -302,6 +284,10 @@ class SiteConfig(dict): # All settings must be documented. return BuildConfig(**self._defaults) + def GetTemplates(self): + """Create the cannonical default build configuration.""" + return self._templates + # # Methods for searching a SiteConfig's contents. # @@ -403,7 +389,14 @@ class SiteConfig(dict): See the docstring of derive. """ inherits, overrides = args, kwargs + + # Overrides 'name' and '_template' so that we consistently use the + # provided names and not the names from mix-ins. E.g., If this config + # inherits from multiple templates, we only pay attention to the first + # one listed. TODO(davidjames): Clean up the inheritance more so that + # this isn't needed. overrides['name'] = name + overrides['_template'] = config.get('_template') # Add ourselves into the global dictionary, adding in the defaults. new_config = config.derive(*inherits, **overrides) @@ -413,7 +406,7 @@ class SiteConfig(dict): # can derive from us without inheriting the defaults. return new_config - def AddRawConfig(self, name, *args, **kwargs): + def AddConfigWithoutTemplate(self, name, *args, **kwargs): """Add a config containing only explicitly listed values (no defaults).""" return self.AddConfig(BuildConfig(), name, *args, **kwargs) @@ -443,15 +436,64 @@ class SiteConfig(dict): json_string = self.SaveConfigToString() osutils.WriteFile(config_file, json_string) + def HideDefaults(self, cfg): + """Hide the defaults from a given config entry. + + Args: + cfg: A config entry. + + Returns: + The same config entry, but without any defaults. + """ + my_default = self.GetDefault() + + template = cfg.get('_template') + if template: + my_default.update(self._templates[template]) + my_default['_template'] = None + + d = {} + for k, v in cfg.iteritems(): + if my_default.get(k) != v: + if k == 'child_configs': + d['child_configs'] = [self.HideDefaults(child) for child in v] + else: + d[k] = v + + return d + + def AddTemplate(self, name, *args, **kwargs): + """Create a template named |name|. + + Args: + name: The name of the template. + args: See the docstring of BuildConfig.derive. + kwargs: See the docstring of BuildConfig.derive. + """ + if self.ENABLE_TEMPLATES: + kwargs['_template'] = name + + if args: + cfg = args[0].derive(*args[1:], **kwargs) + else: + cfg = BuildConfig(*args, **kwargs) + + if self.ENABLE_TEMPLATES: + self._templates[name] = cfg + + return cfg + def SaveConfigToString(self): """Save this Config object to a Json format string.""" default = self.GetDefault() config_dict = {} for k, v in self.iteritems(): - config_dict[k] = v.HideDefaults(default) + config_dict[k] = self.HideDefaults(v) config_dict['_default'] = default + if self.ENABLE_TEMPLATES: + config_dict['_templates'] = self._templates class _JSONEncoder(json.JSONEncoder): """Json Encoder that encodes objects as their dictionaries.""" @@ -478,14 +520,15 @@ def CreateConfigFromString(json_string): # default is a dictionary of default build configuration values. defaults = config_dict.pop(DEFAULT_BUILD_CONFIG) + templates = config_dict.pop('_templates', None) defaultBuildConfig = BuildConfig(**defaults) - builds = {n: _CreateBuildConfig(defaultBuildConfig, v) + builds = {n: _CreateBuildConfig(defaultBuildConfig, v, templates) for n, v in config_dict.iteritems()} # config is the struct that holds the complete cbuildbot config. - result = SiteConfig(defaults=defaults) + result = SiteConfig(defaults=defaults, templates=templates) result.update(builds) return result @@ -533,19 +576,23 @@ def _CreateHwTestConfig(jsonString): return HWTestConfig(**hw_test_config) -def _CreateBuildConfig(default, build_dict): +def _CreateBuildConfig(default, build_dict, templates): """Create a BuildConfig object from it's parsed JSON dictionary encoding.""" # These build config values need special handling. - hwtests = build_dict.pop('hw_tests', None) child_configs = build_dict.pop('child_configs', None) + template = build_dict.get('_template') - result = default.derive(**build_dict) + my_default = default + if template: + my_default = default.derive(templates[template]) + result = my_default.derive(**build_dict) + hwtests = result.pop('hw_tests', None) if hwtests is not None: result['hw_tests'] = [_CreateHwTestConfig(hwtest) for hwtest in hwtests] if child_configs is not None: - result['child_configs'] = [_CreateBuildConfig(default, child) + result['child_configs'] = [_CreateBuildConfig(default, child, templates) for child in child_configs] return result diff --git a/cbuildbot/config_lib_unittest.py b/cbuildbot/config_lib_unittest.py index 5e115df19..c450f7879 100644 --- a/cbuildbot/config_lib_unittest.py +++ b/cbuildbot/config_lib_unittest.py @@ -8,6 +8,7 @@ from __future__ import print_function import copy import cPickle +import json from chromite.cbuildbot import cbuildbot_config from chromite.cbuildbot import config_lib @@ -324,33 +325,41 @@ class ConfigClassTest(cros_test_lib.TestCase): src_str = """{ "_default": { "bar": true, + "baz": false, "child_configs": [], "foo": false, "hw_tests": [] }, "diff_build": { "bar": false, - "foo": true + "foo": true, + "name": "diff_build" + }, + "match_build": { + "name": "match_build" }, - "match_build": {}, "parent_build": { "child_configs": [ - {}, + { + "name": "empty_build" + }, { "bar": false, + "name": "child_build", "hw_tests": [ "{\\n \\"async\\": true,\\n \\"blocking\\": false,\\n \\"critical\\": false,\\n \\"file_bugs\\": true,\\n \\"max_retries\\": null,\\n \\"minimum_duts\\": 4,\\n \\"num\\": 2,\\n \\"pool\\": \\"bvt\\",\\n \\"priority\\": \\"PostBuild\\",\\n \\"retry\\": false,\\n \\"suite\\": \\"bvt-perbuild\\",\\n \\"suite_min_duts\\": 1,\\n \\"timeout\\": 13200,\\n \\"warn_only\\": false\\n}" ] } - ] + ], + "name": "parent_build" } }""" config = config_lib.CreateConfigFromString(src_str) config_str = config.SaveConfigToString() - # Verify that the dumped string matches the source string. - self.assertEqual(src_str, config_str) + # Verify that the dumped object matches the source object. + self.assertEqual(json.loads(src_str), json.loads(config_str)) # Verify assorted stuff in the loaded config to make sure it matches # expectations. diff --git a/cbuildbot/constants.py b/cbuildbot/constants.py index 9befd01b2..6933e330b 100644 --- a/cbuildbot/constants.py +++ b/cbuildbot/constants.py @@ -477,9 +477,6 @@ VALID_BUILD_TYPES = ( PROJECT_SDK_TYPE, ) -# The name of the standard pre-cq testing config. -PRE_CQ_GROUP_CONFIG = 'pre-cq-group' - # The default list of pre-cq configs to use. PRE_CQ_DEFAULT_CONFIGS = ['rambi-pre-cq', 'mixed-a-pre-cq', 'mixed-b-pre-cq', 'mixed-c-pre-cq'] diff --git a/cbuildbot/generate_chromeos_config.py b/cbuildbot/generate_chromeos_config.py index e3d7dc2f0..d863d4d58 100644 --- a/cbuildbot/generate_chromeos_config.py +++ b/cbuildbot/generate_chromeos_config.py @@ -20,6 +20,10 @@ CONFIG_FILE = os.path.join(constants.CHROMITE_DIR, 'cbuildbot', # Enumeration of valid settings; any/all config settings must be in this. # All settings must be documented. _settings = dict( + + # The name of the template we inherit settings from. + _template=None, + # The name of the config. name=None, @@ -759,15 +763,7 @@ no_unittest_builder = config_lib.BuildConfig( # Builder-specific mixins -binary = config_lib.BuildConfig( - # Full builds that build fully from binaries. - build_type=constants.BUILD_FROM_SOURCE_TYPE, - archive_build_debug=True, - images=['test', 'factory_install'], - git_sync=True, -) - -full = config_lib.BuildConfig( +full = _CONFIG.AddTemplate('full', # Full builds are test builds to show that we can build from scratch, # so use settings to build from scratch, and archive the results. @@ -802,7 +798,7 @@ pfq = config_lib.BuildConfig( 'TOC-Chrome-PFQ', ) -paladin = config_lib.BuildConfig( +paladin = _CONFIG.AddTemplate('paladin', important=True, build_type=constants.PALADIN_TYPE, overlays=constants.PUBLIC_OVERLAYS, @@ -820,7 +816,7 @@ paladin = config_lib.BuildConfig( # Incremental builders are intended to test the developer workflow. # For that reason, they don't uprev. -incremental = config_lib.BuildConfig( +incremental = _CONFIG.AddTemplate('incremental', build_type=constants.INCREMENTAL_TYPE, uprev=False, overlays=constants.PUBLIC_OVERLAYS, @@ -852,7 +848,7 @@ moblab = config_lib.BuildConfig( ) # Builds for the Project SDK. -project_sdk = config_lib.BuildConfig( +project_sdk = _CONFIG.AddTemplate('project-sdk', build_type=constants.PROJECT_SDK_TYPE, description='Produce Project SDK build artifacts.', @@ -898,7 +894,8 @@ official = official_chrome.derive( chromeos_official=True, ) -_cros_sdk = _CONFIG.AddConfig(full_prebuilts, 'chromiumos-sdk', +_cros_sdk = _CONFIG.AddConfigWithoutTemplate('chromiumos-sdk', + full_prebuilts, # The amd64-host has to be last as that is when the toolchains # are bundled up for inclusion in the sdk. boards=['x86-generic', 'arm-generic', 'amd64-generic', 'mipsel-o32-generic'], @@ -911,7 +908,7 @@ _cros_sdk = _CONFIG.AddConfig(full_prebuilts, 'chromiumos-sdk', 'TOC-Continuous', ) -asan = config_lib.BuildConfig( +asan = _CONFIG.AddTemplate('asan', chroot_replace=True, profile='asan', disk_layout='2gb-rootfs', @@ -920,10 +917,10 @@ asan = config_lib.BuildConfig( # memory limits. Remove the following line once crbug.com/329248 is fixed. vm_tests=[constants.SMOKE_SUITE_TEST_TYPE], doc='http://www.chromium.org/chromium-os/build/builder-overview#' - 'TOC-ChromiumOS-SDK', + 'TOC-ASAN', ) -telemetry = config_lib.BuildConfig( +telemetry = _CONFIG.AddTemplate('telemetry', build_type=constants.INCREMENTAL_TYPE, uprev=False, overlays=constants.PUBLIC_OVERLAYS, @@ -931,7 +928,7 @@ telemetry = config_lib.BuildConfig( description='Telemetry Builds', ) -chromium_pfq = config_lib.BuildConfig( +chromium_pfq = _CONFIG.AddTemplate('chromium-pfq', build_type=constants.CHROME_PFQ_TYPE, important=True, uprev=False, @@ -961,7 +958,8 @@ _CONFIG.AddConfig(internal_chromium_pfq, 'master-chromium-pfq', chrome_sdk=False, ) -chrome_pfq = internal_chromium_pfq.derive( +chrome_pfq = _CONFIG.AddTemplate('chrome-pfq', + internal_chromium_pfq, official, important=True, overlays=constants.BOTH_OVERLAYS, @@ -977,23 +975,22 @@ chrome_try = config_lib.BuildConfig( manifest_version=False, ) -chromium_info = chromium_pfq.derive( +chromium_info = _CONFIG.AddTemplate('chromium-pfq-informational', + chromium_pfq, chrome_try, vm_tests=[constants.SMOKE_SUITE_TEST_TYPE], chrome_sdk=False, description='Informational Chromium Uprev & Build (public)', ) -telemetry_info = telemetry.derive( - chrome_try, -) - -chrome_info = chromium_info.derive( +chrome_info = _CONFIG.AddTemplate('chrome-pfq-informational', + chromium_info, internal, official, description='Informational Chrome Uprev & Build (internal)', ) -chrome_perf = chrome_info.derive( +chrome_perf = _CONFIG.AddTemplate('chrome-perf', + chrome_info, description='Chrome Performance test bot', vm_tests=[], unittests=False, @@ -1451,7 +1448,8 @@ _telemetry_boards = frozenset([ _CreateConfigsForBoards(telemetry, _telemetry_boards, 'telemetry') -_toolchain_major = _CONFIG.AddConfig(_cros_sdk, 'toolchain-major', +_toolchain_major = _CONFIG.AddConfigWithoutTemplate('toolchain-major', + _cros_sdk, latest_toolchain=True, prebuilts=False, trybot_list=False, @@ -1459,7 +1457,8 @@ _toolchain_major = _CONFIG.AddConfig(_cros_sdk, 'toolchain-major', description='Test next major toolchain revision', ) -_toolchain_minor = _CONFIG.AddConfig(_cros_sdk, 'toolchain-minor', +_toolchain_minor = _CONFIG.AddConfigWithoutTemplate('toolchain-minor', + _cros_sdk, latest_toolchain=True, prebuilts=False, trybot_list=False, @@ -1467,30 +1466,32 @@ _toolchain_minor = _CONFIG.AddConfig(_cros_sdk, 'toolchain-minor', description='Test next minor toolchain revision', ) -_CONFIG.AddConfig(incremental, 'x86-generic-asan', - asan, +_CONFIG.AddConfig(asan, 'x86-generic-asan', + incremental, boards=['x86-generic'], description='Build with Address Sanitizer (Clang)', trybot_list=True, ) -_CONFIG.AddConfig(chromium_info, 'x86-generic-tot-asan-informational', +tot_asan_info = _CONFIG.AddTemplate('tot-asan-informational', + chromium_info, asan, + description='Build TOT Chrome with Address Sanitizer (Clang)', +) + +_CONFIG.AddConfig(tot_asan_info, 'x86-generic-tot-asan-informational', boards=['x86-generic'], - description='Full build with Address Sanitizer (Clang) on TOT', ) -_CONFIG.AddConfig(incremental, 'amd64-generic-asan', - asan, +_CONFIG.AddConfig(asan, 'amd64-generic-asan', + incremental, boards=['amd64-generic'], description='Build with Address Sanitizer (Clang)', trybot_list=True, ) -_CONFIG.AddConfig(chromium_info, 'amd64-generic-tot-asan-informational', - asan, +_CONFIG.AddConfig(tot_asan_info, 'amd64-generic-tot-asan-informational', boards=['amd64-generic'], - description='Build with Address Sanitizer (Clang) on TOT', ) incremental_beaglebone = incremental.derive(beaglebone) @@ -1500,7 +1501,7 @@ _CONFIG.AddConfig(incremental_beaglebone, 'beaglebone-incremental', description='Incremental Beaglebone Builder', ) -_CONFIG.AddRawConfig('refresh-packages', +_CONFIG.AddConfigWithoutTemplate('refresh-packages', boards=['x86-generic', 'arm-generic'], builder_class_name='misc_builders.RefreshPackagesBuilder', description='Check upstream Gentoo for package updates', @@ -1536,7 +1537,7 @@ _CONFIG.AddConfig(paladin, 'x86-generic-asan-paladin', important=False, ) -_CONFIG.AddConfig(incremental, 'amd64-generic-asan-paladin', +_CONFIG.AddConfig(paladin, 'amd64-generic-asan-paladin', _base_configs['amd64-generic'], asan, description='Paladin build with Address Sanitizer (Clang)', @@ -1552,28 +1553,10 @@ _chrome_perf_boards = frozenset([ _CreateConfigsForBoards(chrome_perf, _chrome_perf_boards, 'chrome-perf', trybot_list=True) -chromium_info_x86 = \ -_CONFIG.AddConfig(chromium_info, 'x86-generic-tot-chrome-pfq-informational', - boards=['x86-generic'], -) - -chromium_info_daisy = \ -_CONFIG.AddConfig(chromium_info, 'daisy-tot-chrome-pfq-informational', - vm_tests=[], - boards=['daisy'], -) - -chromium_info_amd64 = \ -_CONFIG.AddConfig(chromium_info, 'amd64-generic-tot-chrome-pfq-informational', - boards=['amd64-generic'], -) - -_CONFIG.AddConfig(chromium_info, 'x32-generic-tot-chrome-pfq-informational', - boards=['x32-generic'], -) - -_CreateConfigsForBoards(telemetry_info, ['x86-generic', 'amd64-generic'], - 'telem-chrome-pfq-informational') +_CreateConfigsForBoards(chromium_info, + ['x86-generic', 'amd64-generic'], + 'telem-chromium-pfq-informational', + **telemetry.derive(chrome_try)) _CONFIG.AddConfig(chrome_info, 'alex-tot-chrome-pfq-informational', boards=['x86-alex'], @@ -1596,7 +1579,8 @@ internal_pfq = internal.derive(official_chrome, pfq, # Because branch directories may be shared amongst builders on multiple # branches, they must delete the chroot every time they run. # They also potentially need to build [new] Chrome. -internal_pfq_branch = internal_pfq.derive( +internal_pfq_branch = _CONFIG.AddTemplate('pre-flight-branch', + internal_pfq, branch=True, chroot_replace=True, trybot_list=False, @@ -1646,7 +1630,8 @@ _CreateConfigsForBoards(full_compile_paladin, 'full-compile-paladin', ) -pre_cq = paladin.derive( +pre_cq = _CONFIG.AddTemplate('pre-cq', + paladin, build_type=constants.INCREMENTAL_TYPE, build_packages_in_background=True, pre_cq=True, @@ -1672,19 +1657,22 @@ unittest_only_pre_cq = pre_cq.derive( ) # Pre-CQ targets that don't run VMTests. -no_vmtest_pre_cq = pre_cq.derive( +no_vmtest_pre_cq = _CONFIG.AddTemplate('no-vmtest-pre-cq', + pre_cq, description='Verifies compilation, building an image, and unit tests ' 'if supported.', vm_tests=[], ) # Pre-CQ targets that only check compilation. -compile_only_pre_cq = unittest_only_pre_cq.derive( +compile_only_pre_cq = _CONFIG.AddTemplate('compile-only-pre-cq', + unittest_only_pre_cq, description='Verifies compilation only', unittests=False, ) -_CONFIG.AddConfig(internal_paladin, constants.BRANCH_UTIL_CONFIG, +_CONFIG.AddConfigWithoutTemplate(constants.BRANCH_UTIL_CONFIG, + internal_paladin, boards=[], # Disable postsync_patch to prevent conflicting patches from being applied - # e.g., patches from 'master' branch being applied to a branch. @@ -1718,7 +1706,8 @@ _CONFIG.AddConfig(internal_pfq_branch, 'lumpy-pre-flight-branch', # A test-ap image is just a test image with a special profile enabled. # Note that each board enabled for test-ap use has to have the testbed-ap # profile linked to from its private overlay. -_test_ap = internal.derive( +_test_ap = _CONFIG.AddTemplate('test-ap', + internal, description='WiFi AP images used in testing', profile='testbed-ap', vm_tests=[], @@ -1986,7 +1975,8 @@ _CreateConfigsForBoards(pre_cq, _all_boards, 'pre-cq') _CreateConfigsForBoards(no_vmtest_pre_cq, _all_boards, 'no-vmtest-pre-cq') _CreateConfigsForBoards(compile_only_pre_cq, _all_boards, 'compile-only-pre-cq') -_CONFIG.AddConfig(no_vmtest_pre_cq, constants.BINHOST_PRE_CQ, +_CONFIG.AddConfig(pre_cq, constants.BINHOST_PRE_CQ, + no_vmtest_pre_cq, internal, boards=[], binhost_test=True, @@ -2032,35 +2022,8 @@ _CONFIG.AddGroup('kernel-3_14-c-pre-cq', _CONFIG['rush_ryu-no-vmtest-pre-cq'] ) -# TODO (crbug.com/438839): pre-cq-group has been replaced by multiple -# configs. Remove this config when no active CL has been screened -# with this config. -_CONFIG.AddGroup(constants.PRE_CQ_GROUP_CONFIG, - # amd64 w/kernel 3.10. This builder runs VMTest so it's going to be - # the slowest one. - _CONFIG['rambi-pre-cq'], - - # daisy_spring w/kernel 3.8. - _CONFIG['daisy_spring-compile-only-pre-cq'], - - # brillo config. We set build_packages_in_background=False here, so - # that subsequent boards (samus, lumpy, parrot) don't get launched until - # after duck finishes BuildPackages. - _CONFIG.AddConfig(unittest_only_pre_cq, 'storm-pre-cq', - _base_configs['storm'], - build_packages_in_background=False), - - # samus w/kernel 3.14. - _CONFIG['samus-compile-only-pre-cq'], - - # lumpy w/kernel 3.8. - _CONFIG['lumpy-compile-only-pre-cq'], - - # arm64 w/kernel 3.4. - _CONFIG['rush_ryu-compile-only-pre-cq'], -) - -_CONFIG.AddConfig(internal_paladin, 'pre-cq-launcher', +_CONFIG.AddConfigWithoutTemplate('pre-cq-launcher', + internal_paladin, boards=[], build_type=constants.PRE_CQ_LAUNCHER_TYPE, description='Launcher for Pre-CQ builders', @@ -2083,21 +2046,24 @@ _CONFIG.AddConfig(internal_incremental, 'lakitu-incremental', vm_tests=[constants.SMOKE_SUITE_TEST_TYPE], ) -_CONFIG.AddConfig( - _toolchain_major, 'internal-toolchain-major', internal, official, +_CONFIG.AddConfigWithoutTemplate('internal-toolchain-major', + _toolchain_major, internal, official, boards=['x86-alex', 'stumpy', 'daisy'], build_tests=True, description=_toolchain_major['description'] + ' (internal)', ) -_CONFIG.AddConfig( - _toolchain_minor, 'internal-toolchain-minor', internal, official, +_CONFIG.AddConfigWithoutTemplate('internal-toolchain-minor', + _toolchain_minor, internal, official, boards=['x86-alex', 'stumpy', 'daisy'], build_tests=True, description=_toolchain_minor['description'] + ' (internal)', ) -_release = full.derive(official, internal, +_release = _CONFIG.AddTemplate('release', + full, + official, + internal, build_type=constants.CANARY_TYPE, useflags=append_useflags(['-cros-debug']), build_tests=True, @@ -2181,39 +2147,40 @@ _CONFIG.AddGroup('x86-zgb-release-group', release_afdo = _release.derive( trybot_list=False, - hw_tests=HWTestList.DefaultList(pool=constants.HWTEST_SUITES_POOL, - num=4) + + hw_tests=HWTestList.DefaultList(pool=constants.HWTEST_SUITES_POOL, num=4) + HWTestList.AFDOList(), push_image=False, paygen=False, dev_installer_prebuilts=False, ) +release_afdo_generate = _CONFIG.AddTemplate( + config_lib.CONFIG_TYPE_RELEASE_AFDO + '-generate', + release_afdo, + afdo_generate_min=True, + afdo_use=False, + afdo_update_ebuild=True, +) + +release_afdo_use = _CONFIG.AddTemplate( + config_lib.CONFIG_TYPE_RELEASE_AFDO + '-use', + release_afdo, + afdo_use=True, +) + + # Now generate generic release-afdo configs if we haven't created anything more # specific above already. release-afdo configs are builders that do AFDO profile # collection and optimization in the same builder. Used by developers that # want to measure performance changes caused by their changes. def _AddAFDOConfigs(): for board in _all_release_boards: - base = {} + base = {'boards': [board]} if board in _no_unittest_boards: base.update(no_unittest_builder) if board in _no_vmtest_boards: base.update(vm_tests=[]) - generate_config = config_lib.BuildConfig( - base, - boards=[board], - afdo_generate_min=True, - afdo_use=False, - afdo_update_ebuild=True, - ) - use_config = config_lib.BuildConfig( - base, - boards=[board], - afdo_use=True, - ) - config_name = '%s-%s' % (board, config_lib.CONFIG_TYPE_RELEASE_AFDO) if config_name not in _CONFIG: generate_config_name = '%s-%s-%s' % (board, @@ -2224,9 +2191,8 @@ def _AddAFDOConfigs(): 'use') _CONFIG.AddGroup( config_name, - _CONFIG.AddConfig(release_afdo, generate_config_name, - generate_config), - _CONFIG.AddConfig(release_afdo, use_config_name, use_config)) + _CONFIG.AddConfig(release_afdo_generate, generate_config_name, base), + _CONFIG.AddConfig(release_afdo_use, use_config_name, base)) _AddAFDOConfigs() @@ -2682,7 +2648,8 @@ _AddGroupConfig('oak', 'oak', ( # Naming conventions also must be followed. Factory and firmware branches must # end in -factory or -firmware suffixes. -_factory_release = _release.derive( +_factory_release = _CONFIG.AddTemplate('factory', + _release, upload_hw_test_artifacts=False, upload_symbols=False, hw_tests=[], @@ -2712,16 +2679,20 @@ _firmware = config_lib.BuildConfig( image_test=False, ) -_firmware_release = _release.derive(_firmware, +_firmware_release = _CONFIG.AddTemplate('firmware', + _release, + _firmware, description='Firmware Canary', manifest=constants.DEFAULT_MANIFEST, afdo_use=False, ) -_depthcharge_release = _firmware_release.derive( +_depthcharge_release = _CONFIG.AddTemplate('depthcharge-firmware', + _firmware_release, useflags=append_useflags(['depthcharge'])) -_depthcharge_full_internal = full.derive( +_depthcharge_full_internal = _CONFIG.AddTemplate('depthcharge-full-firmware', + full, internal, _firmware, useflags=append_useflags(['depthcharge']), @@ -2837,7 +2808,8 @@ _CONFIG.AddConfig(_factory_release, 'x86-mario-factory', boards=['x86-mario'], ) -_payloads = internal.derive( +_payloads = _CONFIG.AddTemplate('payloads', + internal, build_type=constants.PAYLOADS_TYPE, builder_class_name='release_builders.GeneratePayloadsBuilder', description='Regenerate release payloads.', diff --git a/cbuildbot/generate_chromeos_config_unittest.py b/cbuildbot/generate_chromeos_config_unittest.py index 4177a3390..e221daaab 100644 --- a/cbuildbot/generate_chromeos_config_unittest.py +++ b/cbuildbot/generate_chromeos_config_unittest.py @@ -771,3 +771,36 @@ class OverrideForTrybotTest(GenerateChromeosConfigTestBase): for config in self.all_configs.values(): if config.binhost_test: self.assertEqual(config.boards, []) + + +class TemplateTest(GenerateChromeosConfigTestBase): + """Tests for templates.""" + + def testTemplatesUsed(self): + """Test that all templates are used.""" + templates_used = set(cfg['_template'] for cfg in self.all_configs.values()) + templates = set([None] + self.all_configs.GetTemplates().keys()) + self.assertEqual(templates, templates_used) + + def testConfigNamesMatchTemplate(self): + """Test that all configs have names that match their templates.""" + for name, config in self.all_configs.iteritems(): + template = config._template + if template: + child_configs = config.child_configs + if not child_configs: + msg = '%s should end with %s to match its template' + self.assertTrue(name.endswith(template), msg % (name, template)) + else: + msg = 'Child config of %s has name that does not match its template' + self.assertTrue(child_configs[0].name.endswith(template), + msg % name) + + for other in self.all_configs.GetTemplates(): + if name.endswith(other) and other != template: + if template: + msg = '%s has more specific template: %s' % (name, other) + self.assertGreater(len(template), len(other), msg) + else: + msg = '%s should have %s as template' % (name, other) + self.assertFalse(name, msg) diff --git a/cbuildbot/stages/completion_stages_unittest.py b/cbuildbot/stages/completion_stages_unittest.py index 092e6dfec..bdcd70d04 100644 --- a/cbuildbot/stages/completion_stages_unittest.py +++ b/cbuildbot/stages/completion_stages_unittest.py @@ -130,7 +130,7 @@ class MasterSlaveSyncCompletionStageTest( def _GetTestConfig(self): test_config = config_lib.SiteConfig(defaults={}) - test_config.AddRawConfig( + test_config.AddConfigWithoutTemplate( 'test1', manifest_version=True, build_type=constants.PFQ_TYPE, @@ -141,7 +141,7 @@ class MasterSlaveSyncCompletionStageTest( internal=False, master=False, ) - test_config.AddRawConfig( + test_config.AddConfigWithoutTemplate( 'test2', manifest_version=False, build_type=constants.PFQ_TYPE, @@ -152,7 +152,7 @@ class MasterSlaveSyncCompletionStageTest( internal=False, master=False, ) - test_config.AddRawConfig( + test_config.AddConfigWithoutTemplate( 'test3', manifest_version=True, build_type=constants.PFQ_TYPE, @@ -163,7 +163,7 @@ class MasterSlaveSyncCompletionStageTest( internal=True, master=False, ) - test_config.AddRawConfig( + test_config.AddConfigWithoutTemplate( 'test4', manifest_version=True, build_type=constants.PFQ_TYPE, @@ -174,7 +174,7 @@ class MasterSlaveSyncCompletionStageTest( internal=True, master=False, ) - test_config.AddRawConfig( + test_config.AddConfigWithoutTemplate( 'test5', manifest_version=True, build_type=constants.PFQ_TYPE, diff --git a/cbuildbot/stages/sync_stages_unittest.py b/cbuildbot/stages/sync_stages_unittest.py index 012a9fcfb..9d4c4d0de 100644 --- a/cbuildbot/stages/sync_stages_unittest.py +++ b/cbuildbot/stages/sync_stages_unittest.py @@ -284,10 +284,11 @@ class BaseCQTestCase(generic_stages_unittest.StageTestCase): for change in changes: change.flags['COMR'] = '2' if pre_cq_status is not None: + config = constants.PRE_CQ_DEFAULT_CONFIGS[0] new_build_id = self.fake_db.InsertBuild('Pre cq group', constants.WATERFALL_TRYBOT, 1, - constants.PRE_CQ_GROUP_CONFIG, + config, 'bot-hostname') for change in changes: action = clactions.TranslatePreCQStatusToAction(pre_cq_status) diff --git a/cbuildbot/validation_pool.py b/cbuildbot/validation_pool.py index 3365dbf74..8f6965a55 100644 --- a/cbuildbot/validation_pool.py +++ b/cbuildbot/validation_pool.py @@ -51,11 +51,13 @@ PRE_CQ = constants.PRE_CQ CQ = constants.CQ CQ_CONFIG = constants.CQ_MASTER -PRE_CQ_GROUP_CONFIG = constants.PRE_CQ_GROUP_CONFIG PRE_CQ_LAUNCHER_CONFIG = constants.PRE_CQ_LAUNCHER_CONFIG # Set of configs that can reject a CL from the pre-CQ / CQ pipeline. -CQ_PIPELINE_CONFIGS = {CQ_CONFIG, PRE_CQ_GROUP_CONFIG, PRE_CQ_LAUNCHER_CONFIG} +# TODO(davidjames): Any Pre-CQ config can reject CLs now, so this is wrong. +# This is only used for fail counts. Maybe it makes sense to just get rid of +# the fail count? +CQ_PIPELINE_CONFIGS = {CQ_CONFIG, PRE_CQ_LAUNCHER_CONFIG} # The gerrit-on-borg team tells us that delays up to 2 minutes can be # normal. Setting timeout to 3 minutes to be safe-ish. diff --git a/scripts/summarize_build_stats_unittest.py b/scripts/summarize_build_stats_unittest.py index 5096f6c14..2ed7efb19 100644 --- a/scripts/summarize_build_stats_unittest.py +++ b/scripts/summarize_build_stats_unittest.py @@ -51,7 +51,7 @@ class TestCLActionLogic(cros_test_lib.TestCase): t = itertools.count() bot_config = (constants.CQ_MASTER if cq - else constants.PRE_CQ_GROUP_CONFIG) + else constants.PRE_CQ_DEFAULT_CONFIGS[0]) # pylint: disable=bad-continuation test_metadata = [ |