qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 0/8] RFC: Pass tests for x86_64 machine types compiled indivi


From: Thomas Huth
Subject: Re: [PATCH 0/8] RFC: Pass tests for x86_64 machine types compiled individually
Date: Tue, 20 Sep 2022 09:55:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

On 02/09/2022 19.34, Juan Quintela wrote:
[...]
There are interesting cases, and are the tests are run with the
default machine type (pc) but that work with either of them
[...]
This tests can be run with both machine types, but as we can't easily
put -machine on them (several of them are supposed to run on other
architectures), it is not "trivial to fix".  I have a "hack" on my
tree that gets the 1st machine available for this kind of tests and
changed qtest_init() to qtest_init_first() that does exactly that.
But I am not sure that is the way to go.

I don't think that this would be a reliable solution, e.g. with qemu-system-ppc64 or -aarch64, there are plenty of different machine types and you cannot simply grab the first one to hope that it is good enough to run the tests.

Another way for me to fix it
is just to change the Q35 machine to be the default for x86_64 when
I400FX is not compiled in, but it has other kind of troubles.

I think there was a consensus in the past to rather get away from default machine types, so I think that's also the wrong way to go.

I
started this wanting than all tests showed an explicit machine type,
but there is nothing easier to be done for this multiarch tests.

What about this idea: Introduce a "qtest_default_machine()" function that looks like this:

const char *qtest_default_machine(void)
{
    if (g_strequal(arch, "i386") || g_strequal(arch, "x86_64")) {
        if (qtest_has_machine("pc")) {
            return "-machine pc";
        } else if (qtest_has_machine("q35")) {
            return "-machine q35";
        } else {
            abort(); // Or skip the test somehow?
        }
    }

    if (g_strequal(arch, "arm") || g_strequal(arch, "aarch64")) {
        /* ARM does not have a default machine, so use "virt" */
        if (qtest_has_machine("virt")) {
            return "-machine virt";
        } else {
            abort(); // Or skip the test somehow?
        }

    // ... similar logic for m68k, riscv, rx, avr and tricore ...

    /* For all others use the default machine */
    return "";
}

Then you could use this à la:

    qts = qtest_init("%s ...", gtest_default_machine(), ...);

Or even add a wrapper function qtest_init_default_machine() for this?

 HTH,
  Thomas




reply via email to

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