qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, "Juan Quintela" <quintela@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Andrew Jones" <drjones@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	qemu-arm@nongnu.org, "Claudio Fontana" <cfontana@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH v5 08/10] qtest/bios-tables-test: Make test build-independent from accelerator
Date: Mon, 3 May 2021 18:04:15 +0200	[thread overview]
Message-ID: <20210503180415.3c798f64@redhat.com> (raw)
In-Reply-To: <dd561115-0586-3920-6236-32a3abd043f2@redhat.com>

On Mon, 3 May 2021 14:44:32 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Hi Igor,
> 
> On 5/3/21 2:36 PM, Igor Mammedov wrote:
> > On Sun,  2 May 2021 00:36:36 +0200
> > Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> >   
> >> Now than we can probe if the TCG accelerator is available
> >> at runtime with a QMP command, do it once at the beginning
> >> and only register the tests we can run.
> >> We can then replace the #ifdef'ry by an assertion.
> >>
> >> Reviewed-by: Eric Blake <eblake@redhat.com>
> >> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> >> ---
> >>  tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
> >>  1 file changed, 52 insertions(+), 47 deletions(-)
> >>
> >> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> >> index 156d4174aa3..a4c7bddf6f3 100644
> >> --- a/tests/qtest/bios-tables-test.c
> >> +++ b/tests/qtest/bios-tables-test.c
> >> @@ -97,6 +97,7 @@ typedef struct {
> >>      QTestState *qts;
> >>  } test_data;
> >>  
> >> +static bool tcg_accel_available;
> >>  static char disk[] = "tests/acpi-test-disk-XXXXXX";
> >>  static const char *data_dir = "tests/data/acpi";
> >>  #ifdef CONFIG_IASL
> >> @@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_data *data)
> >>      char *args;
> >>      bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
> >>  
> >> -#ifndef CONFIG_TCG
> >> -    if (data->tcg_only) {
> >> -        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
> >> -        return;
> >> -    }
> >> -#endif /* CONFIG_TCG */
> >> +    assert(!data->tcg_only || tcg_accel_available);
> >>  
> >>      args = test_acpi_create_args(data, params, use_uefi);
> >>      data->qts = qtest_init(args);
> >> +  
> > stray new line?  
> 
> Oops.
> 
> >   
> >>      test_acpi_load_tables(data, use_uefi);
> >>  
> >>      if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
> >> @@ -1504,6 +1501,8 @@ int main(int argc, char *argv[])
> >>      const char *arch = qtest_get_arch();
> >>      int ret;
> >>  
> >> +    tcg_accel_available = qtest_has_accel("tcg");
> >> +
> >>      g_test_init(&argc, &argv, NULL);
> >>  
> >>      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> >> @@ -1512,56 +1511,62 @@ int main(int argc, char *argv[])
> >>              return ret;
> >>          }
> >>          qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
> >> -        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> >> -        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
> >>          qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
> >> -        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> >> +        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
> >>          qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug",
> >>                         test_acpi_piix4_no_root_hotplug);
> >>          qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug",
> >>                         test_acpi_piix4_no_bridge_hotplug);
> >>          qtest_add_func("acpi/piix4/pci-hotplug/off",
> >>                         test_acpi_piix4_no_acpi_pci_hotplug);
> >> -        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> >> -        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> >> -        qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
> >> -        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
> >> -        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
> >> -        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
> >> -        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
> >> -        qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
> >> -        qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
> >> -        qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
> >> -        qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> >> -        qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
> >> -        qtest_add_func("acpi/piix4/smm-compat",
> >> -                       test_acpi_piix4_tcg_smm_compat);
> >> -        qtest_add_func("acpi/piix4/smm-compat-nosmm",
> >> -                       test_acpi_piix4_tcg_smm_compat_nosmm);
> >> -        qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
> >> -        qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
> >> -        qtest_add_func("acpi/q35/smm-compat",
> >> -                       test_acpi_q35_tcg_smm_compat);
> >> -        qtest_add_func("acpi/q35/smm-compat-nosmm",
> >> -                       test_acpi_q35_tcg_smm_compat_nosmm);
> >> -        qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
> >> -        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> >> -        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> >> -        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
> >> -        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
> >> -        qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
> >> -        qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
> >> -        qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
> >> -        qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
> >> -        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
> >> -        if (strcmp(arch, "x86_64") == 0) {
> >> -            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
> >> +        if (tcg_accel_available) {  
> > 
> > most of this can run without TCG if KVM is available, so why are you limiting it to TCG only
> > or am I missing something?  
> 
> This patch is a simple API change, these tests are already restricted by
> the 'g_test_skip("TCG disabled, skipping ACPI tcg_only test");' call.
> 


with current code, assume we have TCG compiled out:
 - test_acpi_one() will execute any test that is not marked as tcg_only

with this patch if tcg_accel_available == False,
it will not even register any test under "if (tcg_accel_available) {" branch
and in this patch that includes a bunch of _non_ tcg_only tests.
So tests won't be executed on KVM only build, where previously they were executed just fine.

> If someone is willing to send a patch to have them run without TCG, I'm
> fine to rebase my series on top. Else it can also be done on top of my
> series. Whichever you prefer, but I'd rather not delay Claudio's work
> too long...
> 
> >   
> >> +            qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> >> +            qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
> >> +            qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> >> +            qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> >> +            qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> >> +            qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
> >> +            qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
> >> +            qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
> >> +            qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
> >> +            qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
> >> +            qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
> >> +            qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
> >> +            qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
> >> +            qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> >> +            qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
> >> +            qtest_add_func("acpi/piix4/smm-compat",
> >> +                           test_acpi_piix4_tcg_smm_compat);
> >> +            qtest_add_func("acpi/piix4/smm-compat-nosmm",
> >> +                           test_acpi_piix4_tcg_smm_compat_nosmm);
> >> +            qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
> >> +            qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
> >> +            qtest_add_func("acpi/q35/smm-compat",
> >> +                           test_acpi_q35_tcg_smm_compat);
> >> +            qtest_add_func("acpi/q35/smm-compat-nosmm",
> >> +                           test_acpi_q35_tcg_smm_compat_nosmm);
> >> +            qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
> >> +            qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> >> +            qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> >> +            qtest_add_func("acpi/piix4/acpihmat",
> >> +                           test_acpi_piix4_tcg_acpi_hmat);
> >> +            qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
> >> +            qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
> >> +            qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
> >> +            qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
> >> +            qtest_add_func("acpi/microvm/ioapic2",
> >> +                           test_acpi_microvm_ioapic2_tcg);
> >> +            if (strcmp(arch, "x86_64") == 0) {
> >> +                qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
> >> +            }
> >>          }
> >>      } else if (strcmp(arch, "aarch64") == 0) {
> >> -        qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> >> -        qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
> >> -        qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
> >> -        qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
> >> +        if (tcg_accel_available) {
> >> +            qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> >> +            qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
> >> +            qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
> >> +            qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
> >> +        }
> >>          qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
> >>      }
> >>      ret = g_test_run();  
> >   
> 
> 



  reply	other threads:[~2021-05-03 16:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 22:36 [PATCH v5 00/10] qtests: Check accelerator available at runtime via QMP 'query-accels' Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 01/10] MAINTAINERS: Add qtest/arm-cpu-features.c to ARM TCG CPUs section Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 02/10] accel: Introduce 'query-accels' QMP command Philippe Mathieu-Daudé
