def setUp(self): self.buildroot = os.path.join(self.tempdir, 'buildroot') osutils.SafeMakedirs(self.buildroot) # Always stub RunCommmand out as we use it in every method. self.site_config = config_lib_unittest.MockSiteConfig() self.build_config = config_lib_unittest.MockBuildConfig() self.bot_id = self.build_config.name self.build_config['master'] = False self.build_config['important'] = False # Use the cbuildbot parser to create properties and populate default values. self.parser = cbuildbot._CreateParser() argv = ['-r', self.buildroot, '--buildbot', '--debug', self.bot_id] self.options, _ = cbuildbot._ParseCommandLine(self.parser, argv) self.options.bootstrap = False self.options.clean = False self.options.resume = False self.options.sync = False self.options.build = False self.options.uprev = False self.options.tests = False self.options.archive = False self.options.remote_test_status = False self.options.patches = None self.options.prebuilts = False self._manager = parallel.Manager() self._manager.__enter__() self.run = cbuildbot_run.BuilderRun(self.options, self.site_config, self.build_config, self._manager) self.rc.AddCmdResult( [constants.PATH_TO_CBUILDBOT, '--reexec-api-version'], output=constants.REEXEC_API_VERSION)
def CreateMockSiteConfig(): """Create a mocked site_config object for workspace builds. Returns: SiteConfig instance with new configs on it. """ site_config = config_lib_unittest.MockSiteConfig() production_config = config_lib.GetConfig() # Copy some templates from production. site_config.AddTemplate( 'buildspec', production_config.templates.buildspec, ) site_config.AddTemplate( 'firmwarebranch', production_config.templates.firmwarebranch, ) site_config.AddTemplate( 'factorybranch', production_config.templates.factorybranch, ) # Create test configs. site_config.Add( 'buildspec', site_config.templates.buildspec, workspace_branch='test-branch', ) buildspec_parent = site_config.Add( 'buildspec-child', site_config.templates.buildspec, workspace_branch='test-branch', ) buildspec_parent.AddSlaves([ site_config.Add( 'test-firmwarebranch', site_config.templates.firmwarebranch, workspace_branch='test-branch', boards=['board'], ), site_config.Add( 'test-multi-firmwarebranch', site_config.templates.firmwarebranch, workspace_branch='test-branch', boards=['boardA', 'boardB'], ), site_config.Add( 'test-factorybranch', site_config.templates.factorybranch, workspace_branch='test-branch', boards=['board'], ), ]) return site_config
def _GetPaygenBuildInstance(self, build, skip_delta_payloads=False): """Helper method to create a standard Paygen instance.""" return paygen_build_lib.PaygenBuild( build, self.tempdir, config_lib_unittest.MockSiteConfig(), skip_delta_payloads=skip_delta_payloads)
def setUp(self): # pylint: disable=protected-access self.site_config = config_lib_unittest.MockSiteConfig() self.parser = cbuildbot._CreateParser() args = ['-r', '/tmp/test_build1', '-g', '5555', '-g', '6666', '--remote'] args.extend(self.BOTS) self.options, args = cbuildbot._ParseCommandLine(self.parser, args) self.options.cache_dir = self.tempdir self.checkout_dir = os.path.join(self.tempdir, 'test_checkout') self.int_mirror, self.ext_mirror = None, None
def _NewBuilderRun(self, options=None, config=None): """Create a BuilderRun objection from options and config values. Args: options: Specify options or default to DEFAULT_OPTIONS. config: Specify build config or default to DEFAULT_CONFIG. Returns: BuilderRun object. """ options = options or DEFAULT_OPTIONS config = config or DEFAULT_CONFIG site_config = config_lib_unittest.MockSiteConfig() site_config[config.name] = config return cbuildbot_run.BuilderRun(options, site_config, config, self._manager)
def setUp(self): # Always stub RunCommmand out as we use it in every method. self._bot_id = 'amd64-generic-paladin' self.buildstore = FakeBuildStore() site_config = config_lib_unittest.MockSiteConfig() build_config = site_config[self._bot_id] self.build_root = '/fake_root' # This test compares log output from the stages, so turn on buildbot # logging. logging.EnableBuildbotMarkers() self.db = fake_cidb.FakeCIDBConnection() cidb.CIDBConnectionFactory.SetupMockCidb(self.db) # Create a class to hold class Options(object): """Dummy class to hold option values.""" options = Options() options.archive_base = 'gs://dontcare' options.buildroot = self.build_root options.debug = False options.prebuilts = False options.clobber = False options.nosdk = False options.remote_trybot = False options.latest_toolchain = False options.buildnumber = 1234 options.android_rev = None options.chrome_rev = None options.branch = 'dontcare' options.chrome_root = False options.build_config_name = '' self._manager = parallel.Manager() # Pylint-1.9 has a false positive on this for some reason. self._manager.__enter__() # pylint: disable=no-value-for-parameter self._run = cbuildbot_run.BuilderRun(options, site_config, build_config, self._manager) results_lib.Results.Clear()
def setUp(self): self.parser = cbuildbot._CreateParser() self.site_config = config_lib_unittest.MockSiteConfig()