Dne 11.7.2018 v 21:22 Eduardo Habkost napsal(a):
> On Wed, Jul 11, 2018 at 06:48:49PM +0200, Lukáš Doktor wrote:
>> Dne 10.7.2018 v 21:05 Eduardo Habkost napsal(a):
>>> Hi,
>>>
>>> I'm trying to use --mux-yaml to run multiple variants of a test
>>> case.  I managed to write a multiplexer yaml file but it doesn't
>>> seem to work with "avocado run".  What I'm doing wrong here?
>>>
>>> [qemu/work/x86-cpuid-testcases>]$ avocado --version
>>> Avocado 62.0
>>> [qemu/work/x86-cpuid-testcases>]$ cat tests/acceptance/guest_abi.yaml
>>> machine: !mux
>>>   pc-i440fx-2.12:
>>>     machine: pc-i440fx-2.12
>>>   pc-q35-2.12:
>>>     machine: pc-q35-2.12
>>> cpu: !mux
>>>   qemu64:
>>>     cpu: qemu64
>>>   qemu32:
>>>     cpu: qemu32
>>> [qemu/work/x86-cpuid-testcases>]$ avocado list tests/acceptance/guest_abi.py
>>> INSTRUMENTED tests/acceptance/guest_abi.py:GuestABI.test_mtree
>>> [qemu/work/x86-cpuid-testcases>]$ avocado variants -m 
>>> tests/acceptance/guest_abi.yaml
>>> Multiplex variants (4):
>>> Variant qemu64-pc-i440fx-2.12-525f:    /run/machine/pc-i440fx-2.12, 
>>> /run/cpu/qemu64
>>> Variant qemu32-pc-i440fx-2.12-36dd:    /run/machine/pc-i440fx-2.12, 
>>> /run/cpu/qemu32
>>> Variant qemu64-pc-q35-2.12-0d82:    /run/machine/pc-q35-2.12, 
>>> /run/cpu/qemu64
>>> Variant qemu32-pc-q35-2.12-1dec:    /run/machine/pc-q35-2.12, 
>>> /run/cpu/qemu32
>>> [qemu/work/x86-cpuid-testcases>]$ avocado run --mux-yaml 
>>> tests/acceptance/guest_abi.yaml tests/acceptance/guest_abi.py
>>>
>>
>> This is because `--mux-yaml` accepts multiple arguments,
>> therefor it consumes the test as yet another argument, leaving
>> the job with no tests to be discovered. See
>> http://avocado-framework.readthedocs.io/en/latest/GetStartedGuide.html#running-tests
>> for details but basically you have two options, explicit (using
>> `--` to separate named arguments and positional arguments):
>>
>>     avocado run --mux-yaml tests/acceptance/guest_abi.yaml -- 
>> tests/acceptance/guest_abi.py
>>
>> or reorder (which is a bit hacky, but works)
>>
>>     avocado run tests/acceptance/guest_abi.py --mux-yaml 
>> tests/acceptance/guest_abi.yaml
> 
> Oops.  I guess it's too late to change the interface to make it
> less confusing?
> 

Well there are 2 ways, either "action='append'" or "nargs='+'". They behave 
similarly, but 'append' requires repetition of the arg:

    --mux-yaml foo --mux-yaml bar --mux-yaml baz

while 'nargs' assumes everything that is not argument belongs to it:

    --mux-yaml foo bar baz

I personally prefer the later even though sometimes it might be confusing (and 
for example when you want to specify  `-` in filename you have to use 
`--mux-yaml=-foo` (and I'm not aware of a way to specify multiple of items 
starting with `-`). Anyway currently we were discussing the possibility of 
unifying these (as both are used in Avocado). We planned to chose the 'nargs' 
but let's discuss this on our next planning meeting...

Regards,
Lukáš

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to