<div dir="ltr"><div>Lukas, thanks for explanation! But I still have a question.</div><div><br></div><div>Imagine we have an YAML config with a list of tests and their parameters:<br></div><div><br></div><div>```yaml</div><div>basic: !mux<br><br>    test_reference_resolver_class: avocado_vt.loader.VirtTestLoader<br>    timeout: 360<br>    test_reference_resolver_args: !!python/dict<br>        vt_extra_params:<br>            - nic_model=rtl8139 <br>            - extra_params=" -cpu host"<br>            - drive_format=ahci<br>            - mem=2048<br>        vt-machine-type: q35<br><br>    shutdown:<br>        test_reference: io-github-autotest-qemu.shutdown<br>            vt_extra_params:<br>                - shutdown_method = shell<br>    <br>    reboot:<br>        test_reference: io-github-autotest-qemu.reboot<br>            vt_extra_params:<br>                - param1=1<br>                - param2=2<br><br>    stress:<br>        test_reference: io-github-autotest-qemu.linux_stress<br><br>    iofuzz:<br>        test_reference: io-github-autotest-qemu.iofuzz<br>            vt_extra_params:<br>                - param1=1<br>                - param2=2<br><br></div><div>```</div><div><br></div><div>How to execute tests from this testplan?<br></div><div><br></div><div>$ avocado run -m basic.yaml <br>No test references provided nor any other arguments resolved into tests. Please double check the executed command.<br><br></div><div><br></div><div>Sergey<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">чт, 2 авг. 2018 г. в 17:08, Lukáš Doktor <<a href="mailto:ldoktor@redhat.com">ldoktor@redhat.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dne 1.8.2018 v 13:19 Sergey Bronnikov napsal(a):<br>
> Hello!<br>
> <br>
> I'm trying to find a way to organize my tests for running without<br>
> specifying all of them in command-line. Imagine we have a set of different<br>
> tests: sleep.py, passtest.py and fail.py. To run all of them with required<br>
> parameters (aka variants) we may execute a command:<br>
> avocado run sleep.py fail.py passtest.py -m basic.yaml<br>
> <br>
> Is there a way to run the same tests without explicit specifying them?<br>
> For example: avocado run -m basic.yaml<br>
> <br>
> Sergey<br>
> <br>
<br>
Dear Sergey,<br>
<br>
as a matter of fact, there are multiple ways.<br>
<br>
1. filter-by-tag: <a href="http://avocado-framework.readthedocs.io/en/latest/WritingTests.html#categorizing-tests" rel="noreferrer" target="_blank">http://avocado-framework.readthedocs.io/en/latest/WritingTests.html#categorizing-tests</a><br>
<br>
    you can tag your tests eg. `sanity`, `release`, ... and then run `avocado run --filter-by-tag=sanity -- TEST_REPO` to only run tests tagged `sanity` (note the granularity is per-class or even per-test-method.<br>
<br>
2. yaml loader optional plugin: <a href="http://avocado-framework.readthedocs.io/en/latest/optional_plugins/yaml_loader.html" rel="noreferrer" target="_blank">http://avocado-framework.readthedocs.io/en/latest/optional_plugins/yaml_loader.html</a><br>
<br>
    which is probably more what you're looking for, but currently only works on python2 (but should get py3 support, hopefully, soon). It works similarly to yaml_to_mux varianter plugin, but allows special keys like `test_reference` to specify what test will be used or even `test_reference_resolver_class` when your tests are not the default ones. This is for example useful when you want to include multiple external-runner tests with different external-runner. There are examples in: <a href="https://github.com/avocado-framework/avocado/tree/master/examples/yaml_to_mux_loader" rel="noreferrer" target="_blank">https://github.com/avocado-framework/avocado/tree/master/examples/yaml_to_mux_loader</a> but let me share my slighly advanced example here:<br>
<br>
```yaml<br>
# Generated s390x mux-suite<br>
!mux<br>
qemu_make: !mux<br>
    mux_suite_test_name_prefix: 'qemu_make/git '<br>
    check:<br>
        test_reference: /home/jenkins/s390x/qemu-master/avocado-qemu-make-check<br>
    install:<br>
        test_reference: /home/jenkins/s390x/qemu-master/avocado-qemu-make-install<br>
<br>
unit:<br>
    variants: !mux<br>
        test_reference_resolver_class: avocado.core.loader.ExternalLoader<br>
        timeout: 360<br>
        rpm-tcg:<br>
            mux_suite_test_name_prefix: 'unit/rpm/tcg '<br>
            test_reference_resolver_extra: !!python/dict<br>
                loader_options: /home/jenkins/s390x/kvm-unit-test/avocado-runner-rpm-tcg<br>
        rpm-kvm:<br>
            mux_suite_test_name_prefix: 'unit/rpm/kvm '<br>
            test_reference_resolver_extra: !!python/dict<br>
                loader_options: /home/jenkins/s390x/kvm-unit-test/avocado-runner-rpm-kvm<br>
        git-tcg:<br>
            mux_suite_test_name_prefix: 'unit/git/tcg '<br>
            test_reference_resolver_extra: !!python/dict<br>
                loader_options: /home/jenkins/s390x/kvm-unit-test/avocado-runner-git-tcg<br>
        git-kvm:<br>
            mux_suite_test_name_prefix: 'unit/git/kvm '<br>
            test_reference_resolver_extra: !!python/dict<br>
                loader_options: /home/jenkins/s390x/kvm-unit-test/avocado-runner-git-kvm<br>
    tests: !mux<br>
        cmm:<br>
            test_reference: cmm<br>
        diag10:<br>
            test_reference: diag10<br>
        emulator:<br>
            test_reference: emulator<br>
        gs:<br>
            test_reference: gs<br>
        iep:<br>
            test_reference: iep<br>
        intercept:<br>
            test_reference: intercept<br>
        pfmf:<br>
            test_reference: pfmf<br>
        selftest-setup:<br>
            test_reference: selftest-setup<br>
        sieve:<br>
            test_reference: sieve<br>
        skey:<br>
            test_reference: skey<br>
        sthyi:<br>
            test_reference: sthyi<br>
        vector:<br>
            test_reference: vector<br>
functional: !mux<br>
    test_reference_resolver_class: avocado_vt.loader.VirtTestLoader<br>
    s390x-rpm-libvirt/dvd:<br>
        mux_suite_test_name_prefix: 'functional/rpm/libvirt/dvd '<br>
        test_reference: unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads io-github-autotest-qemu.boot remove_guest.without_disk<br>
        test_reference_resolver_args: !!python/dict<br>
            vt_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_dst_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_type: libvirt<br>
            vt_extra_params:<br>
                - automem=no<br>
                - url=$URL<br>
                - vga=none<br>
    s390x-rpm-libvirt/url:<br>
        mux_suite_test_name_prefix: 'functional/rpm/libvirt/url '<br>
        test_reference: unattended_install.url.extra_cdrom_ks.default_install.aio_threads io-github-autotest-qemu.boot remove_guest.without_disk<br>
        test_reference_resolver_args: !!python/dict<br>
            vt_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_dst_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_type: libvirt<br>
            vt_extra_params:<br>
                - automem=no<br>
                - url=$URL<br>
                - vga=none<br>
    s390x-rpm-dvd:<br>
        mux_suite_test_name_prefix: 'functional/rpm/dvd '<br>
        test_reference: unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads boot migrate.with_reboot.tcp migrate.with_reboot.exec.gzip_exec migrate.default.tcp.with_post_copy<br>
        test_reference_resolver_args: !!python/dict<br>
            vt_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_dst_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_extra_params:<br>
                - automem=no<br>
                - url=$URL<br>
                - ping_pong=5<br>
                - vga=none<br>
    s390x-rpm-url:<br>
        mux_suite_test_name_prefix: 'functional/rpm/url '<br>
        test_reference: unattended_install.url.extra_cdrom_ks.default_install.aio_threads boot migrate.with_reboot.tcp migrate.with_reboot.exec.gzip_exec migrate.default.tcp.with_post_copy<br>
        test_reference_resolver_args: !!python/dict<br>
            vt_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_dst_qemu_bin: /usr/libexec/qemu-kvm<br>
            vt_extra_params:<br>
                - automem=no<br>
                - url=$URL<br>
                - ping_pong=5<br>
                - vga=none<br>
    s390x-git-dvd:<br>
        mux_suite_test_name_prefix: 'functional/git/dvd '<br>
        test_reference: unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads boot migrate.with_reboot.tcp migrate.with_reboot.exec.gzip_exec migrate.default.tcp.with_post_copy<br>
        test_reference_resolver_args: !!python/dict<br>
            vt_qemu_bin: /home/jenkins/s390x/qemu-master/build/bin/qemu-system-s390x<br>
            vt_dst_qemu_bin: /home/jenkins/s390x/qemu-master/build/bin/qemu-system-s390x<br>
            vt_extra_params:<br>
                - automem=no<br>
                - url=$URL<br>
                - ping_pong=5<br>
                - vga=none<br>
    s390x-git-url:<br>
        mux_suite_test_name_prefix: 'functional/git/url '<br>
        test_reference: unattended_install.url.extra_cdrom_ks.default_install.aio_threads boot migrate.with_reboot.tcp migrate.with_reboot.exec.gzip_exec migrate.default.tcp.with_post_copy<br>
        test_reference_resolver_args: !!python/dict<br>
            vt_qemu_bin: /home/jenkins/s390x/qemu-master/build/bin/qemu-system-s390x<br>
            vt_dst_qemu_bin: /home/jenkins/s390x/qemu-master/build/bin/qemu-system-s390x<br>
            vt_extra_params:<br>
                - automem=no<br>
                - url=$URL<br>
                - ping_pong=5<br>
                - vga=none<br>
```<br>
<br>
(feel free to ask for details, but basically it uses SIMPLE tests, EXTERNAL_RUNNER tests and then Avocado-vt tests. The test always receives all the params so you can override the standard arguments. If you specify "test_reference_resolver_args" it also updates the loader parameters, which is what I use for Avocado-vt tests).<br>
<br>
Theoretically there is yet another way and that is to create directory "sanity" and put symlinks to actual tests there, but the granularity there would be only per-test-class, which usually does not suffice.<br>
<br>
Anyway, hopefully at least one method suits you, but feel free to elaborate more, we can always improve.<br>
<br>
Kind regards,<br>
Lukáš<br>
<br>
</blockquote></div>