From nobody Tue May 13 16:20:23 2025 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1678720335; cv=none; d=zohomail.com; s=zohoarc; b=QU2DcXLits10lgZbfs6NwyXg6KhuJhiU7aqaJLG7xCWpERSjObh4oDgo3S9/p/06jJLeZwZHmcFnRRjrfovvV+clUj350iGQLcjtphFtk6+PgdJIClDhZ8cMJCRRdtZt33HD20gkP0uAPm5nr9OAbicl6jhMddupLB/zRISIJ0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678720335; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2c86UeFI5T202M1tHwei5hS8KjfbDU7y+PlNk4ESHNk=; b=fgUhNKdIm6QtHRyQfnfH7RAPqXV6OvMhVjHz2G2m2CeJ1lCzPP27D/nfOYNK5EU9LtladWGoEC4jWSSOMP0D7ouAcPZ5lPWZOYd8lEX8Ljg5SjqN+QxXfJ6mtv+K87/xpqeBgb/XlwivOwo5g8JIS+NPu58baJNt2qmmcr4dcII= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678720335292503.7561459812259; Mon, 13 Mar 2023 08:12:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbjpj-0003Xl-6B; Mon, 13 Mar 2023 11:11:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbjph-0003XO-TR; Mon, 13 Mar 2023 11:11:29 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbjpg-0000Od-2b; Mon, 13 Mar 2023 11:11:29 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A96281FE0D; Mon, 13 Mar 2023 15:11:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 44E2A13582; Mon, 13 Mar 2023 15:11:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cCeSAxo9D2R1YwAAMHmgww (envelope-from ); Mon, 13 Mar 2023 15:11:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1678720286; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2c86UeFI5T202M1tHwei5hS8KjfbDU7y+PlNk4ESHNk=; b=IibIn4Svz3w5gx9xS2zWpN0iwOPEfjR6lrUmS6V33W4eSoHyux6g34LGaRe49fj84KHThj fvXJ5CXLBcTJ1Q7o/FvYqD7C72fM7Tl2Dvb2FjM9NG/zFgyf7I28GBz7N0bKqjPHMnL9gS +0ZDi9L6bM94ImupTwRr5O834o70/L0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1678720286; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2c86UeFI5T202M1tHwei5hS8KjfbDU7y+PlNk4ESHNk=; b=RzjHjj8OWG1/egyyMrUJOkvdDy366hBiSVY9vfekB9XJJx0/GQ4mbNQ/0bEMWc8UcNL49B PdIlG6DUNzfltKCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Claudio Fontana , Eduardo Habkost , Alexander Graf , Cornelia Huck , Juan Quintela , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Thomas Huth , Laurent Vivier , "Dr. David Alan Gilbert" Subject: [PATCH v9 06/10] tests/qtest: Fix tests when no KVM or TCG are present Date: Mon, 13 Mar 2023 12:10:54 -0300 Message-Id: <20230313151058.19645-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230313151058.19645-1-farosas@suse.de> References: <20230313151058.19645-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1678720336349100001 Content-Type: text/plain; charset="utf-8" It is possible to have a build with both TCG and KVM disabled due to Xen requiring the i386 and x86_64 binaries to be present in an aarch64 host. If we build with --disable-tcg on the aarch64 host, we will end-up with a QEMU binary (x86) that does not support TCG nor KVM. Skip tests that crash or hang in the above scenario. Do not include any test cases if TCG and KVM are missing. Make sure that calls to qtest_has_accel are placed after g_test_init in similar fashion to commit ae4b01b349 ("tests: Ensure TAP version is printed before other messages") to avoid TAP parsing errors. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela --- tests/qtest/bios-tables-test.c | 11 +++++++++-- tests/qtest/boot-serial-test.c | 5 +++++ tests/qtest/migration-test.c | 10 +++++++++- tests/qtest/pxe-test.c | 8 +++++++- tests/qtest/vmgenid-test.c | 9 +++++++-- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 76d5100911..2315adc70c 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -2082,8 +2082,7 @@ static void test_acpi_virt_oem_fields(void) int main(int argc, char *argv[]) { const char *arch =3D qtest_get_arch(); - const bool has_kvm =3D qtest_has_accel("kvm"); - const bool has_tcg =3D qtest_has_accel("tcg"); + bool has_kvm, has_tcg; char *v_env =3D getenv("V"); int ret; =20 @@ -2093,6 +2092,14 @@ int main(int argc, char *argv[]) =20 g_test_init(&argc, &argv, NULL); =20 + has_kvm =3D qtest_has_accel("kvm"); + has_tcg =3D qtest_has_accel("tcg"); + + if (!has_tcg && !has_kvm) { + g_test_skip("No accelerator available"); + return 0; + } + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { ret =3D boot_sector_init(disk); if (ret) { diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index 3aef3a97a9..28bab3d5e4 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -287,6 +287,11 @@ int main(int argc, char *argv[]) =20 g_test_init(&argc, &argv, NULL); =20 + if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) { + g_test_skip("No accelerator available"); + return 0; + } + for (i =3D 0; tests[i].arch !=3D NULL; i++) { if (g_str_equal(arch, tests[i].arch) && qtest_has_machine(tests[i].machine)) { diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index d4ab3934ed..5e4d562f0b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2459,7 +2459,7 @@ static bool kvm_dirty_ring_supported(void) =20 int main(int argc, char **argv) { - const bool has_kvm =3D qtest_has_accel("kvm"); + bool has_kvm, has_tcg; const bool has_uffd =3D ufd_version_check(); const char *arch =3D qtest_get_arch(); g_autoptr(GError) err =3D NULL; @@ -2467,6 +2467,14 @@ int main(int argc, char **argv) =20 g_test_init(&argc, &argv, NULL); =20 + has_kvm =3D qtest_has_accel("kvm"); + has_tcg =3D qtest_has_accel("tcg"); + + if (!has_tcg && !has_kvm) { + g_test_skip("No accelerator available"); + return 0; + } + /* * On ppc64, the test only works with kvm-hv, but not with kvm-pr and = TCG * is touchy due to race conditions on dirty bits (especially on PPC f= or diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c index 62b6eef464..5813adcf56 100644 --- a/tests/qtest/pxe-test.c +++ b/tests/qtest/pxe-test.c @@ -131,11 +131,17 @@ int main(int argc, char *argv[]) int ret; const char *arch =3D qtest_get_arch(); =20 + g_test_init(&argc, &argv, NULL); + + if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) { + g_test_skip("No accelerator available"); + return 0; + } + ret =3D boot_sector_init(disk); if(ret) return ret; =20 - g_test_init(&argc, &argv, NULL); =20 if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { test_batch(x86_tests, false); diff --git a/tests/qtest/vmgenid-test.c b/tests/qtest/vmgenid-test.c index efba76e716..a597cde707 100644 --- a/tests/qtest/vmgenid-test.c +++ b/tests/qtest/vmgenid-test.c @@ -165,13 +165,18 @@ int main(int argc, char **argv) { int ret; =20 + g_test_init(&argc, &argv, NULL); + + if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) { + g_test_skip("No accelerator available"); + return 0; + } + ret =3D boot_sector_init(disk); if (ret) { return ret; } =20 - g_test_init(&argc, &argv, NULL); - qtest_add_func("/vmgenid/vmgenid/set-guid", vmgenid_set_guid_test); qtest_add_func("/vmgenid/vmgenid/set-guid-auto", --=20 2.35.3