Пример #1
0
def list(config, tag=""):
    """
    List a set of tests from the command line.

    :param config: command line arguments and run configuration
    :type config: {str, str}
    :param str tag: extra name identifier for the test to be run

    This is equivalent to but more powerful than the loader plugin.
    """
    loader = CartesianLoader(config, {"logdir": data_dir.get_base_dir()})
    prefix = tag + "l" if len(re.findall("run", config["vms_params"]["setup"])) > 1 else ""
    graph = loader.parse_object_trees(config["param_dict"], config["tests_str"], config["vm_strs"],
                                      prefix=prefix, verbose=True)
    graph.visualize(data_dir.get_base_dir())
Пример #2
0
    def run(self, args):
        log = logging.getLogger("avocado.app")
        log.info('Config files read (in order):')
        for cfg_path in settings.config_paths:
            log.debug('    %s' % cfg_path)
        if settings.config_paths_failed:
            log.error('\nConfig files that failed to read:')
            for cfg_path in settings.config_paths_failed:
                log.error('    %s' % cfg_path)
        log.debug("")
        if not args.datadir:
            blength = 0
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    clength = len('%s.%s' % (section, value[0]))
                    if clength > blength:
                        blength = clength

            format_str = "    %-" + str(blength) + "s %s"

            log.debug(format_str, 'Section.Key', 'Value')
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    config_key = ".".join((section, value[0]))
                    log.debug(format_str, config_key, value[1])
        else:
            log.debug("Avocado replaces config dirs that can't be accessed")
            log.debug("with sensible defaults. Please edit your local config")
            log.debug("file to customize values")
            log.debug('')
            log.info('Avocado Data Directories:')
            log.debug('    base     ' + data_dir.get_base_dir())
            log.debug('    tests    ' + data_dir.get_test_dir())
            log.debug('    data     ' + data_dir.get_data_dir())
            log.debug('    logs     ' + data_dir.get_logs_dir())
Пример #3
0
    def run(self, args):
        LOG_UI.info('Config files read (in order):')
        for cfg_path in settings.config_paths:
            LOG_UI.debug('    %s' % cfg_path)
        if settings.config_paths_failed:
            LOG_UI.error('\nConfig files that failed to read:')
            for cfg_path in settings.config_paths_failed:
                LOG_UI.error('    %s' % cfg_path)
        LOG_UI.debug("")
        if not args.datadir:
            blength = 0
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    clength = len('%s.%s' % (section, value[0]))
                    if clength > blength:
                        blength = clength

            format_str = "    %-" + str(blength) + "s %s"

            LOG_UI.debug(format_str, 'Section.Key', 'Value')
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    config_key = ".".join((section, value[0]))
                    LOG_UI.debug(format_str, config_key, value[1])
        else:
            LOG_UI.debug("Avocado replaces config dirs that can't be accessed")
            LOG_UI.debug("with sensible defaults. Please edit your local config")
            LOG_UI.debug("file to customize values")
            LOG_UI.debug('')
            LOG_UI.info('Avocado Data Directories:')
            LOG_UI.debug('    base     ' + data_dir.get_base_dir())
            LOG_UI.debug('    tests    ' + data_dir.get_test_dir())
            LOG_UI.debug('    data     ' + data_dir.get_data_dir())
            LOG_UI.debug('    logs     ' + data_dir.get_logs_dir())
            LOG_UI.debug('    cache    ' + ", ".join(data_dir.get_cache_dirs()))
Пример #4
0
    def handle_default():
        LOG_UI.info("Config files read (in order, '*' means the file exists "
                    "and had been read):")

        # Getting from settings because is already sorted
        config = settings.as_dict()
        for cfg_path in settings.all_config_paths:
            if cfg_path in settings.config_paths:
                LOG_UI.debug('    * %s', cfg_path)
            else:
                LOG_UI.debug('      %s', cfg_path)
        LOG_UI.debug("")
        if not config.get('config.datadir'):
            blength = 0
            for namespace, value in config.items():
                clength = len(namespace)
                if clength > blength:
                    blength = clength

            format_str = "    %-" + str(blength) + "s %s"

            LOG_UI.debug(format_str, 'Section.Key', 'Value')
            for namespace, value in config.items():
                LOG_UI.debug(format_str, namespace, value)
        else:
            LOG_UI.debug("Avocado replaces config dirs that can't be accessed")
            LOG_UI.debug("with sensible defaults. Please edit your local config")
            LOG_UI.debug("file to customize values")
            LOG_UI.debug('')
            LOG_UI.info('Avocado Data Directories:')
            LOG_UI.debug('    base     %s', data_dir.get_base_dir())
            LOG_UI.debug('    tests    %s', data_dir.get_test_dir())
            LOG_UI.debug('    data     %s', data_dir.get_data_dir())
            LOG_UI.debug('    logs     %s', data_dir.get_logs_dir())
            LOG_UI.debug('    cache    %s', ", ".join(data_dir.get_cache_dirs()))
