From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
qemu-ppc@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
qemu-arm@nongnu.org, qemu-block@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Laurent Vivier" <lvivier@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Ani Sinha" <anisinha@redhat.com>
Subject: [PATCH 2/4] tests/qtest: Use qtest_get_arch_bits()
Date: Tue, 10 Oct 2023 09:49:50 +0200 [thread overview]
Message-ID: <20231010074952.79165-3-philmd@linaro.org> (raw)
In-Reply-To: <20231010074952.79165-1-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/arm-cpu-features.c | 49 ++++++++++++++++------------------
tests/qtest/bios-tables-test.c | 16 +++++------
2 files changed, 30 insertions(+), 35 deletions(-)
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
index a8a4c668ad..b6c1b430c1 100644
--- a/tests/qtest/arm-cpu-features.c
+++ b/tests/qtest/arm-cpu-features.c
@@ -462,7 +462,7 @@ static void test_query_cpu_model_expansion(const void *data)
assert_has_not_feature(qts, "max", "kvm-no-adjvtime");
assert_has_not_feature(qts, "max", "kvm-steal-time");
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
+ if (qtest_get_arch_bits() == 64) {
assert_has_feature_enabled(qts, "max", "aarch64");
assert_has_feature_enabled(qts, "max", "sve");
assert_has_feature_enabled(qts, "max", "sve128");
@@ -507,7 +507,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
assert_set_feature(qts, "host", "kvm-no-adjvtime", true);
assert_set_feature(qts, "host", "kvm-no-adjvtime", false);
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
+ if (qtest_get_arch_bits() == 64) {
bool kvm_supports_steal_time;
bool kvm_supports_sve;
char max_name[8], name[8];
@@ -636,34 +636,31 @@ int main(int argc, char **argv)
NULL, test_query_cpu_model_expansion);
}
- if (!g_str_equal(qtest_get_arch(), "aarch64")) {
- goto out;
- }
-
- /*
- * For now we only run KVM specific tests with AArch64 QEMU in
- * order avoid attempting to run an AArch32 QEMU with KVM on
- * AArch64 hosts. That won't work and isn't easy to detect.
- */
- if (qtest_has_accel("kvm")) {
+ if (qtest_get_arch_bits() == 64) {
/*
- * This tests target the 'host' CPU type, so register it only if
- * KVM is available.
+ * For now we only run KVM specific tests with AArch64 QEMU in
+ * order avoid attempting to run an AArch32 QEMU with KVM on
+ * AArch64 hosts. That won't work and isn't easy to detect.
*/
- qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
- NULL, test_query_cpu_model_expansion_kvm);
+ if (qtest_has_accel("kvm")) {
+ /*
+ * This tests target the 'host' CPU type, so register it only if
+ * KVM is available.
+ */
+ qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
+ NULL, test_query_cpu_model_expansion_kvm);
- qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
- NULL, sve_tests_sve_off_kvm);
+ qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
+ NULL, sve_tests_sve_off_kvm);
+ }
+
+ if (qtest_has_accel("tcg")) {
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
+ NULL, sve_tests_sve_max_vq_8);
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
+ NULL, sve_tests_sve_off);
+ }
}
- if (qtest_has_accel("tcg")) {
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
- NULL, sve_tests_sve_max_vq_8);
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
- NULL, sve_tests_sve_off);
- }
-
-out:
return g_test_run();
}
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index f8e03dfd46..7e708d78b3 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -2089,7 +2089,7 @@ int main(int argc, char *argv[])
qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
/* i386 does not support memory hotplug */
- if (strcmp(arch, "i386")) {
+ if (qtest_get_arch_bits() == 64) {
qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
qtest_add_func("acpi/piix4/dimmpxm",
test_acpi_piix4_tcg_dimm_pxm);
@@ -2127,7 +2127,7 @@ int main(int argc, char *argv[])
test_acpi_q35_tcg_acpi_hmat_noinitiator);
/* i386 does not support memory hotplug */
- if (strcmp(arch, "i386")) {
+ if (qtest_get_arch_bits() == 64) {
qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
qtest_add_func("acpi/q35/acpihmat",
@@ -2164,15 +2164,13 @@ int main(int argc, char *argv[])
test_acpi_microvm_ioapic2_tcg);
qtest_add_func("acpi/microvm/oem-fields",
test_acpi_microvm_oem_fields);
- if (has_tcg) {
- if (strcmp(arch, "x86_64") == 0) {
- qtest_add_func("acpi/microvm/pcie",
- test_acpi_microvm_pcie_tcg);
+ if (has_tcg && qtest_get_arch_bits() == 64) {
+ qtest_add_func("acpi/microvm/pcie",
+ test_acpi_microvm_pcie_tcg);
#ifdef CONFIG_POSIX
- qtest_add_func("acpi/microvm/acpierst",
- test_acpi_microvm_acpi_erst);
+ qtest_add_func("acpi/microvm/acpierst",
+ test_acpi_microvm_acpi_erst);
#endif
- }
}
}
} else if (strcmp(arch, "aarch64") == 0) {
--
2.41.0
next prev parent reply other threads:[~2023-10-10 7:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 7:49 [PATCH 0/4] tests/qtest: Introduce qtest_get_base_arch() and qtest_get_arch_bits() Philippe Mathieu-Daudé
2023-10-10 7:49 ` [PATCH 1/4] tests/libqtest: Introduce qtest_get_arch_bits() Philippe Mathieu-Daudé
2023-10-10 9:46 ` Thomas Huth
2023-10-10 9:48 ` Philippe Mathieu-Daudé
2023-10-10 7:49 ` Philippe Mathieu-Daudé [this message]
2023-10-10 9:49 ` [PATCH 2/4] tests/qtest: Use qtest_get_arch_bits() Thomas Huth
2023-10-10 10:03 ` Ani Sinha
2023-10-10 7:49 ` [PATCH 3/4] tests/libqtest: Introduce qtest_get_base_arch() Philippe Mathieu-Daudé
2023-10-10 8:42 ` Philippe Mathieu-Daudé
2023-10-10 9:50 ` Thomas Huth
2023-10-10 7:49 ` [PATCH 4/4] tests/qtest: Use qtest_get_base_arch() Philippe Mathieu-Daudé
2023-10-10 9:38 ` Akihiko Odaki
2023-10-10 9:58 ` Thomas Huth
2023-10-10 10:37 ` 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=20231010074952.79165-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=anisinha@redhat.com \
--cc=imammedo@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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).