[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/53] tests: arm-cpu-features: use qtest_has_kvm() API
From: |
Igor Mammedov |
Subject: |
[PATCH 16/53] tests: arm-cpu-features: use qtest_has_kvm() API |
Date: |
Fri, 25 Jun 2021 05:17:41 -0400 |
and drop custom function that were doing the job
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
CC: thuth@redhat.com
CC: lvivier@redhat.com
CC: drjones@redhat.com
CC: peter.maydell@linaro.org
CC: pbonzini@redhat.com
CC: qemu-arm@nongnu.org
---
tests/qtest/arm-cpu-features.c | 29 +++++------------------------
1 file changed, 5 insertions(+), 24 deletions(-)
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
index 8252b85bb8..dbeaf59076 100644
--- a/tests/qtest/arm-cpu-features.c
+++ b/tests/qtest/arm-cpu-features.c
@@ -26,21 +26,6 @@
" 'arguments': { 'type': 'full', "
#define QUERY_TAIL "}}"
-static bool kvm_enabled(QTestState *qts)
-{
- QDict *resp, *qdict;
- bool enabled;
-
- resp = qtest_qmp(qts, "{ 'execute': 'query-kvm' }");
- g_assert(qdict_haskey(resp, "return"));
- qdict = qdict_get_qdict(resp, "return");
- g_assert(qdict_haskey(qdict, "enabled"));
- enabled = qdict_get_bool(qdict, "enabled");
- qobject_unref(resp);
-
- return enabled;
-}
-
static QDict *do_query_no_props(QTestState *qts, const char *cpu_type)
{
return qtest_qmp(qts, QUERY_HEAD "'model': { 'name': %s }"
@@ -493,14 +478,6 @@ static void test_query_cpu_model_expansion_kvm(const void
*data)
qts = qtest_init(MACHINE_KVM "-cpu max");
- /*
- * These tests target the 'host' CPU type, so KVM must be enabled.
- */
- if (!kvm_enabled(qts)) {
- qtest_quit(qts);
- return;
- }
-
/* Enabling and disabling kvm-no-adjvtime should always work. */
assert_has_feature_disabled(qts, "host", "kvm-no-adjvtime");
assert_set_feature(qts, "host", "kvm-no-adjvtime", true);
@@ -624,7 +601,11 @@ int main(int argc, char **argv)
* order avoid attempting to run an AArch32 QEMU with KVM on
* AArch64 hosts. That won't work and isn't easy to detect.
*/
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
+ if (g_str_equal(qtest_get_arch(), "aarch64") && 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);
}
--
2.27.0
- [PATCH 06/53] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar, (continued)
- [PATCH 06/53] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar, Igor Mammedov, 2021/06/25
- [PATCH 02/53] tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator, Igor Mammedov, 2021/06/25
- [PATCH 07/53] tests: acpi: add testcase for intel_iommu (DMAR table), Igor Mammedov, 2021/06/25
- [PATCH 08/53] tests: acpi: add expected blob for DMAR table, Igor Mammedov, 2021/06/25
- [PATCH 05/53] tests: acpi: update expected tables blobs, Igor Mammedov, 2021/06/25
- [PATCH 09/53] tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase, Igor Mammedov, 2021/06/25
- [PATCH 10/53] tests: acpi: add testcase for amd-iommu (IVRS table), Igor Mammedov, 2021/06/25
- [PATCH 15/53] tests: acpi: add expected IORT table blob, Igor Mammedov, 2021/06/25
- [PATCH 11/53] tests: acpi: update expected blobs, Igor Mammedov, 2021/06/25
- [PATCH 16/53] tests: arm-cpu-features: use qtest_has_kvm() API,
Igor Mammedov <=
- [PATCH 12/53] tests: acpi: arm/virt: drop redudant test_acpi_one() in test_acpi_virt_tcg(), Igor Mammedov, 2021/06/25
- [PATCH 13/53] tests: acpi: whitelist expected tables for acpi/virt/iort testcase, Igor Mammedov, 2021/06/25
- [PATCH 14/53] tests: acpi: arm/virt: use kvm to test IORT table, Igor Mammedov, 2021/06/25
- [PATCH 12/53] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg(), Igor Mammedov, 2021/06/25
- [PATCH 18/53] tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests, Igor Mammedov, 2021/06/25
- [PATCH 17/53] tests: migration-test: use qtest_has_accel() API, Igor Mammedov, 2021/06/25
- [PATCH 19/53] acpi: add helper routines to initialize ACPI tables, Igor Mammedov, 2021/06/25
- [PATCH 20/53] acpi: build_rsdt: use acpi_init_table()/acpi_table_composed() instead of build_header(), Igor Mammedov, 2021/06/25