提交 c773cbce 编写于 作者: L Lukáš Doktor

avocado.plugins.multiplex: Make --multiplex optional

The `--multiplex` is about to be changed into a separate plugin. It does
not sound fair to keep it as default positional argument of the
`multiplex` command. Let's sync the naming scheme and require
`--multiplex` for it.

This also means the `-m` is optional so one can run `avocado multiplex`
without arguments to get default multiplex values.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 9d6bb585
......@@ -35,12 +35,10 @@ class Multiplex(CLICmd):
super(Multiplex, self).__init__(*args, **kwargs)
def configure(self, parser):
if multiplexer.MULTIPLEX_CAPABLE is False:
return
parser = super(Multiplex, self).configure(parser)
parser.add_argument('multiplex', nargs='+',
help='Path(s) to a multiplex file(s)')
if multiplexer.MULTIPLEX_CAPABLE:
parser.add_argument("-m", '--multiplex', nargs='*',
help='Path(s) to a multiplex file(s)')
parser.add_argument('--filter-only', nargs='*', default=[],
help='Filter only path(s) from multiplexing')
......
......@@ -59,7 +59,7 @@ is disabled, so the value of node name is always as written in the yaml
file (unlike values, where `yes` converts to `True` and such).
Nodes are organized in parent-child relationship and together they create
a tree. To view this structure use ``avocado multiplex --tree <file>``::
a tree. To view this structure use ``avocado multiplex --tree -m <file>``::
┗━━ run
┣━━ hw
......@@ -422,7 +422,7 @@ Let's take a second look at the first example::
After filters are applied (simply removes non-matching variants), leaves
are gathered and all variants are generated::
$ avocado multiplex examples/mux-environment.yaml
$ avocado multiplex -m examples/mux-environment.yaml
Variants generated:
Variant 1: /hw/cpu/intel, /hw/disk/scsi, /distro/fedora, /env/debug
Variant 2: /hw/cpu/intel, /hw/disk/scsi, /distro/fedora, /env/prod
......
......@@ -174,9 +174,9 @@ it's injected directly into the specified path and it's up to the test/framework
developer to get the value from this location (using path or adding the path to
``mux-path``). To understand the difference execute those commands::
$ avocado multiplex -t examples/tests/sleeptest.py.data/sleeptest.yaml
$ avocado multiplex -t duration:examples/tests/sleeptest.py.data/sleeptest.yaml
$ avocado multiplex -t /my/location:examples/tests/sleeptest.py.data/sleeptest.yaml
$ avocado multiplex -t -m examples/tests/sleeptest.py.data/sleeptest.yaml
$ avocado multiplex -t -m duration:examples/tests/sleeptest.py.data/sleeptest.yaml
$ avocado multiplex -t -m /my/location:examples/tests/sleeptest.py.data/sleeptest.yaml
Note that, as your multiplex file specifies all parameters for sleeptest, you
can't leave the test ID empty::
......
......@@ -43,18 +43,18 @@ class MultiplexTests(unittest.TestCase):
return result
def test_mplex_plugin(self):
cmd_line = './scripts/avocado multiplex examples/tests/sleeptest.py.data/sleeptest.yaml'
cmd_line = './scripts/avocado multiplex -m examples/tests/sleeptest.py.data/sleeptest.yaml'
expected_rc = exit_codes.AVOCADO_ALL_OK
self.run_and_check(cmd_line, expected_rc)
def test_mplex_plugin_nonexistent(self):
cmd_line = './scripts/avocado multiplex nonexist'
cmd_line = './scripts/avocado multiplex -m nonexist'
expected_rc = exit_codes.AVOCADO_JOB_FAIL
result = self.run_and_check(cmd_line, expected_rc)
self.assertIn('No such file or directory', result.stderr)
def test_mplex_debug(self):
cmd_line = ('./scripts/avocado multiplex -c -d '
cmd_line = ('./scripts/avocado multiplex -c -d -m '
'/:examples/mux-selftest.yaml '
'/:examples/mux-environment.yaml '
'/:examples/mux-selftest.yaml '
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册