From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: lvivier@redhat.com, peter.maydell@linaro.org, thuth@redhat.com,
	mst@redhat.com, drjones@redhat.com, qemu-arm@nongnu.org,
	pbonzini@redhat.com
Subject: [PATCH 16/53] tests: arm-cpu-features: use qtest_has_kvm() API
Date: Fri, 25 Jun 2021 05:17:41 -0400	[thread overview]
Message-ID: <20210625091818.1047980-18-imammedo@redhat.com> (raw)
In-Reply-To: <20210625091818.1047980-1-imammedo@redhat.com>
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
next prev parent reply	other threads:[~2021-06-25  9:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210625091818.1047980-1-imammedo@redhat.com>
2021-06-25  9:17 ` [PATCH 12/53] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg() Igor Mammedov
2021-06-25  9:17 ` [PATCH 14/53] tests: acpi: arm/virt: use kvm to test IORT table Igor Mammedov
2021-06-25  9:17 ` Igor Mammedov [this message]
2021-06-25  9:17 ` [PATCH 25/53] acpi: acpi_build_hest: use acpi_init_table()/acpi_table_composed() instead of build_header() Igor Mammedov
2021-07-02 12:21   ` Dongjiu Geng
2021-06-25  9:17 ` [PATCH 34/53] acpi: arm/x86: build_srat: " Igor Mammedov
2021-06-25  9:18 ` [PATCH 35/53] acpi: use build_append_int_noprefix() API to compose SRAT table Igor Mammedov
2021-06-25  9:18 ` [PATCH 39/53] acpi: madt: arm/x86: use acpi_init_table()/acpi_table_composed() instead of build_header() Igor Mammedov
2021-06-25  9:18 ` [PATCH 43/53] acpi: arm/virt: madt: use build_append_int_noprefix() API to compose MADT table Igor Mammedov
2021-06-25  9:18 ` [PATCH 45/53] acpi: arm: virt: build_dsdt: use acpi_init_table()/acpi_table_composed() instead of build_header() Igor Mammedov
2021-06-25  9:18 ` [PATCH 46/53] acpi: arm: virt: build_iort: " Igor Mammedov
2021-06-25  9:18 ` [PATCH 47/53] acpi: arm/virt: convert build_iort() to endian agnostic build_append_FOO() API Igor Mammedov
2021-06-25  9:18 ` [PATCH 48/53] acpi: arm/virt: build_spcr: fix invalid cast Igor Mammedov
2021-06-25  9:18 ` [PATCH 49/53] acpi: arm/virt: build_spcr: use acpi_init_table()/acpi_table_composed() instead of build_header() Igor Mammedov
2021-06-25  9:18 ` [PATCH 50/53] acpi: arm/virt: build_gtdt: " Igor Mammedov
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=20210625091818.1047980-18-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=drjones@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-devel@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).