def RunHWTestSuite(self, *args, **kwargs): """Run the hardware test suite, printing logs to stdout.""" kwargs.setdefault('debug', False) with cros_test_lib.LoggingCapturer() as logs: try: cmd_result = commands.RunHWTestSuite(self._build, self._suite, self._board, *args, **kwargs) return cmd_result finally: print(logs.messages)
def PerformStage(self): if self.suite_config.suite == constants.HWTEST_AFDO_SUITE: arch = self._GetPortageEnvVar('ARCH', self._current_board) cpv = portage_util.PortageqBestVisible( constants.CHROME_CP, cwd=self._build_root) # For async AFDO builders, need to skip this check because it's checking # a different bucket for PFQ AFDO. Also for async AFDO builders, no need # to check here because there's an earlier check to avoid generating # AFDO for the same version. if not self._run.config.afdo_generate_async and \ afdo.CheckAFDOPerfData(cpv, arch, gs.GSContext()): logging.info( 'AFDO profile already generated for arch %s ' 'and Chrome %s. Not generating it again', arch, cpv.version_no_rev.split('_')[0]) return build = '/'.join([self._bot_id, self.version]) skip_duts_check = False if config_lib.IsCanaryType(self._run.config.build_type): skip_duts_check = True cmd_result = commands.RunHWTestSuite( build, self.suite_config.suite, self._board_name, model=self._model, pool=self.suite_config.pool, file_bugs=self.suite_config.file_bugs, wait_for_results=self.wait_for_results, priority=self.suite_config.priority, timeout_mins=self.suite_config.timeout_mins, retry=self.suite_config.retry, max_retries=self.suite_config.max_retries, minimum_duts=self.suite_config.minimum_duts, suite_min_duts=self.suite_config.suite_min_duts, suite_args=self.suite_config.suite_args, offload_failures_only=self.suite_config.offload_failures_only, debug=not self.TestsEnabled(self._run), skip_duts_check=skip_duts_check, job_keyvals=self.GetJobKeyvals(), test_args=None) if cmd_result.to_raise: raise cmd_result.to_raise
def ScheduleAutotestTests(suite_name, board, model, build, skip_duts_check, debug, job_keyvals=None): """Run the appropriate command to schedule the Autotests we have prepped. Args: suite_name: The name of the test suite. board: A string representing the name of the archive board. model: The model that will be tested against. build: A string representing the name of the archive build. skip_duts_check: A boolean indicating to not check minimum available DUTs. debug: A boolean indicating whether or not we are in debug mode. job_keyvals: A dict of job keyvals to be injected to suite control file. """ timeout_mins = config_lib.HWTestConfig.SHARED_HW_TEST_TIMEOUT / 60 cmd_result = commands.RunHWTestSuite( board=board, model=model, build=build, suite=suite_name, file_bugs=True, pool='bvt', priority=constants.HWTEST_BUILD_PRIORITY, retry=True, wait_for_results=False, timeout_mins=timeout_mins, suite_min_duts=2, debug=debug, skip_duts_check=skip_duts_check, job_keyvals=job_keyvals) if cmd_result.to_raise: if isinstance(cmd_result.to_raise, failures_lib.TestWarning): logging.warning('Warning running test suite; error output:\n%s', cmd_result.to_raise) else: raise cmd_result.to_raise
def PerformStage(self): if self.suite_config.suite == constants.HWTEST_AFDO_SUITE: arch = self._GetPortageEnvVar('ARCH', self._current_board) cpv = portage_util.PortageqBestVisible(constants.CHROME_CP, cwd=self._build_root) # For async AFDO builders, need to skip this check because it's checking # a different bucket for PFQ AFDO. Also for async AFDO builders, no need # to check here because there's an earlier check to avoid generating # AFDO for the same version. if not self._run.config.afdo_generate_async and \ afdo.CheckAFDOPerfData(cpv, arch, gs.GSContext()): logging.info( 'AFDO profile already generated for arch %s ' 'and Chrome %s. Not generating it again', arch, cpv.version_no_rev.split('_')[0]) return if self.suite_config.suite in [ constants.HWTEST_CTS_QUAL_SUITE, constants.HWTEST_GTS_QUAL_SUITE ]: # Increase the priority for CTS/GTS qualification suite as we want stable # build to have higher priority than beta build (again higher than dev). try: cros_vers = self._run.GetVersionInfo().VersionString().split( '.') # Convert priority to corresponding integer value. self.suite_config.priority = constants.HWTEST_PRIORITIES_MAP[ self.suite_config.priority] # We add 1/10 of the branch version to the priority. This results in a # modest priority bump the older the branch is. Typically beta priority # would be dev + [1..4] and stable priority dev + [5..9]. self.suite_config.priority += int( math.ceil(float(cros_vers[1]) / 10.0)) except cbuildbot_run.VersionNotSetError: logging.debug( 'Could not obtain version info. %s will use initial ' 'priority value: %s', self.suite_config.suite, self.suite_config.priority) build = '/'.join([self._bot_id, self.version]) skip_duts_check = False if config_lib.IsCanaryType(self._run.config.build_type): skip_duts_check = True cmd_result = commands.RunHWTestSuite( build, self.suite_config.suite, self._board_name, model=self._model, pool=self.suite_config.pool, file_bugs=self.suite_config.file_bugs, wait_for_results=self.wait_for_results, priority=self.suite_config.priority, timeout_mins=self.suite_config.timeout_mins, retry=self.suite_config.retry, max_retries=self.suite_config.max_retries, minimum_duts=self.suite_config.minimum_duts, suite_min_duts=self.suite_config.suite_min_duts, suite_args=self.suite_config.suite_args, offload_failures_only=self.suite_config.offload_failures_only, debug=not self.TestsEnabled(self._run), skip_duts_check=skip_duts_check, job_keyvals=self.GetJobKeyvals(), test_args=None) if cmd_result.to_raise: raise cmd_result.to_raise
def PerformStage(self): if self.suite_config.suite == constants.HWTEST_AFDO_SUITE: arch = self._GetPortageEnvVar('ARCH', self._current_board) cpv = portage_util.BestVisible(constants.CHROME_CP, buildroot=self._build_root) if afdo.CheckAFDOPerfData(cpv, arch, gs.GSContext()): logging.info('AFDO profile already generated for arch %s ' 'and Chrome %s. Not generating it again', arch, cpv.version_no_rev.split('_')[0]) return build = '/'.join([self._bot_id, self.version]) if (self._run.options.remote_trybot and (self._run.options.hwtest or self._run.config.pre_cq)): debug = self._run.options.debug_forced else: debug = self._run.options.debug # Get the subsystems set for the board to test per_board_dict = self._run.attrs.metadata.GetDict()['board-metadata'] current_board_dict = per_board_dict.get(self._current_board) if current_board_dict: subsystems = set(current_board_dict.get('subsystems_to_test', [])) # 'subsystem:all' indicates to skip the subsystem logic if 'all' in subsystems: subsystems = None else: subsystems = None skip_duts_check = False if config_lib.IsCanaryType(self._run.config.build_type): skip_duts_check = True build_id, db = self._run.GetCIDBHandle() cmd_result = commands.RunHWTestSuite( build, self.suite_config.suite, self._current_board, pool=self.suite_config.pool, num=self.suite_config.num, file_bugs=self.suite_config.file_bugs, wait_for_results=self.wait_for_results, priority=self.suite_config.priority, timeout_mins=self.suite_config.timeout_mins, retry=self.suite_config.retry, max_retries=self.suite_config.max_retries, minimum_duts=self.suite_config.minimum_duts, suite_min_duts=self.suite_config.suite_min_duts, offload_failures_only=self.suite_config.offload_failures_only, debug=debug, subsystems=subsystems, skip_duts_check=skip_duts_check) subsys_tuple = self.GenerateSubsysResult(cmd_result.json_dump_result, subsystems) if db: if not subsys_tuple: db.InsertBuildMessage(build_id, message_type=constants.SUBSYSTEMS, message_subtype=constants.SUBSYSTEM_UNUSED, board=self._current_board) else: logging.info('pass_subsystems: %s, fail_subsystems: %s', subsys_tuple[0], subsys_tuple[1]) for s in subsys_tuple[0]: db.InsertBuildMessage(build_id, message_type=constants.SUBSYSTEMS, message_subtype=constants.SUBSYSTEM_PASS, message_value=str(s), board=self._current_board) for s in subsys_tuple[1]: db.InsertBuildMessage(build_id, message_type=constants.SUBSYSTEMS, message_subtype=constants.SUBSYSTEM_FAIL, message_value=str(s), board=self._current_board) if cmd_result.to_raise: raise cmd_result.to_raise
def PerformStage(self): if self.suite_config.suite == constants.HWTEST_AFDO_SUITE: arch = self._GetPortageEnvVar('ARCH', self._current_board) cpv = portage_util.BestVisible(constants.CHROME_CP, buildroot=self._build_root) if afdo.CheckAFDOPerfData(cpv, arch, gs.GSContext()): logging.info('AFDO profile already generated for arch %s ' 'and Chrome %s. Not generating it again', arch, cpv.version_no_rev.split('_')[0]) return if self.suite_config.suite in [constants.HWTEST_CTS_FOLLOWER_SUITE, constants.HWTEST_CTS_QUAL_SUITE, constants.HWTEST_GTS_QUAL_SUITE]: # Increase the priority for CTS/GTS qualification suite as we want stable # build to have higher priority than beta build (again higher than dev). try: cros_vers = self._run.GetVersionInfo().VersionString().split('.') if not isinstance(self.suite_config.priority, (int, long)): # Convert CTS/GTS priority to corresponding integer value. self.suite_config.priority = constants.HWTEST_PRIORITIES_MAP[ self.suite_config.priority] # We add 1/10 of the branch version to the priority. This results in a # modest priority bump the older the branch is. Typically beta priority # would be dev + [1..4] and stable priority dev + [5..9]. self.suite_config.priority += int(math.ceil(float(cros_vers[1]) / 10.0)) except cbuildbot_run.VersionNotSetError: logging.debug('Could not obtain version info. %s will use initial ' 'priority value: %s', self.suite_config.suite, self.suite_config.priority) build = '/'.join([self._bot_id, self.version]) # Get the subsystems set for the board to test if self.suite_config.suite == constants.HWTEST_PROVISION_SUITE: subsystems = set() else: subsystems = self._GetSubsystems() skip_duts_check = False if config_lib.IsCanaryType(self._run.config.build_type): skip_duts_check = True build_id, db = self._run.GetCIDBHandle() test_args = None if config_lib.IsCQType(self._run.config.build_type): test_args = {'fast': 'True'} cmd_result = commands.RunHWTestSuite( build, self.suite_config.suite, self._board_name, model=self._model, pool=self.suite_config.pool, file_bugs=self.suite_config.file_bugs, wait_for_results=self.wait_for_results, priority=self.suite_config.priority, timeout_mins=self.suite_config.timeout_mins, retry=self.suite_config.retry, max_retries=self.suite_config.max_retries, minimum_duts=self.suite_config.minimum_duts, suite_min_duts=self.suite_config.suite_min_duts, suite_args=self.suite_config.suite_args, offload_failures_only=self.suite_config.offload_failures_only, debug=not self.TestsEnabled(self._run), subsystems=subsystems, skip_duts_check=skip_duts_check, job_keyvals=self.GetJobKeyvals(), test_args=test_args) if config_lib.IsCQType(self._run.config.build_type): self.ReportHWTestResults(cmd_result.json_dump_result, build_id, db) subsys_tuple = self.GenerateSubsysResult(cmd_result.json_dump_result, subsystems) if db: if not subsys_tuple: db.InsertBuildMessage(build_id, message_type=constants.SUBSYSTEMS, message_subtype=constants.SUBSYSTEM_UNUSED, board=self._current_board) else: logging.info('pass_subsystems: %s, fail_subsystems: %s', subsys_tuple[0], subsys_tuple[1]) for s in subsys_tuple[0]: db.InsertBuildMessage(build_id, message_type=constants.SUBSYSTEMS, message_subtype=constants.SUBSYSTEM_PASS, message_value=str(s), board=self._current_board) for s in subsys_tuple[1]: db.InsertBuildMessage(build_id, message_type=constants.SUBSYSTEMS, message_subtype=constants.SUBSYSTEM_FAIL, message_value=str(s), board=self._current_board) if cmd_result.to_raise: raise cmd_result.to_raise