aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2021-09-02 07:35:49 -0400
committerMichael S. Tsirkin <mst@redhat.com>2021-10-20 04:37:55 -0400
commit07e6ed2c79b311aad4d2c87740753752ad1503ba (patch)
tree0a4d1d48e8062a3da87ca4f53b87d4d51c14cc4f /tests
parent709611cb23cc677fa0c2d4de76a21c24baefe9a0 (diff)
tests: arm-cpu-features: use qtest_has_kvm() API
and drop custom function that were doing the job Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20210902113551.461632-14-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/arm-cpu-features.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
index 90a87f0ea9..f76652143a 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 }"
@@ -506,14 +491,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);
@@ -637,7 +614,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);
}