Ejemplo n.º 1
0
    def run(self, args):
        """
        Run test modules or simple tests.

        :param args: Command line args received from the run subparser.
        """
        log = logging.getLogger("avocado.app")
        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.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 e:
            log.error(e.message)
            sys.exit(exit_codes.AVOCADO_FAIL)
        job_instance = job.Job(args)
        job_run = job_instance.run()
        result_dispatcher = ResultDispatcher()
        if result_dispatcher.extensions:
            result_dispatcher.map_method('render',
                                         job_instance.result,
                                         job_instance)
        return job_run
Ejemplo n.º 2
0
    def run(self, args):
        """
        Run test modules or simple tests.

        :param args: Command line args received from the run subparser.
        """
        log = logging.getLogger("avocado.app")
        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.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 e:
            log.error(e.message)
            sys.exit(exit_codes.AVOCADO_FAIL)
        job_instance = job.Job(args)
        job_run = job_instance.run()
        result_dispatcher = ResultDispatcher()
        if result_dispatcher.extensions:
            result_dispatcher.map_method('render', job_instance.result,
                                         job_instance)
        return job_run
Ejemplo n.º 3
0
    def run(self, args):
        """
        Run test modules or simple tests.

        :param args: Command line args received from the run subparser.
        """
        log = logging.getLogger("avocado.app")
        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.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 e:
            log.error(e.message)
            sys.exit(exit_codes.AVOCADO_FAIL)
        job_instance = job.Job(args)
        job_run = job_instance.run()
        result_dispatcher = ResultDispatcher()
        if result_dispatcher.extensions:
            # At this point job_instance doesn't have a single results
            # attribute which is the end goal.  For now, we pick any of the
            # plugin classes added to the result proxy.
            if len(job_instance.result_proxy.output_plugins) > 0:
                result = job_instance.result_proxy.output_plugins[0]
                result_dispatcher.map_method('render', result, job_instance)
        return job_run
Ejemplo n.º 4
0
    def run(self, args):
        """
        Run test modules or simple tests.

        :param args: Command line args received from the run subparser.
        """
        log = logging.getLogger("avocado.app")
        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.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 e:
            log.error(e.message)
            sys.exit(exit_codes.AVOCADO_FAIL)
        job_instance = job.Job(args)
        job_run = job_instance.run()
        result_dispatcher = ResultDispatcher()
        if result_dispatcher.extensions:
            # At this point job_instance doesn't have a single results
            # attribute which is the end goal.  For now, we pick any of the
            # plugin classes added to the result proxy.
            if len(job_instance.result_proxy.output_plugins) > 0:
                result = job_instance.result_proxy.output_plugins[0]
                result_dispatcher.map_method('render', result, job_instance)
        return job_run
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
0
    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