From nobody Mon Feb 9 18:19:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619908621; cv=none; d=zohomail.com; s=zohoarc; b=IKDm+Yh0jXIsvOzIw90tJ3bRTNyKfewYaax0G0O1hzjRinv57YARe+TDrrFrBPyJQVg4LMgMHE7IdyUYAEn0tVN1j5wKzgkhtScjfyu8mvEjVCYlCi9+bLGKWqz7uDSDk7OYUG23/M0Weo+L/SpN3vSohRo61smRLrBjku1BJzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619908621; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=KvNHYhxkAqUqa9h+Qg11UCChxb8z3nuwgPPE3IGPHzY=; b=Ql1XeyvPZ9Ofy8efGpjEqHYqHdMwIVZq9tCiKIs/aZqFSI9OhOv9iD1cPB5nTKZx2Zzb2prBk0eytSXrr4YnEdES1HwL0meFKSAucnrBVA2f9JqKdEcoOeCrxZyL9LJkxODdPvZCX6qJ/YLl1TEKgTacULG7JOZm117Hx5S12kw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1619908621624771.3498940242563; Sat, 1 May 2021 15:37:01 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-CJ-uikvaOjiwSMhUwRSILQ-1; Sat, 01 May 2021 18:36:56 -0400 Received: by mail-wr1-f70.google.com with SMTP id i32-20020adf90a30000b029010d9e6b3833so1278886wri.18 for ; Sat, 01 May 2021 15:36:56 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (anancy-651-1-208-144.w109-217.abo.wanadoo.fr. [109.217.237.144]) by smtp.gmail.com with ESMTPSA id s16sm16600778wmh.11.2021.05.01.15.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 May 2021 15:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619908620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KvNHYhxkAqUqa9h+Qg11UCChxb8z3nuwgPPE3IGPHzY=; b=Y9aW4cdZbDCJQmCNxx2SFwXlTwjAL9ykDOxZ1rxKlchKBvAECKBpY0F32P9l4gj5pVYrey ALYEL9LlDYw/bY972OrNRGJQjVWcSc5tvIzXhGLoH2qQjE1PiiqA2zFRIx6+3zw6dkpsq6 BxEmXLW+atY8ATbhln9nzfk4q4qZUFM= X-MC-Unique: CJ-uikvaOjiwSMhUwRSILQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KvNHYhxkAqUqa9h+Qg11UCChxb8z3nuwgPPE3IGPHzY=; b=VldnU8sO9CoSlxy39N1SQi/p8oqkTvs7BEwlIXlVMbLuwUX7dX4fP3H5+NkoG/vvvP jGHBc9pYEk1rbgwSYfaorvl37wrmCqtQeojP9afdwaK3f1IxMMxqSK5cbtjfXdlyD8fq 2jrH1MSp+C7qRjeZtwpyubaehqikYUdl4tbWlMKRQfdQlA412QFl/ovSV3XProrVsPKU v0LZBWlnmJxSEe4b/z0hWQEzbU5q02nX3Ne8W3PBTwn3mo30y6AZVLHMkL4yJ7gu29Rt jLftCl8w8zEnnB80xOK4NPRV9IV1QsGCEvzsBTm1ILTlJoXN7mXnFDxGgegWmcF+p++P nmqg== X-Gm-Message-State: AOAM533A+ZBU/FQCDppba8bGAY05dK0EgBYWrjUkdyX6Jhr0KNCzZ+h/ X+GcKW9Ehv5RLTQ/QjFaQ8ur2madC9KxyR9UlyxaoTZWrYtOGBAMHNJtXU8HAa77tHV36wZODpc xAAIErBG2OFx/2Q== X-Received: by 2002:adf:fd0c:: with SMTP id e12mr3860678wrr.111.1619908615703; Sat, 01 May 2021 15:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn0mNPqpviMBqvwGpey6yvYbioi6rCsf3OxMpCVr2STxoQww3bFfq9mE8/L++4wHSsFlqTfA== X-Received: by 2002:adf:fd0c:: with SMTP id e12mr3860658wrr.111.1619908615597; Sat, 01 May 2021 15:36:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Juan Quintela , "Dr. David Alan Gilbert" , Richard Henderson , Andrew Jones , qemu-arm@nongnu.org, Eric Blake , Paolo Bonzini , Markus Armbruster , Claudio Fontana , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Subject: [PATCH v5 03/10] tests/qtest: Add qtest_has_accel() method Date: Sun, 2 May 2021 00:36:31 +0200 Message-Id: <20210501223638.510712-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210501223638.510712-1-philmd@redhat.com> References: <20210501223638.510712-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Introduce the qtest_has_accel() method which allows a runtime query on whether a QEMU instance has an accelerator built-in. Reviewed-by: Eric Blake Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/libqos/libqtest.h | 8 ++++++++ tests/qtest/libqtest.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h index a68dcd79d44..d80c618c18d 100644 --- a/tests/qtest/libqos/libqtest.h +++ b/tests/qtest/libqos/libqtest.h @@ -763,6 +763,14 @@ void qmp_expect_error_and_unref(QDict *rsp, const char= *class); */ bool qtest_probe_child(QTestState *s); =20 +/** + * qtest_has_accel: + * @accel_name: Accelerator name to check for. + * + * Returns: true if the accelerator is built in. + */ +bool qtest_has_accel(const char *accel_name); + /** * qtest_set_expected_status: * @s: QTestState instance to operate on. diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 71e359efcd3..2156b7e3972 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -393,6 +393,35 @@ QTestState *qtest_init_with_serial(const char *extra_a= rgs, int *sock_fd) return qts; } =20 +bool qtest_has_accel(const char *accel_name) +{ + bool has_accel =3D false; + QDict *response; + QList *accels; + QListEntry *accel; + QTestState *qts; + + qts =3D qtest_initf("-accel qtest -machine none"); + response =3D qtest_qmp(qts, "{'execute': 'query-accels'}"); + accels =3D qdict_get_qlist(response, "return"); + + QLIST_FOREACH_ENTRY(accels, accel) { + QDict *accel_dict =3D qobject_to(QDict, qlist_entry_obj(accel)); + const char *name =3D qdict_get_str(accel_dict, "name"); + + if (g_str_equal(name, accel_name)) { + has_accel =3D true; + break; + } + } + qobject_unref(response); + + qtest_quit(qts); + + return has_accel; +} + + void qtest_quit(QTestState *s) { qtest_remove_abrt_handler(s); --=20 2.26.3