[Avocado-devel] Passing test parameters on the command-line?

Lukáš Doktor ldoktor at redhat.com
Thu Nov 15 12:27:52 UTC 2018


Dne 14. 11. 18 v 22:58 Eduardo Habkost napsal(a):
> On Thu, Aug 23, 2018 at 11:26:55AM -0300, Eduardo Habkost wrote:
>> On Thu, Aug 23, 2018 at 11:08:54AM +0200, Amador Pahim wrote:
>>> On Thu, Aug 23, 2018 at 5:44 AM Eduardo Habkost <ehabkost at redhat.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am reading the docs about test parameters[1][2][3], and I
>>>> learned how to access them inside the test code.  But I couldn't
>>>> find one piece of information: what's the simplest way to _pass_
>>>> parameters to tests?
>>>
>>> avocado run --mux-inject 'foo:bar' -- test.py
>>>
>>> ("--mux-inject   Inject [path:]key:node values into the final multiplex tree.")
>>
>> Thanks!  This looks like what I'm looking for.
> 
> This doesn't seem to work at all:
> 
> [qemu/work/virtio-transport-cleanup>]$ avocado run --mux-inject qemu_bin:s390x-softmmu/qemu-system-s390x -- tests/acceptance/vnc.py
> JOB ID     : 7a0be3dfef1e56d5d26b7950263080409ddaefea
> JOB LOG    : /home/ehabkost/avocado/job-results/job-2018-11-14T19.55-7a0be3d/job.log
>  (1/4) tests/acceptance/vnc.py:Vnc.test_no_vnc;-3b6e: PASS (0.11 s)
>  (2/4) tests/acceptance/vnc.py:Vnc.test_no_vnc_change_password;-3b6e: PASS (0.10 s)
>  (3/4) tests/acceptance/vnc.py:Vnc.test_vnc_change_password_requires_a_password;-3b6e: PASS (0.10 s)
>  (4/4) tests/acceptance/vnc.py:Vnc.test_vnc_change_password;-3b6e: PASS (0.11 s)
> RESULTS    : PASS 4 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> JOB TIME   : 0.79 s
> [qemu/work/virtio-transport-cleanup>]$ grep qemu_bin ~/avocado/job-results/latest/job.log
> 2018-11-14 19:55:27,591 job              L0351 INFO | Command line: /home/ehabkost/rh/proj/virt/qemu/tests/venv/bin/avocado run --mux-inject qemu_bin:s390x-softmmu/qemu-system-s390x -- tests/acceptance/vnc.py
> 2018-11-14 19:55:27,700 parameters       L0146 DEBUG| PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64) => 'x86_64-softmmu/qemu-system-x86_64'
> 2018-11-14 19:55:27,863 parameters       L0146 DEBUG| PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64) => 'x86_64-softmmu/qemu-system-x86_64'
> 2018-11-14 19:55:28,036 parameters       L0146 DEBUG| PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64) => 'x86_64-softmmu/qemu-system-x86_64'
> 2018-11-14 19:55:28,222 parameters       L0146 DEBUG| PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64) => 'x86_64-softmmu/qemu-system-x86_64'
> [qemu/work/virtio-transport-cleanup>]$ avocado --version
> Avocado 65.0
> [qemu/work/virtio-transport-cleanup>]$
> 
> Does anybody know why?
> 

Hello Eduardo,

the `--mux-inject` injects directly to root of params. To get that value you have to specify `path=/` or `path=/*`. When you want to receive from `path=*` (default) the parameter has to be in `PATH`, where the default mux-path is `/run`. Please try:

    avocado run --mux-inject /run:qemu_bin:s390x-softmmu/qemu-system-s390x -- tests/acceptance/vnc.py

More details available here:

    https://avocado-framework.readthedocs.io/en/latest/optional_plugins/varianter_yaml_to_mux.html#resolution-order

Although I noticed the https://avocado-framework.readthedocs.io/en/latest/optional_plugins/varianter_yaml_to_mux.html#injecting-files section is misleading. I'm sorry for inconvenience, creating card to fix it.

Regards,
Lukáš

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/avocado-devel/attachments/20181115/e9ecf58b/attachment.sig>


More information about the Avocado-devel mailing list