提交 699f04df 编写于 作者: R Rudá Moura 提交者: Ruda Moura

multiplexer: Reintroduce command line options for filters.

Reintroduce command line options --filter-only and --filter-out
to control the global filters for multiplexing, both by the test runner
and the multiplex plugin.

Group multiplex command line options together in the group
"multiplex" inside the test runner.

Examples:

avocado run --help
... other options ...
multiplex arguments:
  -m MULTIPLEX_FILE, --multiplex-file MULTIPLEX_FILE
                        Path to an avocado multiplex (.yaml) file
  --filter-only [FILTER_ONLY [FILTER_ONLY ...]]
                        Filter only path(s) from multiplexing
  --filter-out [FILTER_OUT [FILTER_OUT ...]]
                        Filter out path(s) from multiplexing

avocado run footest --multiplex foo.yaml \
	--filter-only /root/env /root/os/linux \
        --filter-out /root/hw/virtio

avocado multiplex mux.yaml \
	--filter-only /root/os/win /root/hw/cpu/intel \
        --filter-out /root/hw/disk/virtio
Variants generated:
Variant 1:    /root/hw/cpu/intel, /root/hw/disk/scsi, /root/os/win/winxp, /root/env/debug
Variant 2:    /root/hw/cpu/intel, /root/hw/disk/scsi, /root/os/win/winxp, /root/env/prod
Variant 3:    /root/hw/cpu/intel, /root/hw/disk/scsi, /root/os/win/win7, /root/env/debug
Variant 4:    /root/hw/cpu/intel, /root/hw/disk/scsi, /root/os/win/win7, /root/env/prod
Variant 5:    /root/hw/cpu/intel, /root/hw/disk/scsi, /root/os/win/win8, /root/env/debug
Variant 6:    /root/hw/cpu/intel, /root/hw/disk/scsi, /root/os/win/win8, /root/env/prod
Signed-off-by: NRuda Moura <rmoura@redhat.com>
上级 02db6577
......@@ -430,7 +430,9 @@ class Job(object):
if urls is not None:
for url in urls:
try:
variants = multiplexer.create_variants_from_yaml(open(multiplex_file))
variants = multiplexer.create_variants_from_yaml(open(multiplex_file),
self.args.filter_only,
self.args.filter_out)
except SyntaxError:
variants = None
if variants:
......
......@@ -36,17 +36,20 @@ class Multiplexer(plugin.Plugin):
self.parser = parser.subcommands.add_parser(
'multiplex',
help='Generate a list of dictionaries with params from a multiplex file')
self.parser.add_argument('multiplex_file', type=str,
help='Path to a multiplex file',
nargs='?', default=None)
self.parser.add_argument('multiplex_file', type=str, nargs='?', default=None,
help='Path to a multiplex file')
self.parser.add_argument('-t', '--tree', action='store_true',
help='Shows the multiplex tree structure',
default=False)
self.parser.add_argument('--filter-only', nargs='*', default=[],
help='Filter only path(s) from multiplexing')
self.parser.add_argument('-c', '--contents', action='store_true',
help='Keep temporary files generated by tests',
default=False)
self.parser.add_argument('--filter-out', nargs='*', default=[],
help='Filter out path(s) from multiplexing')
self.parser.add_argument('-t', '--tree', action='store_true', default=False,
help='Shows the multiplex tree structure')
self.parser.add_argument('-c', '--contents', action='store_true', default=False,
help='Keep temporary files generated by tests')
super(Multiplexer, self).configure(self.parser)
def run(self, args):
......@@ -71,7 +74,9 @@ class Multiplexer(plugin.Plugin):
pipe.write(t.get_ascii())
sys.exit(error_codes.numeric_status['AVOCADO_ALL_OK'])
variants = multiplexer.create_variants_from_yaml(open(multiplex_file))
variants = multiplexer.create_variants_from_yaml(open(multiplex_file),
args.filter_only,
args.filter_out)
pipe.write(bcolors.header_str('Variants generated:'))
pipe.write('\n')
......
......@@ -103,9 +103,6 @@ class TestRunner(plugin.Plugin):
self.parser.add_argument('-z', '--archive', action='store_true', default=False,
help='Archive (ZIP) files generated by tests')
self.parser.add_argument('-m', '--multiplex-file', type=str, default=None,
help='Path to an avocado multiplex (.yaml) file')
self.parser.add_argument('--keep-tmp-files', action='store_true', default=False,
help='Keep temporary files generated by tests')
......@@ -118,6 +115,15 @@ class TestRunner(plugin.Plugin):
self.parser.add_argument('-s', '--silent', action='store_true', default=False,
help='Silent output, do not display results.')
mux = self.parser.add_argument_group('multiplex arguments')
mux.add_argument('-m', '--multiplex-file', type=str, default=None,
help='Path to an avocado multiplex (.yaml) file')
mux.add_argument('--filter-only', nargs='*', default=[],
help='Filter only path(s) from multiplexing')
mux.add_argument('--filter-out', nargs='*', default=[],
help='Filter out path(s) from multiplexing')
super(TestRunner, self).configure(self.parser)
# Export the test runner parser back to the main parser
parser.runner = self.parser
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册