qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] avocado_qemu: add AVOCADO_DEFAULT_ARCH for cross-arch te


From: Daniel Henrique Barboza
Subject: Re: [PATCH 2/3] avocado_qemu: add AVOCADO_DEFAULT_ARCH for cross-arch tests
Date: Wed, 18 Jan 2023 13:06:03 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0



On 1/18/23 12:23, Fabiano Rosas wrote:
Daniel Henrique Barboza <dbarboza@ventanamicro.com> writes:

All avocado tests that are arch agnostic (i.e. does not set an 'arch'
tag) are run with arch=None in pick_default_qemu_bin(), and then 'arch'
is set to os.uname()[4], meaning that it will take the arch of the
running host.

This means that if one compiles QEMU binaries for non-x86 targets on an
x86 machine, and then run 'make check-avocado', all arch agnostic tests
will be cancelled because there's no qemu-system-x86_64 to be found.

There is no particular reason to not allow these tests to be run with
other arch binaries in a x86_64 host. Allow the developer to do it by
adding a a new env variable called AVOCADO_DEFAULT_ARCH. Any 'arch' that
is set by this variable will take precedence of setting it via
os.uname()[4]. We can then run non-x86 binaries tests in a x86_64 host
as follows:

$ AVOCADO_DEFAULT_ARCH=riscv64 make check-avocado
(...)
RESULTS: PASS 11 | ERROR 0 | FAIL 0 | SKIP 1 | WARN 0 | INTERRUPT 0 | CANCEL 0
I don't understand why tags don't solve the problem. We
are already passing a tag for each target:

ifndef AVOCADO_TAGS
        AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \
                                                 $(filter %-softmmu,$(TARGETS)))
else
        AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS))
endif

I then tried to tag migration.py with:

     :avocado: tags=arch:x86_64
     :avocado: tags=arch:aarch64

On an x86_64 machine with target-list=x86_64-softmmu,aarch64-softmmu,
only the x86_64 test runs. Even if I remove the x86_64 tag from the
avocado line. Possibly due to the --filter-by-tags-include-empty
options. But I would expect a second run with aarch64, even if it
failed.

I can give some light in this bit. tests/avocado/avocado_qemu/__init__.py,
setUp() from  "class QemuBaseTest":


    def setUp(self, bin_prefix):
        self.arch = self.params.get('arch',
default=self._get_unique_tag_val('arch'))


So what you did there:

:avocado: tags=arch:x86_64
:avocado: tags=arch:aarch64

Will result in "self.arch = None"  because 'arch' is not an unique tag. This 
has the
same effect as giving no 'arch' tags at all.

In fact, all avocado tags fetched from the test files works the same way. If 
the tag
isn't unique it's considered None.

It is worth mentioning that the docs mentions that the 'arch' tag must be 
unique:

=====
The ``arch`` attribute will be set to the test parameter of the same
name.  If one is not given explicitly, it will either be set to
``None``, or, if the test is tagged with one (and only one)
``:avocado: tags=arch:VALUE`` tag, it will be set to ``VALUE``.
=====

But it doesn't mention that having multiple 'arch' tags will have the same 
effect
as having no 'arch' tag though.



If I use only:

     :avocado: tags=arch:riscv

and run:

python3 -m avocado --show=app run -t arch:riscv -t arch:x86_64 --failfast 
../tests/avocado/migration.py

Then it complains about the binary, but the x86_64 binary is present! So
it looked at the tag after all:

CANCEL: No QEMU binary defined or found in the build tree for arch riscv
                                                                    ^^^^^

Yeah, in this case it looked at the 'arch:riscv' tag in the tes,t because it 
was the only 'arch' tag,
and complained that you didn't have RISC-V binaries because it actually tried 
to find them.

Also, what you did there with the "-t arch:riscv -t arch:x86_64" is "run this 
avocado
test if the test tags matches these". There is no way of "assigning" a different
arch/machine/etc via these command line tags. Probably this wasn't your 
intention
at all but I'd rather mention it to be safe.


Thanks,

Daniel




I don't know how to make this work, but I feel there should be a way to
have the framework select the correct test AND pass the correct arch
parameter along.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]