Beispiel #1
0
    def configure(self, parser):
        """
        Add the subparser for the list action.

        :param parser: Main test runner parser.
        """
        parser = super(List, self).configure(parser)
        parser.add_argument('reference',
                            type=str,
                            default=[],
                            nargs='*',
                            help="List of test references (aliases or paths). "
                            "If empty, avocado will list tests on "
                            "the configured test source, "
                            "(see 'avocado config --datadir') Also, "
                            "if there are other test loader plugins "
                            "active, tests from those plugins might "
                            "also show up (behavior may vary among "
                            "plugins)")
        parser.add_argument('-V',
                            '--verbose',
                            action='store_true',
                            default=False,
                            help='Whether to show extra information '
                            '(headers and summary). Current: %(default)s')
        parser.add_argument('--paginator',
                            choices=('on', 'off'),
                            default='on',
                            help='Turn the paginator on/off. '
                            'Current: %(default)s')
        loader.add_loader_options(parser)
        parser_common_args.add_tag_filter_args(parser)
Beispiel #2
0
    def configure(self, parser):
        """
        Add the subparser for the list action.

        :param parser: The Avocado command line application parser
        :type parser: :class:`avocado.core.parser.ArgumentParser`
        """
        parser = super().configure(parser)
        settings.add_argparser_to_option(namespace='resolver.references',
                                         nargs='*',
                                         metavar='TEST_REFERENCE',
                                         parser=parser,
                                         positional_arg=True,
                                         long_arg=None,
                                         allow_multiple=True)

        help_msg = ('Writes runnable recipe files to a directory.')
        settings.register_option(section='list.recipes',
                                 key='write_to_directory',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--write-recipes-to-directory')

        help_msg = 'Writes output to a json file.'
        settings.register_option(section='list',
                                 key='write_to_json_file',
                                 default=None,
                                 metavar='JSON_FILE',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--json')

        parser_common_args.add_tag_filter_args(parser)
Beispiel #3
0
    def configure(self, parser):
        parser = super(List, self).configure(parser)
        settings.register_option(section='nlist',
                                 key='references',
                                 default=[],
                                 nargs='*',
                                 key_type=list,
                                 help_msg='Test references',
                                 parser=parser,
                                 positional_arg=True)

        help_msg = ('Show extra information on resolution, besides '
                    'sucessful resolutions')
        settings.register_option(section='nlist',
                                 key='verbose',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--verbose',
                                 short_arg='-V')

        help_msg = 'Writes runnable recipe files to a directory'
        settings.register_option(section='nlist.recipes',
                                 key='write_to_directory',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--write-recipes-to-directory')

        parser_common_args.add_tag_filter_args(parser)
Beispiel #4
0
    def configure(self, parser):
        """
        Add the subparser for the list action.

        :param parser: The Avocado command line application parser
        :type parser: :class:`avocado.core.parser.ArgumentParser`
        """
        parser = super(List, self).configure(parser)
        help_msg = ('List of test references (aliases or paths). If empty, '
                    'Avocado will list tests on the configured test source, '
                    '(see "avocado config --datadir") Also, if there are '
                    'other test loader plugins active, tests from those '
                    'plugins might also show up (behavior may vary among '
                    'plugins)')
        settings.register_option(section='list',
                                 key='references',
                                 default=[],
                                 nargs='*',
                                 key_type=list,
                                 help_msg=help_msg,
                                 parser=parser,
                                 positional_arg=True)
        loader.add_loader_options(parser, 'list')

        help_msg = ('What is the method used to detect tests? If --resolver '
                    'used, Avocado will use the Next Runner Resolver method. '
                    'If not the legacy one will be used.')
        settings.register_option(section='list',
                                 key='resolver',
                                 key_type=bool,
                                 default=False,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--resolver')

        help_msg = ('Writes runnable recipe files to a directory. Valid only '
                    'when using --resolver.')
        settings.register_option(section='list.recipes',
                                 key='write_to_directory',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--write-recipes-to-directory')

        help_msg = 'Writes output to a json file.'
        settings.register_option(section='list',
                                 key='write_to_json_file',
                                 default=None,
                                 metavar='JSON_FILE',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--json')

        parser_common_args.add_tag_filter_args(parser)
Beispiel #5
0
 def configure(self, parser):
     parser = super(NRun, self).configure(parser)
     parser.add_argument("references", type=str, default=[], nargs='*',
                         metavar="TEST_REFERENCE",
                         help='List of test references (aliases or paths)')
     parser.add_argument("--disable-task-randomization",
                         action="store_true", default=False)
     parser.add_argument("--status-server", default="127.0.0.1:8888",
                         metavar="HOST:PORT",
                         help="Host and port for status server, default is: %(default)s")
     parser_common_args.add_tag_filter_args(parser)
Beispiel #6
0
    def configure(self, parser):
        parser = super(NRun, self).configure(parser)
        help_msg = 'List of test references (aliases or paths)'
        settings.register_option(section='nrun',
                                 key='references',
                                 default=[],
                                 key_type=list,
                                 help_msg=help_msg,
                                 nargs='*',
                                 parser=parser,
                                 metavar="TEST_REFERENCE",
                                 positional_arg=True)

        help_msg = 'Disable task shuffle'
        settings.register_option(section='nrun',
                                 key='disable_task_randomization',
                                 default=False,
                                 help_msg=help_msg,
                                 key_type=bool,
                                 parser=parser,
                                 long_arg='--disable-task-randomization')

        help_msg = ('Number of parallel tasks to run the tests. You can '
                    'disable parallel execution by passing 1.')
        settings.register_option(section='nrun',
                                 key='parallel_tasks',
                                 default=2 * multiprocessing.cpu_count() - 1,
                                 key_type=int,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--parallel-tasks')

        help_msg = 'Host and port for the status server'
        settings.register_option(section='nrun.status_server',
                                 key='listen',
                                 default='127.0.0.1:8888',
                                 metavar="HOST:PORT",
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--status-server')

        help_msg = ("Spawn tests in a specific spawner. Available spawners: "
                    "'process' and 'podman'")
        settings.register_option(section="nrun",
                                 key="spawner",
                                 default='process',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg="--spawner")

        parser_common_args.add_tag_filter_args(parser)
Beispiel #7
0
 def configure(self, parser):
     parser = super(List, self).configure(parser)
     parser.add_argument('references',
                         type=str,
                         default=[],
                         nargs='*',
                         help="Test references")
     parser.add_argument(
         '-V',
         '--verbose',
         action='store_true',
         default=False,
         help=("Show extra information on resolution, besides "
               "sucessful resolutions"))
     parser_common_args.add_tag_filter_args(parser)
Beispiel #8
0
    def configure(self, parser):
        """
        Add the subparser for the list action.

        :param parser: The Avocado command line application parser
        :type parser: :class:`avocado.core.parser.ArgumentParser`
        """
        parser = super().configure(parser)
        settings.add_argparser_to_option(
            namespace="resolver.references",
            nargs="*",
            metavar="TEST_REFERENCE",
            parser=parser,
            positional_arg=True,
            long_arg=None,
            allow_multiple=True,
        )

        help_msg = "Writes runnable recipe files to a directory."
        settings.register_option(
            section="list.recipes",
            key="write_to_directory",
            default=None,
            metavar="DIRECTORY",
            help_msg=help_msg,
            parser=parser,
            long_arg="--write-recipes-to-directory",
        )

        help_msg = "Writes output to a json file."
        settings.register_option(
            section="list",
            key="write_to_json_file",
            default=None,
            metavar="JSON_FILE",
            help_msg=help_msg,
            parser=parser,
            long_arg="--json",
        )

        parser_common_args.add_tag_filter_args(parser)
Beispiel #9
0
    def configure(self, parser):
        parser = super(List, self).configure(parser)
        parser.add_argument('references',
                            type=str,
                            default=[],
                            nargs='*',
                            help="Test references")
        parser.add_argument(
            '-V',
            '--verbose',
            action='store_true',
            default=False,
            help=("Show extra information on resolution, besides "
                  "sucessful resolutions"))
        parser.add_argument(
            '--write-recipes-to-directory',
            metavar='DIRECTORY',
            default=None,
            help=('Writes runnable recipe files to a directory'))

        parser_common_args.add_tag_filter_args(parser)
Beispiel #10
0
    def configure(self, parser):
        """
        Add the subparser for the list action.

        :param parser: The Avocado command line application parser
        :type parser: :class:`avocado.core.parser.ArgumentParser`
        """
        parser = super(List, self).configure(parser)
        help_msg = ('List of test references (aliases or paths). If empty, '
                    'Avocado will list tests on the configured test source, '
                    '(see "avocado config --datadir") Also, if there are '
                    'other test loader plugins active, tests from those '
                    'plugins might also show up (behavior may vary among '
                    'plugins)')
        settings.register_option(section='list',
                                 key='references',
                                 default=[],
                                 nargs='*',
                                 key_type=list,
                                 help_msg=help_msg,
                                 parser=parser,
                                 positional_arg=True)
        loader.add_loader_options(parser, 'list')
        parser_common_args.add_tag_filter_args(parser)
Beispiel #11
0
    def configure(self, parser):
        """
        Add the subparser for the list action.

        :param parser: The Avocado command line application parser
        :type parser: :class:`avocado.core.parser.ArgumentParser`
        """
        parser = super(List, self).configure(parser)
        settings.add_argparser_to_option(namespace='resolver.references',
                                         nargs='*',
                                         metavar='TEST_REFERENCE',
                                         parser=parser,
                                         positional_arg=True,
                                         long_arg=None,
                                         allow_multiple=True)
        loader.add_loader_options(parser, 'list')

        help_msg = ('Uses the Avocado resolver method (part of the nrunner '
                    'architecture) to detect tests. This is enabled by '
                    'default and exists only for compatibility purposes, '
                    'and will be removed soon. To use the legacy (loader) '
                    'method for finding tests, set the "--loader" option')
        settings.register_option(section='list',
                                 key='compatiblity_with_resolver_noop',
                                 key_type=bool,
                                 default=True,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--resolver')

        help_msg = ('Uses the Avocado legacy (loader) method for finding '
                    'tests. This option will exist only for a transitional '
                    'period until the legacy (loader) method is deprecated '
                    'and removed')
        settings.register_option(section='list',
                                 key='resolver',
                                 key_type=bool,
                                 default=True,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--loader')

        help_msg = ('Writes runnable recipe files to a directory. Valid only '
                    'when using --resolver.')
        settings.register_option(section='list.recipes',
                                 key='write_to_directory',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--write-recipes-to-directory')

        help_msg = 'Writes output to a json file.'
        settings.register_option(section='list',
                                 key='write_to_json_file',
                                 default=None,
                                 metavar='JSON_FILE',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--json')

        parser_common_args.add_tag_filter_args(parser)
Beispiel #12
0
    def configure(self, parser):
        """
        Add the subparser for the run action.

        :param parser: Main test runner parser.
        """
        parser = super().configure(parser)

        settings.add_argparser_to_option(namespace='resolver.references',
                                         nargs='*',
                                         metavar='TEST_REFERENCE',
                                         parser=parser,
                                         positional_arg=True,
                                         long_arg=None,
                                         allow_multiple=True)

        help_msg = ('Parameter name and value to pass to all tests. This is '
                    'only applicable when not using a varianter plugin. '
                    'This option format must be given in the NAME=VALUE '
                    'format, and may be given any number of times, or per '
                    'parameter.')
        settings.register_option(section='run',
                                 key='test_parameters',
                                 action='append',
                                 default=[],
                                 key_type=self._test_parameter,
                                 metavar="NAME_VALUE",
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--test-parameter',
                                 short_arg='-p')

        settings.add_argparser_to_option(namespace='run.test_runner',
                                         parser=parser,
                                         long_arg='--test-runner',
                                         metavar='TEST_RUNNER')

        help_msg = ('Instead of running the test only list them and log '
                    'their params.')
        settings.register_option(section='run.dry_run',
                                 key='enabled',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 short_arg='-d',
                                 long_arg='--dry-run')

        help_msg = ('Do not automatically clean up temporary directories '
                    'used by dry-run')
        settings.register_option(section='run.dry_run',
                                 key='no_cleanup',
                                 help_msg=help_msg,
                                 default=False,
                                 key_type=bool,
                                 parser=parser,
                                 long_arg='--dry-run-no-cleanup')

        help_msg = ('Forces the use of a particular job ID. Used internally '
                    'when interacting with an avocado server. You should not '
                    'use this option unless you know exactly what you\'re '
                    'doing')
        settings.register_option(section='run',
                                 key='unique_job_id',
                                 default=None,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--force-job-id',
                                 metavar='UNIQUE_JOB_ID')

        help_msg = 'Forces to use of an alternate job results directory.'
        settings.register_option(section='run',
                                 key='results_dir',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--job-results-dir')

        help_msg = ('Categorizes this within a directory with the same name, '
                    'by creating a link to the job result directory')
        settings.register_option(section='run',
                                 key='job_category',
                                 help_msg=help_msg,
                                 parser=parser,
                                 default=None,
                                 metavar='CATEGORY',
                                 long_arg='--job-category')

        settings.add_argparser_to_option(namespace='job.run.timeout',
                                         metavar='SECONDS',
                                         parser=parser,
                                         long_arg='--job-timeout')

        help_msg = 'Enable the job interruption on first failed test.'
        settings.register_option(section='run',
                                 key='failfast',
                                 default=False,
                                 key_type=bool,
                                 action='store_true',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--failfast')

        help_msg = 'Keep job temporary files (useful for avocado debugging).'
        settings.register_option(section='run',
                                 key='keep_tmp',
                                 default=False,
                                 key_type=bool,
                                 action='store_true',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--keep-tmp')

        help_msg = ('Force the job execution, even if some of the test '
                    'references are not resolved to tests.')
        settings.register_option(section='run',
                                 key='ignore_missing_references',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--ignore-missing-references')

        settings.add_argparser_to_option(namespace='sysinfo.collect.enabled',
                                         parser=parser,
                                         action='store_false',
                                         long_arg='--disable-sysinfo')

        settings.add_argparser_to_option('run.execution_order',
                                         parser=parser,
                                         long_arg='--execution-order')

        parser.output = parser.add_argument_group('output and result format')

        settings.add_argparser_to_option(
            'job.run.store_logging_stream',
            parser=parser.output,
            long_arg='--store-logging-stream',
            metavar='LOGGING_STREAM',
            argparse_type=lambda x: set(x.split(',')))

        help_msg = ('Logs the possible data directories for each test. This '
                    'is helpful when writing new tests and not being sure '
                    'where to put data files. Look for "Test data '
                    'directories" in your test log')
        settings.register_option(section='run',
                                 key='log_test_data_directories',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--log-test-data-directories')

        loader.add_loader_options(parser, 'run')
        parser_common_args.add_tag_filter_args(parser)
Beispiel #13
0
    def configure(self, parser):
        """
        Add the subparser for the list action.

        :param parser: The Avocado command line application parser
        :type parser: :class:`avocado.core.parser.ArgumentParser`
        """
        parser = super(List, self).configure(parser)
        help_msg = ('List of test references (aliases or paths). If empty, '
                    'Avocado will list tests on the configured test source, '
                    '(see "avocado config --datadir") Also, if there are '
                    'other test loader plugins active, tests from those '
                    'plugins might also show up (behavior may vary among '
                    'plugins)')
        settings.register_option(section='list',
                                 key='references',
                                 default=[],
                                 nargs='*',
                                 key_type=list,
                                 help_msg=help_msg,
                                 parser=parser,
                                 positional_arg=True)
        loader.add_loader_options(parser, 'list')

        help_msg = ('Uses the Avocado resolver method (part of the nrunner '
                    'architecture) to detect tests. This is enabled by '
                    'default and exists only for compatibility purposes, '
                    'and will be removed soon. To use the legacy (loader) '
                    'method for finding tests, set the "--loader" option')
        settings.register_option(section='list',
                                 key='compatiblity_with_resolver_noop',
                                 key_type=bool,
                                 default=True,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--resolver')

        help_msg = ('Uses the Avocado legacy (loader) method for finding '
                    'tests. This option will exist only for a transitional '
                    'period until the legacy (loader) method is deprecated '
                    'and removed')
        settings.register_option(section='list',
                                 key='resolver',
                                 key_type=bool,
                                 default=True,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--loader')

        help_msg = ('Writes runnable recipe files to a directory. Valid only '
                    'when using --resolver.')
        settings.register_option(section='list.recipes',
                                 key='write_to_directory',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--write-recipes-to-directory')

        help_msg = 'Writes output to a json file.'
        settings.register_option(section='list',
                                 key='write_to_json_file',
                                 default=None,
                                 metavar='JSON_FILE',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--json')

        parser_common_args.add_tag_filter_args(parser)
Beispiel #14
0
    def configure(self, parser):
        """
        Add the subparser for the run action.

        :param parser: Main test runner parser.
        """
        parser = super(Run, self).configure(parser)

        help_msg = 'List of test references (aliases or paths)'
        settings.register_option(section='run',
                                 key='references',
                                 key_type=list,
                                 default=[],
                                 nargs='*',
                                 metavar='TEST_REFERENCE',
                                 parser=parser,
                                 help_msg=help_msg,
                                 positional_arg=True)

        help_msg = ('Parameter name and value to pass to all tests. This is '
                    'only applicable when not using a varianter plugin. '
                    'This option format must be given in the NAME=VALUE '
                    'format, and may be given any number of times, or per '
                    'parameter.')
        settings.register_option(section='run',
                                 key='test_parameters',
                                 action='append',
                                 default=[],
                                 key_type=self._test_parameter,
                                 metavar="NAME_VALUE",
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--test-parameter',
                                 short_arg='-p')

        help_msg = ('Instead of running the test only list them and log '
                    'their params.')
        settings.register_option(section='run.dry_run',
                                 key='enabled',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 short_arg='-d',
                                 long_arg='--dry-run')

        help_msg = ('Do not automatically clean up temporary directories '
                    'used by dry-run')
        settings.register_option(section='run.dry_run',
                                 key='no_cleanup',
                                 help_msg=help_msg,
                                 default=False,
                                 key_type=bool,
                                 parser=parser,
                                 long_arg='--dry-run-no-cleanup')

        help_msg = ('Forces the use of a particular job ID. Used internally '
                    'when interacting with an avocado server. You should not '
                    'use this option unless you know exactly what you\'re '
                    'doing')
        settings.register_option(section='run',
                                 key='unique_job_id',
                                 default=None,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--force-job-id')

        help_msg = 'Forces to use of an alternate job results directory.'
        settings.register_option(section='run',
                                 key='results_dir',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--job-results-dir')

        help_msg = ('Categorizes this within a directory with the same name, '
                    'by creating a link to the job result directory')
        settings.register_option(section='run',
                                 key='job_category',
                                 help_msg=help_msg,
                                 parser=parser,
                                 default=None,
                                 metavar='CATEGORY',
                                 long_arg='--job-category')

        help_msg = ('Set the maximum amount of time (in SECONDS) that tests '
                    'are allowed to execute. Values <= zero means "no '
                    'timeout". You can also use suffixes, like: s (seconds), '
                    'm (minutes), h (hours). ')
        settings.register_option(section='run',
                                 key='job_timeout',
                                 help_msg=help_msg,
                                 default='0',
                                 metavar='SECONDS',
                                 parser=parser,
                                 long_arg='--job-timeout')

        help_msg = ('Enable or disable the job interruption on first failed '
                    'test. "on" and "off" will be deprecated soon.')
        settings.register_option(section='run',
                                 key='failfast',
                                 choices=('on', 'off'),
                                 default='off',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--failfast')

        help_msg = ('Keep job temporary files (useful for avocado debugging). '
                    '"on" and "off" will be deprecated soon.')
        settings.register_option(section='run',
                                 key='keep_tmp',
                                 choices=('on', 'off'),
                                 default='off',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--keep-tmp')

        help_msg = ('Force the job execution, even if some of the test '
                    'references are not resolved to tests. "on" and '
                    '"off" will be deprecated soon.')
        settings.register_option(section='run',
                                 key='ignore_missing_references',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--ignore-missing-references')

        help_msg = ('Enable or disable sysinfo information. Like hardware '
                    'details, profiles, etc.')
        settings.register_option(section='sysinfo.collect',
                                 key='enabled',
                                 default='on',
                                 key_type=str,
                                 help_msg=help_msg,
                                 choices=('on', 'off'),
                                 parser=parser,
                                 short_arg='-S',
                                 long_arg='--sysinfo')

        help_msg = ('Defines the order of iterating through test suite '
                    'and test variants')
        settings.register_option(section='run',
                                 key='execution_order',
                                 choices=('tests-per-variant',
                                          'variants-per-test'),
                                 default=None,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--execution-order')

        parser.output = parser.add_argument_group('output and result format')

        help_msg = ('Store given logging STREAMs in '
                    '"$JOB_RESULTS_DIR/$STREAM.$LEVEL."')
        settings.register_option(section='run',
                                 key='store_logging_stream',
                                 nargs='*',
                                 help_msg=help_msg,
                                 default=[],
                                 metavar='STREAM[:LEVEL]',
                                 key_type=list,
                                 parser=parser,
                                 long_arg='--store-logging-stream')

        help_msg = ('Logs the possible data directories for each test. This '
                    'is helpful when writing new tests and not being sure '
                    'where to put data files. Look for "Test data '
                    'directories" in your test log')
        settings.register_option(section='run',
                                 key='log_test_data_directories',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--log-test-data-directories')

        out_check = parser.add_argument_group('output check arguments')

        help_msg = ('Record the output produced by each test (from stdout '
                    'and stderr) into both the current executing result '
                    'and into reference files. Reference files are used on '
                    'subsequent runs to determine if the test produced the '
                    'expected output or not, and the current executing result '
                    'is used to check against a previously recorded reference '
                    'file.  Valid values: "none" (to explicitly disable all '
                    'recording) "stdout" (to record standard output *only*), '
                    '"stderr" (to record standard error *only*), "both" (to '
                    'record standard output and error in separate files), '
                    '"combined" (for standard output and error in a single '
                    'file). "all" is also a valid but deprecated option that '
                    'is a synonym of "both".')
        settings.register_option(section='run',
                                 key='output_check_record',
                                 help_msg=help_msg,
                                 choices=('none', 'stdout', 'stderr', 'both',
                                          'combined', 'all'),
                                 parser=parser,
                                 default=None,
                                 long_arg='--output-check-record')

        help_msg = ('Enable or disable test output (stdout/stderr) check. If '
                    'this option is off, no output will be checked, even if '
                    'there are reference files present for the test. "on" '
                    'and "off" will be deprecated soon.')
        settings.register_option(section='run',
                                 key='output_check',
                                 default='on',
                                 choices=('on', 'off'),
                                 help_msg=help_msg,
                                 parser=out_check,
                                 long_arg='--output-check')

        loader.add_loader_options(parser)
        parser_common_args.add_tag_filter_args(parser)
Beispiel #15
0
    def configure(self, parser):
        """
        Add the subparser for the run action.

        :param parser: Main test runner parser.
        """
        parser = super(Run, self).configure(parser)

        settings.add_argparser_to_option(namespace='run.references',
                                         parser=parser,
                                         positional_arg=True,
                                         nargs='*',
                                         metavar='TEST_REFERENCE')

        help_msg = ('Parameter name and value to pass to all tests. This is '
                    'only applicable when not using a varianter plugin. '
                    'This option format must be given in the NAME=VALUE '
                    'format, and may be given any number of times, or per '
                    'parameter.')
        settings.register_option(section='run',
                                 key='test_parameters',
                                 action='append',
                                 default=[],
                                 key_type=self._test_parameter,
                                 metavar="NAME_VALUE",
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--test-parameter',
                                 short_arg='-p')

        help_msg = ('Selects the runner implementation from one of the '
                    'installed and active implementations.  You can run '
                    '"avocado plugins" and find the list of valid runners '
                    'under the "Plugins that run test suites on a job '
                    '(runners) section.  Defaults to "runner", which is '
                    'the conventional and traditional runner.')
        settings.register_option(section='run',
                                 key='test_runner',
                                 default='runner',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--test-runner',
                                 metavar='TEST_RUNNER')

        help_msg = ('Instead of running the test only list them and log '
                    'their params.')
        settings.register_option(section='run.dry_run',
                                 key='enabled',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 short_arg='-d',
                                 long_arg='--dry-run')

        help_msg = ('Do not automatically clean up temporary directories '
                    'used by dry-run')
        settings.register_option(section='run.dry_run',
                                 key='no_cleanup',
                                 help_msg=help_msg,
                                 default=False,
                                 key_type=bool,
                                 parser=parser,
                                 long_arg='--dry-run-no-cleanup')

        help_msg = ('Forces the use of a particular job ID. Used internally '
                    'when interacting with an avocado server. You should not '
                    'use this option unless you know exactly what you\'re '
                    'doing')
        settings.register_option(section='run',
                                 key='unique_job_id',
                                 default=None,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--force-job-id',
                                 metavar='UNIQUE_JOB_ID')

        help_msg = 'Forces to use of an alternate job results directory.'
        settings.register_option(section='run',
                                 key='results_dir',
                                 default=None,
                                 metavar='DIRECTORY',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--job-results-dir')

        help_msg = ('Categorizes this within a directory with the same name, '
                    'by creating a link to the job result directory')
        settings.register_option(section='run',
                                 key='job_category',
                                 help_msg=help_msg,
                                 parser=parser,
                                 default=None,
                                 metavar='CATEGORY',
                                 long_arg='--job-category')

        settings.add_argparser_to_option(namespace='job.run.timeout',
                                         metavar='SECONDS',
                                         parser=parser,
                                         long_arg='--job-timeout')

        help_msg = 'Enable the job interruption on first failed test.'
        settings.register_option(section='run',
                                 key='failfast',
                                 default=False,
                                 key_type=bool,
                                 action='store_true',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--failfast')

        help_msg = 'Keep job temporary files (useful for avocado debugging).'
        settings.register_option(section='run',
                                 key='keep_tmp',
                                 default=False,
                                 key_type=bool,
                                 action='store_true',
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--keep-tmp')

        help_msg = ('Force the job execution, even if some of the test '
                    'references are not resolved to tests. "on" and '
                    '"off" will be deprecated soon.')
        settings.register_option(section='run',
                                 key='ignore_missing_references',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--ignore-missing-references')

        settings.add_argparser_to_option(namespace='sysinfo.collect.enabled',
                                         parser=parser,
                                         action='store_false',
                                         long_arg='--disable-sysinfo')

        settings.add_argparser_to_option('run.execution_order',
                                         parser=parser,
                                         long_arg='--execution-order')

        parser.output = parser.add_argument_group('output and result format')

        settings.add_argparser_to_option('job.run.store_logging_stream',
                                         parser=parser.output,
                                         long_arg='--store-logging-stream',
                                         metavar='LOGGING_STREAM')

        help_msg = ('Logs the possible data directories for each test. This '
                    'is helpful when writing new tests and not being sure '
                    'where to put data files. Look for "Test data '
                    'directories" in your test log')
        settings.register_option(section='run',
                                 key='log_test_data_directories',
                                 default=False,
                                 key_type=bool,
                                 help_msg=help_msg,
                                 parser=parser,
                                 long_arg='--log-test-data-directories')

        out_check = parser.add_argument_group('output check arguments')

        help_msg = ('Record the output produced by each test (from stdout '
                    'and stderr) into both the current executing result '
                    'and into reference files. Reference files are used on '
                    'subsequent runs to determine if the test produced the '
                    'expected output or not, and the current executing result '
                    'is used to check against a previously recorded reference '
                    'file.  Valid values: "none" (to explicitly disable all '
                    'recording) "stdout" (to record standard output *only*), '
                    '"stderr" (to record standard error *only*), "both" (to '
                    'record standard output and error in separate files), '
                    '"combined" (for standard output and error in a single '
                    'file). "all" is also a valid but deprecated option that '
                    'is a synonym of "both".')
        settings.register_option(section='run',
                                 key='output_check_record',
                                 help_msg=help_msg,
                                 choices=('none', 'stdout', 'stderr', 'both',
                                          'combined', 'all'),
                                 parser=out_check,
                                 default=None,
                                 long_arg='--output-check-record')

        help_msg = ('Disables test output (stdout/stderr) check. If this '
                    'option is given, no output will be checked, even if '
                    'there are reference files present for the test.')
        settings.register_option(section='run',
                                 key='output_check',
                                 default=True,
                                 key_type=bool,
                                 action='store_false',
                                 help_msg=help_msg,
                                 parser=out_check,
                                 long_arg='--disable-output-check')

        loader.add_loader_options(parser, 'run')
        parser_common_args.add_tag_filter_args(parser)
Beispiel #16
0
    def configure(self, parser):
        """
        Add the subparser for the run action.

        :param parser: Main test runner parser.
        """
        parser = super(Run, self).configure(parser)

        parser.add_argument("reference",
                            type=str,
                            default=[],
                            nargs='*',
                            metavar="TEST_REFERENCE",
                            help='List of test references (aliases or paths)')

        parser.add_argument("-p",
                            "--test-parameter",
                            action="append",
                            dest='test_parameters',
                            default=[],
                            metavar="NAME_VALUE",
                            type=self._test_parameter,
                            help="Parameter name and value to pass to all "
                            "tests. This is only applicable when not using a "
                            "varianter plugin. This option format must be "
                            "given in the NAME=VALUE format, and may be given "
                            "any number of times, or per parameter.")

        parser.add_argument("-d",
                            "--dry-run",
                            action="store_true",
                            help="Instead of running the test only "
                            "list them and log their params.")

        parser.add_argument("--dry-run-no-cleanup",
                            action="store_true",
                            help="Do not automatically clean up temporary "
                            "directories used by dry-run",
                            default=False)

        parser.add_argument('--force-job-id',
                            dest='unique_job_id',
                            type=str,
                            default=None,
                            help='Forces the use of a particular job ID. Used '
                            'internally when interacting with an avocado '
                            'server. You should not use this option '
                            'unless you know exactly what you\'re doing')

        parser.add_argument('--job-results-dir',
                            action='store',
                            dest='base_logdir',
                            default=None,
                            metavar='DIRECTORY',
                            help=('Forces to use of an alternate job '
                                  'results directory.'))

        parser.add_argument('--job-category',
                            action='store',
                            default=None,
                            metavar='CATEGORY',
                            help=('Categorizes this within a directory with '
                                  'the same name, by creating a link to the '
                                  'job result directory'))

        parser.add_argument('--job-timeout',
                            action='store',
                            default=None,
                            metavar='SECONDS',
                            help='Set the maximum amount of time (in SECONDS) '
                            'that tests are allowed to execute. '
                            'Values <= zero means "no timeout". '
                            'You can also use suffixes, like: '
                            ' s (seconds), m (minutes), h (hours). ')

        parser.add_argument('--failfast',
                            choices=('on', 'off'),
                            help='Enable or disable the job interruption on '
                            'first failed test.')

        parser.add_argument('--keep-tmp',
                            choices=('on', 'off'),
                            default='off',
                            help='Keep job temporary files '
                            '(useful for avocado debugging). Defaults to off.')

        parser.add_argument('--ignore-missing-references',
                            choices=('on', 'off'),
                            help="Force the job execution, even if some of "
                            "the test references are not resolved to tests.")

        sysinfo_default = settings.get_value('sysinfo.collect',
                                             'enabled',
                                             key_type='bool',
                                             default=True)
        sysinfo_default = 'on' if sysinfo_default is True else 'off'
        parser.add_argument('--sysinfo',
                            choices=('on', 'off'),
                            default=sysinfo_default,
                            help="Enable or disable "
                            "system information (hardware details, profilers, "
                            "etc.). Current:  %(default)s")

        parser.add_argument("--execution-order",
                            choices=("tests-per-variant", "variants-per-test"),
                            help="Defines the order of iterating through test "
                            "suite and test variants")

        parser.output = parser.add_argument_group('output and result format')

        parser.output.add_argument("--store-logging-stream",
                                   nargs="*",
                                   default=[],
                                   metavar="STREAM[:LEVEL]",
                                   help="Store given logging STREAMs in "
                                   "$JOB_RESULTS_DIR/$STREAM.$LEVEL.")

        parser.output.add_argument("--log-test-data-directories",
                                   action="store_true",
                                   help="Logs the possible data directories "
                                   "for each test. This is helpful when "
                                   "writing new tests and not being sure "
                                   "where to put data files. Look for \""
                                   "Test data directories\" in your test log")

        out_check = parser.add_argument_group('output check arguments')

        out_check.add_argument('--output-check-record',
                               choices=('none', 'stdout', 'stderr', 'both',
                                        'combined', 'all'),
                               help="Record the output produced by each test "
                               "(from stdout and stderr) into both the "
                               "current executing result and into  "
                               "reference files.  Reference files are "
                               "used on subsequent runs to determine if "
                               "the test produced the expected output or "
                               "not, and the current executing result is "
                               "used to check against a previously "
                               "recorded reference file.  Valid values: "
                               "'none' (to explicitly disable all "
                               "recording) 'stdout' (to record standard "
                               "output *only*), 'stderr' (to record "
                               "standard error *only*), 'both' (to record"
                               " standard output and error in separate "
                               "files), 'combined' (for standard output "
                               "and error in a single file). 'all' is "
                               "also a valid but deprecated option that "
                               "is a synonym of 'both'.  This option "
                               "does not have a default value, but the "
                               "Avocado test runner will record the "
                               "test under execution in the most suitable"
                               " way unless it's explicitly disabled with"
                               " value 'none'")

        out_check.add_argument('--output-check',
                               choices=('on', 'off'),
                               default='on',
                               help="Enable or disable test output (stdout/"
                               "stderr) check. If this option is off, no "
                               "output will be checked, even if there are "
                               "reference files present for the test. "
                               "Current: on (output check enabled)")

        loader.add_loader_options(parser)
        parser_common_args.add_tag_filter_args(parser)
Beispiel #17
0
    def configure(self, parser):
        """
        Add the subparser for the run action.

        :param parser: Main test runner parser.
        """
        parser = super().configure(parser)

        settings.add_argparser_to_option(
            namespace="resolver.references",
            nargs="*",
            metavar="TEST_REFERENCE",
            parser=parser,
            positional_arg=True,
            long_arg=None,
            allow_multiple=True,
        )

        help_msg = ("Parameter name and value to pass to all tests. This is "
                    "only applicable when not using a varianter plugin. "
                    "This option format must be given in the NAME=VALUE "
                    "format, and may be given any number of times, or per "
                    "parameter.")
        settings.register_option(
            section="run",
            key="test_parameters",
            action="append",
            default=[],
            key_type=self._test_parameter,
            metavar="NAME_VALUE",
            help_msg=help_msg,
            parser=parser,
            long_arg="--test-parameter",
            short_arg="-p",
        )

        settings.add_argparser_to_option(
            namespace="run.test_runner",
            parser=parser,
            long_arg="--test-runner",
            metavar="TEST_RUNNER",
        )

        help_msg = "Instead of running the test only list them and log their params."
        settings.register_option(
            section="run.dry_run",
            key="enabled",
            default=False,
            key_type=bool,
            help_msg=help_msg,
            parser=parser,
            short_arg="-d",
            long_arg="--dry-run",
        )

        help_msg = "Do not automatically clean up temporary directories used by dry-run"
        settings.register_option(
            section="run.dry_run",
            key="no_cleanup",
            help_msg=help_msg,
            default=False,
            key_type=bool,
            parser=parser,
            long_arg="--dry-run-no-cleanup",
        )

        help_msg = ("Forces the use of a particular job ID. Used internally "
                    "when interacting with an avocado server. You should not "
                    "use this option unless you know exactly what you're "
                    "doing")
        settings.register_option(
            section="run",
            key="unique_job_id",
            default=None,
            help_msg=help_msg,
            parser=parser,
            long_arg="--force-job-id",
            metavar="UNIQUE_JOB_ID",
        )

        help_msg = "Forces to use of an alternate job results directory."
        settings.register_option(
            section="run",
            key="results_dir",
            default=None,
            metavar="DIRECTORY",
            help_msg=help_msg,
            parser=parser,
            long_arg="--job-results-dir",
        )

        help_msg = ("Categorizes this within a directory with the same name, "
                    "by creating a link to the job result directory")
        settings.register_option(
            section="run",
            key="job_category",
            help_msg=help_msg,
            parser=parser,
            default=None,
            metavar="CATEGORY",
            long_arg="--job-category",
        )

        settings.add_argparser_to_option(
            namespace="job.run.timeout",
            metavar="SECONDS",
            parser=parser,
            long_arg="--job-timeout",
        )

        help_msg = "Enable the job interruption on first failed test."
        settings.register_option(
            section="run",
            key="failfast",
            default=False,
            key_type=bool,
            action="store_true",
            help_msg=help_msg,
            parser=parser,
            long_arg="--failfast",
        )

        help_msg = "Keep job temporary files (useful for avocado debugging)."
        settings.register_option(
            section="run",
            key="keep_tmp",
            default=False,
            key_type=bool,
            action="store_true",
            help_msg=help_msg,
            parser=parser,
            long_arg="--keep-tmp",
        )

        help_msg = ("Force the job execution, even if some of the test "
                    "references are not resolved to tests.")
        settings.register_option(
            section="run",
            key="ignore_missing_references",
            default=False,
            key_type=bool,
            help_msg=help_msg,
            parser=parser,
            long_arg="--ignore-missing-references",
        )

        help_msg = "Disable sysinfo collection (like hardware details, profiles, etc)."
        settings.add_argparser_to_option(
            namespace="sysinfo.collect.enabled",
            parser=parser,
            action="store_false",
            long_arg="--disable-sysinfo",
            help_msg=help_msg,
        )

        settings.add_argparser_to_option("run.execution_order",
                                         parser=parser,
                                         long_arg="--execution-order")

        parser.output = parser.add_argument_group("output and result format")

        settings.add_argparser_to_option(
            "job.run.store_logging_stream",
            parser=parser.output,
            long_arg="--store-logging-stream",
            metavar="LOGGING_STREAM",
            argparse_type=lambda x: set(x.split(",")),
        )

        help_msg = ("Logs the possible data directories for each test. This "
                    "is helpful when writing new tests and not being sure "
                    'where to put data files. Look for "Test data '
                    'directories" in your test log')
        settings.register_option(
            section="run",
            key="log_test_data_directories",
            default=False,
            key_type=bool,
            help_msg=help_msg,
            parser=parser,
            long_arg="--log-test-data-directories",
        )

        parser_common_args.add_tag_filter_args(parser)