Пример #5
0
    def run(self, config):
        LOG_UI.info("Config files read (in order, '*' means the file exists "
                    "and had been read):")
        for cfg_path in settings.all_config_paths:
            if cfg_path in settings.config_paths:
                LOG_UI.debug('    * %s', cfg_path)
            else:
                LOG_UI.debug('      %s', cfg_path)
        LOG_UI.debug("")
        if not config.get("datadir"):
            blength = 0
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    clength = len('%s.%s' % (section, value[0]))
                    if clength > blength:
                        blength = clength

            format_str = "    %-" + str(blength) + "s %s"

            LOG_UI.debug(format_str, 'Section.Key', 'Value')
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    config_key = ".".join((section, value[0]))
                    LOG_UI.debug(format_str, config_key, value[1])
        else:
            LOG_UI.debug("Avocado replaces config dirs that can't be accessed")
            LOG_UI.debug("with sensible defaults. Please edit your local config")
            LOG_UI.debug("file to customize values")
            LOG_UI.debug('')
            LOG_UI.info('Avocado Data Directories:')
            LOG_UI.debug('    base     %s', data_dir.get_base_dir())
            LOG_UI.debug('    tests    %s', data_dir.get_test_dir())
            LOG_UI.debug('    data     %s', data_dir.get_data_dir())
            LOG_UI.debug('    logs     %s', data_dir.get_logs_dir())
            LOG_UI.debug('    cache    %s', ", ".join(data_dir.get_cache_dirs()))
Пример #6
0
def list(args, run_params, tag=""):
    """
    List a set of tests from the command line.

    :param args: command line arguments
    :type args: :py:class:`argparse.Namespace`
    :param run_params: parameters with minimal vm configuration
    :type run_params: {str, str}
    :param str tag: extra name identifier for the test to be run

    This is equivalent to but more powerful than the loader plugin.
    """
    loader = CartesianLoader(args, {"logdir": data_dir.get_base_dir()})
    prefix = tag + "l" if len(re.findall("run", run_params["setup"])) > 1 else ""
    graph = loader.parse_object_trees(args.param_str, args.tests_str, args.vm_strs, prefix=prefix)
    graph.visualize(data_dir.get_base_dir())
Пример #7
0
    def run(self, args):
        LOG_UI.info("Config files read (in order, '*' means the file exists "
                    "and had been read):")
        for cfg_path in settings.all_config_paths:
            if cfg_path in settings.config_paths:
                LOG_UI.debug('    * %s', cfg_path)
            else:
                LOG_UI.debug('      %s', cfg_path)
        LOG_UI.debug("")
        if not args.datadir:
            blength = 0
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    clength = len('%s.%s' % (section, value[0]))
                    if clength > blength:
                        blength = clength

            format_str = "    %-" + str(blength) + "s %s"

            LOG_UI.debug(format_str, 'Section.Key', 'Value')
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    config_key = ".".join((section, value[0]))
                    LOG_UI.debug(format_str, config_key, value[1])
        else:
            LOG_UI.debug("Avocado replaces config dirs that can't be accessed")
            LOG_UI.debug("with sensible defaults. Please edit your local config")
            LOG_UI.debug("file to customize values")
            LOG_UI.debug('')
            LOG_UI.info('Avocado Data Directories:')
            LOG_UI.debug('    base     %s', data_dir.get_base_dir())
            LOG_UI.debug('    tests    %s', data_dir.get_test_dir())
            LOG_UI.debug('    data     %s', data_dir.get_data_dir())
            LOG_UI.debug('    logs     %s', data_dir.get_logs_dir())
            LOG_UI.debug('    cache    %s', ", ".join(data_dir.get_cache_dirs()))
Пример #8
0
 def run(self, args):
     view = output.View()
     view.notify(event="message", msg='Avocado Data Directories:')
     view.notify(event="message", msg='    base dir        ' + data_dir.get_base_dir())
     view.notify(event="message", msg='    tests dir       ' + data_dir.get_test_dir())
     view.notify(event="message", msg='    data dir        ' + data_dir.get_data_dir())
     view.notify(event="message", msg='    logs dir        ' + data_dir.get_logs_dir())
     view.notify(event="message", msg='    tmp dir         ' + data_dir.get_tmp_dir())