2021-05-05  7:07   ` Markus Armbruster
2021-05-05 11:49     ` Philippe Mathieu-Daudé
2021-05-05 15:01       ` Markus Armbruster
2021-05-05 15:28         ` Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 03/10] tests/qtest: Add qtest_has_accel() method Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 04/10] qtest/arm-cpu-features: Use generic qtest_has_accel() to check for KVM Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 05/10] qtest/arm-cpu-features: Restrict sve_tests_sve_off_kvm test to KVM Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 06/10] qtest/arm-cpu-features: Remove TCG fallback to KVM specific tests Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 07/10] qtest/arm-cpu-features: Use generic qtest_has_accel() to check for TCG Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 08/10] qtest/bios-tables-test: Make test build-independent from accelerator Philippe Mathieu-Daudé
2021-05-03 12:36   ` Igor Mammedov
2021-05-03 12:44     ` Philippe Mathieu-Daudé
2021-05-03 16:04       ` Igor Mammedov [this message]
2021-05-03 16:33         ` Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 09/10] qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64 Philippe Mathieu-Daudé
2021-05-01 22:36 ` [PATCH v5 10/10] qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210503180415.3c798f64@redhat.com \
    --to=imammedo@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=cfontana@suse.de \
    --cc=dgilbert@redhat.com \
    --cc=drjones@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).