def run(self, args): """ Run test modules or simple tests. :param args: Command line args received from the run subparser. """ if 'output_check_record' in args: process.OUTPUT_CHECK_RECORD_MODE = getattr(args, 'output_check_record', None) if args.unique_job_id is not None: try: int(args.unique_job_id, 16) if len(args.unique_job_id) != 40: raise ValueError except ValueError: LOG_UI.error('Unique Job ID needs to be a 40 digit hex number') sys.exit(exit_codes.AVOCADO_FAIL) try: args.job_timeout = time_to_seconds(args.job_timeout) except ValueError as detail: LOG_UI.error(detail.args[0]) sys.exit(exit_codes.AVOCADO_FAIL) with job.Job(args) as job_instance: pre_post_dispatcher = JobPrePostDispatcher() try: # Run JobPre plugins output.log_plugin_failures(pre_post_dispatcher.load_failures) pre_post_dispatcher.map_method('pre', job_instance) job_run = job_instance.run() finally: # Run JobPost plugins pre_post_dispatcher.map_method('post', job_instance) result_dispatcher = ResultDispatcher() if result_dispatcher.extensions: result_dispatcher.map_method('render', job_instance.result, job_instance) return job_run
def run(self, config): """ Run test modules or simple tests. :param config: Configuration received from command line parser and possibly other sources. :type config: dict """ if 'output_check_record' in config: process.OUTPUT_CHECK_RECORD_MODE = config.get( 'output_check_record', None) warnings.warn( "The following arguments will be changed to boolean soon: " "sysinfo, output-check, failfast, keep-tmp, " "ignore-missing-references, sysinfo and output-check", FutureWarning) if config.get('unique_job_id') is not None: try: int(config.get('unique_job_id'), 16) if len(config.get('unique_job_id')) != 40: raise ValueError except ValueError: LOG_UI.error('Unique Job ID needs to be a 40 digit hex number') sys.exit(exit_codes.AVOCADO_FAIL) try: config['job_timeout'] = time_to_seconds(config.get('job_timeout')) except ValueError as detail: LOG_UI.error(detail.args[0]) sys.exit(exit_codes.AVOCADO_FAIL) with job.Job(config) as job_instance: pre_post_dispatcher = JobPrePostDispatcher() try: # Run JobPre plugins output.log_plugin_failures(pre_post_dispatcher.load_failures) pre_post_dispatcher.map_method('pre', job_instance) job_run = job_instance.run() finally: # Run JobPost plugins pre_post_dispatcher.map_method('post', job_instance) result_dispatcher = ResultDispatcher() if result_dispatcher.extensions: result_dispatcher.map_method('render', job_instance.result, job_instance) return job_run
def run(self, config): """ Run test modules or simple tests. :param config: Configuration received from command line parser and possibly other sources. :type config: dict """ if 'run.output_check_record' in config: check_record = config.get('run.output_check_record') process.OUTPUT_CHECK_RECORD_MODE = check_record unique_job_id = config.get('run.unique_job_id') if unique_job_id is not None: try: int(unique_job_id, 16) if len(unique_job_id) != 40: raise ValueError except ValueError: LOG_UI.error('Unique Job ID needs to be a 40 digit hex number') sys.exit(exit_codes.AVOCADO_FAIL) try: suite = TestSuite.from_config(config, name='') if suite.size == 0: sys.exit(exit_codes.AVOCADO_JOB_FAIL) except TestSuiteError as err: LOG_UI.error(err) sys.exit(exit_codes.AVOCADO_JOB_FAIL) with job.Job(config, [suite]) as job_instance: pre_post_dispatcher = JobPrePostDispatcher() try: # Run JobPre plugins output.log_plugin_failures(pre_post_dispatcher.load_failures) pre_post_dispatcher.map_method('pre', job_instance) job_run = job_instance.run() finally: # Run JobPost plugins pre_post_dispatcher.map_method('post', job_instance) return job_run
def run(self, config): namespace = 'job.replay.source_job_id' source_job_id = config.get(namespace) source_job_config = self._retrieve_source_job_config(source_job_id) if hasattr(source_job_config, namespace): del (source_job_config[namespace]) # Flag that this is indeed a replayed job, which is impossible to # tell solely based on the job.replay.source_job_id given that it # has a default value of 'latest' for convenience reasons source_job_config['job.replay.enabled'] = True with job.Job.from_config(source_job_config) as job_instance: pre_post_dispatcher = JobPrePostDispatcher() try: output.log_plugin_failures(pre_post_dispatcher.load_failures) pre_post_dispatcher.map_method('pre', job_instance) job_run = job_instance.run() finally: pre_post_dispatcher.map_method('post', job_instance) return job_run
def run(self, config): """ Run test modules or simple tests. :param config: Configuration received from command line parser and possibly other sources. :type config: dict """ if 'run.output_check_record' in config: check_record = config.get('run.output_check_record') process.OUTPUT_CHECK_RECORD_MODE = check_record warnings.warn( "The following arguments will be changed to boolean soon: " "sysinfo, output-check, failfast and keep-tmp. ", FutureWarning) unique_job_id = config.get('run.unique_job_id') if unique_job_id is not None: try: int(unique_job_id, 16) if len(unique_job_id) != 40: raise ValueError except ValueError: LOG_UI.error('Unique Job ID needs to be a 40 digit hex number') sys.exit(exit_codes.AVOCADO_FAIL) with job.Job(config) as job_instance: pre_post_dispatcher = JobPrePostDispatcher() try: # Run JobPre plugins output.log_plugin_failures(pre_post_dispatcher.load_failures) pre_post_dispatcher.map_method('pre', job_instance) job_run = job_instance.run() finally: # Run JobPost plugins pre_post_dispatcher.map_method('post', job_instance) return job_run