Пример #9
0
 def list_data_dirs(self, args):
     bcolors = output.colors
     pipe = output.get_paginator()
     pipe.write(bcolors.header_str('Avocado Data Directories:'))
     pipe.write('\n    base dir:        ' + data_dir.get_base_dir())
     pipe.write('\n    tests dir:       ' + data_dir.get_test_dir())
     pipe.write('\n    data dir:        ' + data_dir.get_data_dir())
     pipe.write('\n    logs dir:        ' + data_dir.get_logs_dir())
     pipe.write('\n    tmp dir:         ' + data_dir.get_tmp_dir())
Пример #10
0
    def run(self, args):
        view = output.View(use_paginator=(args.paginator == 'on'))
        try:
            view.notify(event="message", msg='Config files read (in order):')
            for cfg_path in settings.config_paths:
                view.notify(event="message", msg='    %s' % cfg_path)
            if settings.config_paths_failed:
                view.notify(event="minor", msg='')
                view.notify(event="error",
                            msg='Config files that failed to read:')
                for cfg_path in settings.config_paths_failed:
                    view.notify(event="error", msg='    %s' % cfg_path)
            view.notify(event="minor", msg='')
            if not args.datadir:
                blength = 0
                for section in settings.config.sections():
                    for value in settings.config.items(section):
                        clength = len('%s.%s' % (section, value[0]))
                        if clength > blength:
                            blength = clength

                format_str = "    %-" + str(blength) + "s %s"

                view.notify(event="minor",
                            msg=format_str % ('Section.Key', 'Value'))
                for section in settings.config.sections():
                    for value in settings.config.items(section):
                        config_key = ".".join((section, value[0]))
                        view.notify(event="minor",
                                    msg=format_str % (config_key, value[1]))
            else:
                view.notify(
                    event="minor",
                    msg="Avocado replaces config dirs that can't be accessed")
                view.notify(
                    event="minor",
                    msg="with sensible defaults. Please edit your local config"
                )
                view.notify(event="minor", msg="file to customize values")
                view.notify(event="message", msg='')
                view.notify(event="message", msg='Avocado Data Directories:')
                view.notify(event="minor",
                            msg='    base     ' + data_dir.get_base_dir())
                view.notify(event="minor",
                            msg='    tests    ' + data_dir.get_test_dir())
                view.notify(event="minor",
                            msg='    data     ' + data_dir.get_data_dir())
                view.notify(event="minor",
                            msg='    logs     ' + data_dir.get_logs_dir())
        finally:
            view.cleanup()
Пример #11
0
    def run(self, args):
        view = output.View(use_paginator=(args.paginator == 'on'))
        try:
            view.notify(event="message", msg='Config files read (in order):')
            for cfg_path in settings.config_paths:
                view.notify(event="message", msg='    %s' % cfg_path)
            if settings.config_paths_failed:
                view.notify(event="minor", msg='')
                view.notify(event="error", msg='Config files that failed to read:')
                for cfg_path in settings.config_paths_failed:
                    view.notify(event="error", msg='    %s' % cfg_path)
            view.notify(event="minor", msg='')
            if not args.datadir:
                blength = 0
                for section in settings.config.sections():
                    for value in settings.config.items(section):
                        clength = len('%s.%s' % (section, value[0]))
                        if clength > blength:
                            blength = clength

                format_str = "    %-" + str(blength) + "s %s"

                view.notify(event="minor", msg=format_str % ('Section.Key', 'Value'))
                for section in settings.config.sections():
                    for value in settings.config.items(section):
                        config_key = ".".join((section, value[0]))
                        view.notify(event="minor", msg=format_str % (config_key, value[1]))
            else:
                view.notify(event="minor", msg="Avocado replaces config dirs that can't be accessed")
                view.notify(event="minor", msg="with sensible defaults. Please edit your local config")
                view.notify(event="minor", msg="file to customize values")
                view.notify(event="message", msg='')
                view.notify(event="message", msg='Avocado Data Directories:')
                view.notify(event="minor", msg='    base     ' + data_dir.get_base_dir())
                view.notify(event="minor", msg='    tests    ' + data_dir.get_test_dir())
                view.notify(event="minor", msg='    data     ' + data_dir.get_data_dir())
                view.notify(event="minor", msg='    logs     ' + data_dir.get_logs_dir())
        finally:
            view.cleanup()