From patchwork Tue Oct 10 07:49:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 731421 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1606675wrw; Tue, 10 Oct 2023 00:52:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgM+YgcmdmuO6NWyBu8Q4ecl3vdhNSPfnaHXBnqiqu/uIgbJpdzfu2FjWlquVlJ5EPGhbw X-Received: by 2002:a05:620a:4008:b0:775:92ac:a0af with SMTP id h8-20020a05620a400800b0077592aca0afmr21769280qko.13.1696924339740; Tue, 10 Oct 2023 00:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696924339; cv=none; d=google.com; s=arc-20160816; b=GkFB16seJEuvoLYxI4yoE3HDtkDHkcWFGyAqJu2XDAKH5VYgq1E+EdqV2Q3xlxOp7L 1jfjhHtC+d66mWpv4Po83hNnyFddGfSynQ7WavCrAuObj1JOYvugdF9vMqgHNO+d0sFd ZPU76EDs/XH6eLTV+B5LKTlFD+MvzyTtarmLeoqmmz3DCdfhVldtM2suTW4wn8JIIcQY fd8WavsogaDWkgu6XvydaefqFuyVUNPExnZYGbrpAJwA0XE4kX92k5TlrxpRKTIhlzHh eWz+KDJ8Ylall7Zj+0uixDDrgRIdI2bLpKGJiPsVoYQzJT7xPoLzx5tYFHBwYHEdM0vc CaWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xBzDwZo1XeWt7ItIGhOXUN3QV+md3tt2cNhSMxgmiwU=; fh=fvH34tHwViUOu98hGoeGCIVUhAkw1BzDAuMB2MXJND8=; b=gHbDP+DfO3otwC88OWxW6oNciHKYcDDwt+4iOXAE3smeMq4t+gRjBn5p+3E83cTHs2 oEFeH9zB0vL2zjo7FcTWnMXucWXplMMKMt16qU1EAxtGTGuut6c2vuV8ll6x+SE9Lkmi WHvUaSLAovxNrmU1sekO9UAd4bQeG25PWY4uSm1DBGtaOzn/kY9jn6ixROp4soRh5efx HrqAiThap1prbV52AhB4HnXQ8x08G7LqX/+Gtlyo/eGthKXGZCiWNOncBXX0T5MeUkeW SowBcCfBhGSujcQAYtqLm8zIGPmMyi2x4EefH02F3blvPwejjQTvYrlC57thEyHNMbmU zoIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GYfFz5Kz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x19-20020a05620a099300b00767f86fc1f5si6914220qkx.474.2023.10.10.00.52.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2023 00:52:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GYfFz5Kz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qq7VI-0008ME-2P; Tue, 10 Oct 2023 03:50:08 -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 1qq7VF-0008KG-Sn for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:05 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qq7VD-0004b5-CB for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:05 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9a6190af24aso926271466b.0 for ; Tue, 10 Oct 2023 00:50:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696924202; x=1697529002; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xBzDwZo1XeWt7ItIGhOXUN3QV+md3tt2cNhSMxgmiwU=; b=GYfFz5KzggGrfArSJY6N1EwatuHdkl8siUccOQeAkJ9tbk3lenbRt2fkvO2SYwWUF3 BAVcQ/AHYyIIVOzF2sSnFOT53rqYa/bEJPV0UL/AH4X/1R/ZkaBQdOmnjzTzr2wdv1Yg GrY+hdTlqFEKd9xPua/yJJqZf2Csz+KJmvonZpqyG/MqLXItbrWSVJxEMqy+VEIZ+lts 195qtfbBFHuTFyFavkxUtjsIXF3SeGrayJ0Wx7NTojcZzM+psQMcS77f9iKQUEgefIrU 0hD6Gf19yXcZPTitZCUJnxtWHq7B0CE4lneLA3I492crdA9TJrLIFRfZAwCo6Xg6DIpo 64oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696924202; x=1697529002; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xBzDwZo1XeWt7ItIGhOXUN3QV+md3tt2cNhSMxgmiwU=; b=rHKu4HUyD/rwzXUQF8+sxR94ypRxMy6Moz9xxbjV6A/CdKOqxYruxxAgMPdwZpHhKk Qsa6lIIs7SDuwe7YMfcfeddu0vxOmufTfl2eb5YnCqzPZNp37xaYpeSYQ7X210YbvMfa 7LLO/EkymCX1Lwd1fGldv3iRZ9T/3voEZDd6a2TOfB2eRBCv4RMxs07b4OUGsAS76UOX 192l+Ug8HEyalryoKgPYUwx85bsSEYM9dlI5IOS/SvLazuiSMiY3h5yIBOdqZCpnRRWN Y1EdvEpgvMdQv1h5lnhhvRVPZeNAyrthJyTJ9OYPfKgWzqZf9hI9NWFUux9VhEIuSxIt drTg== X-Gm-Message-State: AOJu0YzVJVLXtVEqcAEJhdZzu9gigm/IqJOBZysxCp6D/YcukqG7oUNN IRXTQfAvNynX778VLpzZ5Hgntf8tbbECf5Am7B8ZUA== X-Received: by 2002:a17:906:8455:b0:9ae:62ec:e897 with SMTP id e21-20020a170906845500b009ae62ece897mr15259871ejy.4.1696924201747; Tue, 10 Oct 2023 00:50:01 -0700 (PDT) Received: from m1x-phil.lan (aif79-h01-176-172-113-148.dsl.sta.abo.bbox.fr. [176.172.113.148]) by smtp.gmail.com with ESMTPSA id a14-20020a17090680ce00b0099cb1a2cab0sm8012503ejx.28.2023.10.10.00.50.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Oct 2023 00:50:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Paolo Bonzini , qemu-ppc@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Laurent Vivier Subject: [PATCH 1/4] tests/libqtest: Introduce qtest_get_arch_bits() Date: Tue, 10 Oct 2023 09:49:49 +0200 Message-ID: <20231010074952.79165-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231010074952.79165-1-philmd@linaro.org> References: <20231010074952.79165-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=philmd@linaro.org; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add a method to return the architecture bits (currently 8/32/64). Signed-off-by: Philippe Mathieu-Daudé --- tests/qtest/libqtest.h | 8 ++++++++ tests/qtest/libqtest.c | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index e53e350e3a..1e1b42241d 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -654,6 +654,14 @@ bool qtest_big_endian(QTestState *s); */ const char *qtest_get_arch(void); +/** + * qtest_get_arch_bits: + * + * Returns: The architecture bits (a.k.a. word size) for the QEMU executable + * under test. + */ +unsigned qtest_get_arch_bits(void); + /** * qtest_has_accel: * @accel_name: Accelerator name to check for. diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index b1eba71ffe..a643a6309c 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -925,6 +925,27 @@ const char *qtest_get_arch(void) return end + 1; } +unsigned qtest_get_arch_bits(void) +{ + static const char *const arch64[] = { + "aarch64", "hppa", "x86_64", "loongarch64", "mips64", + "mips64el", "ppc64", "riscv64", "s390x", "sparc64", + }; + const char *arch = qtest_get_arch(); + + if (!strcmp(arch, "avr")) { + return 8; + } + + for (unsigned i = 0; i < ARRAY_SIZE(arch64); i++) { + if (!strcmp(arch, arch64[i])) { + return 64; + } + } + + return 32; +} + bool qtest_has_accel(const char *accel_name) { if (g_str_equal(accel_name, "tcg")) { From patchwork Tue Oct 10 07:49:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 731417 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1606419wrw; Tue, 10 Oct 2023 00:51:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcNgNQpZDnvC3BcS5ocrUJY0xGUzGEEqXDOd/ZYZ7Wfu/ZHBi6oToZfV6nYJXl3bgkyryA X-Received: by 2002:a05:622a:13cc:b0:405:5679:463a with SMTP id p12-20020a05622a13cc00b004055679463amr19164787qtk.0.1696924294052; Tue, 10 Oct 2023 00:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696924294; cv=none; d=google.com; s=arc-20160816; b=BM/Xy/fxLwOfh/6zaaXCkliASvYWv6d4B+lqORDUDlB3isfWWK54YavIGmuvZUL4Dh VktfIdJ1gL/bh79fda0b9i4kTeiyfGI9iSDivKpmO8MfBpjoiGXtIrIbIFTcpqKoATU/ ipTo6Jl+E4XBGwjeAs07Pf5db2oe2bmbj9X8fAAgFAtUgKp6c0gSuGJInBpVhJwIDG8f 8dxXqYxmvD895aXgWyozulVWxY/xeYGqVKb6HAhkIx/tb6KVF7KZC8ub3EIUJcr5EapB i5Lvv1wRTX5kiCB1ld0MpYzAoGp0q56T0YM9iIpNMef3FmfFc5kDzDy0SOFOzt7yLDau lj/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FJhi36jVylnj85gu6IQc1ZcAE1kH76mXKOCIios85AY=; fh=TpX8mZMx73bNF6kTB9aHD08cppzHw2mnfb0SK6mZ09c=; b=g+UisKqOlsVdHNBOJ/Uk3fVQw/khlg9KV/ztub+/mcGFnebm8qwBNZC6hoTJGzbGWY BJZMU05QcnJ4GzwvlBwWHOFE6f6oyFXfoaBNhxvuYovLLigbbvADFxcnc43X5VcKUA39 awy5hzpSe14oFmfeRrxzYUlBtJCTNh5dGgezOZ4b2s8EDVrz68sHQwY7wHA/N4pd/kSf cu0OdZebNIDeC+TLo4JMPzoFjNrN92J7B532hyRNhGd31/jxJzE64FImTNuf53ot22nx 3rgWBLBbETTDVMJKXo+98u+SjUveevUF7oRfSvL+ZEySktdAXxt5JiqFQYde0dbPg+70 z4Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qEGgL0AW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h22-20020ac85856000000b0041975c9a4c3si7350467qth.89.2023.10.10.00.51.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2023 00:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qEGgL0AW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qq7VQ-0008Ox-Sr; Tue, 10 Oct 2023 03:50:17 -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 1qq7VP-0008O1-2U for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:15 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qq7VK-0004o3-Cu for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:14 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-53d82bea507so394417a12.2 for ; Tue, 10 Oct 2023 00:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696924208; x=1697529008; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FJhi36jVylnj85gu6IQc1ZcAE1kH76mXKOCIios85AY=; b=qEGgL0AWm+HeJOAXc6t6IQsPDKvgzW96BJMaZixySWL+TeAz4jfnrHcwXEBnGW0Rlu roC3a6o9qKTJqAIzmQelIJKUv71Q38Lwm79NHAGy0p3+3KAYAEQfFhZ4DD3haN6n7Tiq qwnYGiY9AxGVtV9AlNnX5FG44KBOuXanqr6MhIK2QRpU4wcJ4bofiC+o4wmMT1CG2AIO wKYx/0V2dhMWPWoVoPww/tZ6gx2+GklUc8LrwelZ4uAKGfW56KX+L6i9FfR0iVUTcCLS Rb0l3GranegmLojexc29MMuE0BunJWyW8RPCvQavch6D4e09iQYz/TugggPsh8wyEErD fPfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696924208; x=1697529008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FJhi36jVylnj85gu6IQc1ZcAE1kH76mXKOCIios85AY=; b=i52tkqCRn6jRgJz9QzeWhedyXpDC6ZS+4nwzUyyhgnaxNCgS6Q1QkqZn+qq4/Bz+7Z n3XnHUwuxSvh+5k02rj23r5OLCL/bo2D02SpsSINk+2fIndBXOC33Fi2KXz/7xyY93KZ u7xRVNrrHRadBHP47SIz8uBclKiug5j3aaIyLXjzCe+lIbA0WmMEpvo9niIYvl/eieQP O/vk64svheo/nOH/cJyjd3sQyAsl04gxg1czpdrN6jY/A8w94lKhqWWPSF69twCZ6Kke lYw6dB4/lWFaHbM+Jh++wcDh2Q/KE5aNxGSItPBEIj2C7e4RpWbGFLFTZoc955rKKNMQ QwRg== X-Gm-Message-State: AOJu0YyW/Zo8grof/emCHhI98tYhq7mIzjnZMvKbDp1SYyk9C+611Tus 9ZTJO3qXdzT2yIp166jGV54LU1MXpGGsFWPKCdAlBw== X-Received: by 2002:a17:907:7603:b0:9b2:b633:ada2 with SMTP id jx3-20020a170907760300b009b2b633ada2mr15704652ejc.36.1696924208060; Tue, 10 Oct 2023 00:50:08 -0700 (PDT) Received: from m1x-phil.lan (aif79-h01-176-172-113-148.dsl.sta.abo.bbox.fr. [176.172.113.148]) by smtp.gmail.com with ESMTPSA id lr5-20020a170906fb8500b009adcb6c0f0esm8004696ejb.193.2023.10.10.00.50.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Oct 2023 00:50:07 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Paolo Bonzini , qemu-ppc@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Maydell , Laurent Vivier , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha Subject: [PATCH 2/4] tests/qtest: Use qtest_get_arch_bits() Date: Tue, 10 Oct 2023 09:49:50 +0200 Message-ID: <20231010074952.79165-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231010074952.79165-1-philmd@linaro.org> References: <20231010074952.79165-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=philmd@linaro.org; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Ani Sinha --- tests/qtest/arm-cpu-features.c | 49 ++++++++++++++++------------------ tests/qtest/bios-tables-test.c | 16 +++++------ 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c index a8a4c668ad..b6c1b430c1 100644 --- a/tests/qtest/arm-cpu-features.c +++ b/tests/qtest/arm-cpu-features.c @@ -462,7 +462,7 @@ static void test_query_cpu_model_expansion(const void *data) assert_has_not_feature(qts, "max", "kvm-no-adjvtime"); assert_has_not_feature(qts, "max", "kvm-steal-time"); - if (g_str_equal(qtest_get_arch(), "aarch64")) { + if (qtest_get_arch_bits() == 64) { assert_has_feature_enabled(qts, "max", "aarch64"); assert_has_feature_enabled(qts, "max", "sve"); assert_has_feature_enabled(qts, "max", "sve128"); @@ -507,7 +507,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data) assert_set_feature(qts, "host", "kvm-no-adjvtime", true); assert_set_feature(qts, "host", "kvm-no-adjvtime", false); - if (g_str_equal(qtest_get_arch(), "aarch64")) { + if (qtest_get_arch_bits() == 64) { bool kvm_supports_steal_time; bool kvm_supports_sve; char max_name[8], name[8]; @@ -636,34 +636,31 @@ int main(int argc, char **argv) NULL, test_query_cpu_model_expansion); } - if (!g_str_equal(qtest_get_arch(), "aarch64")) { - goto out; - } - - /* - * For now we only run KVM specific tests with AArch64 QEMU in - * order avoid attempting to run an AArch32 QEMU with KVM on - * AArch64 hosts. That won't work and isn't easy to detect. - */ - if (qtest_has_accel("kvm")) { + if (qtest_get_arch_bits() == 64) { /* - * This tests target the 'host' CPU type, so register it only if - * KVM is available. + * For now we only run KVM specific tests with AArch64 QEMU in + * order avoid attempting to run an AArch32 QEMU with KVM on + * AArch64 hosts. That won't work and isn't easy to detect. */ - qtest_add_data_func("/arm/kvm/query-cpu-model-expansion", - NULL, test_query_cpu_model_expansion_kvm); + if (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); - qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off", - NULL, sve_tests_sve_off_kvm); + qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off", + NULL, sve_tests_sve_off_kvm); + } + + if (qtest_has_accel("tcg")) { + qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8", + NULL, sve_tests_sve_max_vq_8); + qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off", + NULL, sve_tests_sve_off); + } } - if (qtest_has_accel("tcg")) { - qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8", - NULL, sve_tests_sve_max_vq_8); - qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off", - NULL, sve_tests_sve_off); - } - -out: return g_test_run(); } diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index f8e03dfd46..7e708d78b3 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -2089,7 +2089,7 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet); /* i386 does not support memory hotplug */ - if (strcmp(arch, "i386")) { + if (qtest_get_arch_bits() == 64) { qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp); qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm); @@ -2127,7 +2127,7 @@ int main(int argc, char *argv[]) test_acpi_q35_tcg_acpi_hmat_noinitiator); /* i386 does not support memory hotplug */ - if (strcmp(arch, "i386")) { + if (qtest_get_arch_bits() == 64) { qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp); qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); qtest_add_func("acpi/q35/acpihmat", @@ -2164,15 +2164,13 @@ int main(int argc, char *argv[]) test_acpi_microvm_ioapic2_tcg); qtest_add_func("acpi/microvm/oem-fields", test_acpi_microvm_oem_fields); - if (has_tcg) { - if (strcmp(arch, "x86_64") == 0) { - qtest_add_func("acpi/microvm/pcie", - test_acpi_microvm_pcie_tcg); + if (has_tcg && qtest_get_arch_bits() == 64) { + qtest_add_func("acpi/microvm/pcie", + test_acpi_microvm_pcie_tcg); #ifdef CONFIG_POSIX - qtest_add_func("acpi/microvm/acpierst", - test_acpi_microvm_acpi_erst); + qtest_add_func("acpi/microvm/acpierst", + test_acpi_microvm_acpi_erst); #endif - } } } } else if (strcmp(arch, "aarch64") == 0) { From patchwork Tue Oct 10 07:49:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 731420 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1606632wrw; Tue, 10 Oct 2023 00:52:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcvJujWvUp7mWxfY7Ke9Xg7qIqrShHkpeBPdz+39VCPRJLsd3gTte5soFh1kdrHwvkCVuC X-Received: by 2002:a05:622a:13d1:b0:412:d0b:12c0 with SMTP id p17-20020a05622a13d100b004120d0b12c0mr21607008qtk.22.1696924334739; Tue, 10 Oct 2023 00:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696924334; cv=none; d=google.com; s=arc-20160816; b=UskKD/kAMk/g9E5cnw/U1JR6I1O1gVJxroDk8TqKBMx3OfueRpPzSm8Z9a7FcfnPwo xeOVq06ePRiyKcWc5Pxp2Ly0rFQRCDYj+oEpOmXMHn+B1ztq/0QoRVlJl5rw7N4RoW1N 5LAuIPN3Kmc4RUesqgPIfjmSq7l/AUSv5X9mO4tHf6aRaTWpdkySvYSiB3Xq7N81crtL qKBb3xVId6951WBhbggnMe4lsEe1waHHqa0TwVZ7wQ2/xC29eoM4fpxANQ1rpdyZUQb0 q3J1/Yc8800ApZsP3lwViKdaKz4zhQ9qbcmV4balUbRgQM+jTbjfBjlnAkWlVEZpetGz naVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f2NufxNzPZ9pUF8PsDHQZGBUjEuicTHUoNMeMj86XSo=; fh=fvH34tHwViUOu98hGoeGCIVUhAkw1BzDAuMB2MXJND8=; b=fQcWfJeAvsdKqRx9kym1IsMblTQijjTN3hhlNZMKz3+uVUVSSpMyXKyp/DFOrO+X+A npVpQYlln6GXNdBUPrVqnjHPvxBzbHNrtXK3UA0duqQgSjUun8JkHy3SR4IRkBDJGdtW PLqC96NrSgDltxugxO0mFgoHT2T3FWwTzrwMa7Mkt7y+9RQ6kWFJ2jEQ91plaKLr7kfH Y2bBkE5Jevtzto0gNBDHNn8N5Tq222ao0H4/VlBl+w5XeRBu0LNCInAyhnV3qmi7FCbY /Gngj9vtPoQDP/fejVLk+rNd9B0Ja2EEaXg2MSqPDxzs7/HUuALJv1N1yZJIYya6hB9l wZyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DcBXvfVQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w4-20020a05622a190400b00418113fb90asi7300782qtc.425.2023.10.10.00.52.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2023 00:52:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DcBXvfVQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qq7VY-0008Sc-AE; Tue, 10 Oct 2023 03:50:24 -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 1qq7VW-0008RR-AY for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:22 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qq7VP-0004or-Io for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:21 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-53d9f001b35so262087a12.2 for ; Tue, 10 Oct 2023 00:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696924213; x=1697529013; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f2NufxNzPZ9pUF8PsDHQZGBUjEuicTHUoNMeMj86XSo=; b=DcBXvfVQsQKMYcBa7ze5LXhmP9fzdc3TRtHMyEZiz0FwptqGcQr7ro5QHSIiI/5qKZ q+4QvDDLgMk5KVqO3bkOLl/4HnvHK6kcqQP9PQm5+0iPMydINr55hb0FKWb/ze9BV4TF lLdUG7qtbgsyVRMs3lxUd1cKpsHXIbqUDRvrSKYQhPURFaoh2Ki7K/YH6aSQ86Qttfjx 20T3eafeZGG1xdqpgEvUDNOKL+MY1sSeJZMNLxRPMhQJw2PmHhzY9ji+PS1wzid6gEq1 o2UCD8mSN2nDLKH6ueB+/uZcXq9jZayTju2QN9QUiztzaF7TNjs66FQKSUlX/O1l8dBH /U9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696924213; x=1697529013; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f2NufxNzPZ9pUF8PsDHQZGBUjEuicTHUoNMeMj86XSo=; b=BzI5igO7/QMNzZDw9bvh4pPdYUqpc5WROYPxf605GZiUjQwSardfULsI8E0PhOP08x VKztnr7O6KNn7nQln8Zwh64JLaQWVVcAsJ6mL2q7S9sXOdi4BHhiwfBvQSHeg/IpzRsc 9LMcZ49mWyYfLerQcmaZyBk4gtWEM7X9XpJ78ZoQ0epkbhXMq2iaRarJ3lzOCrdWzqHY SmrFetnhSwFMd+Nq7ACIJEbNW84k0aebob1XPra6vGidKElBuVfpnjgLc2L69HsOwF0l LrizADI42LbVTLWQ0BGm/DQL4iliDK889Pkl1LNw1UphAwhI0Z1i6G0c7rEYYQ0VQCS0 uRMw== X-Gm-Message-State: AOJu0Yxa1E4XQ6qGdJj30/1E08w/YM+SOcYCNUXshclfCld+lg8hsF9q stW6D99wVyHE327M4qSMaa2vFp6kEjVpKpmBnjnT+A== X-Received: by 2002:aa7:c746:0:b0:52a:38c3:1b49 with SMTP id c6-20020aa7c746000000b0052a38c31b49mr13446577eds.40.1696924213730; Tue, 10 Oct 2023 00:50:13 -0700 (PDT) Received: from m1x-phil.lan (aif79-h01-176-172-113-148.dsl.sta.abo.bbox.fr. [176.172.113.148]) by smtp.gmail.com with ESMTPSA id ee48-20020a056402293000b0053120f313cbsm449545edb.39.2023.10.10.00.50.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Oct 2023 00:50:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Paolo Bonzini , qemu-ppc@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Laurent Vivier Subject: [PATCH 3/4] tests/libqtest: Introduce qtest_get_base_arch() Date: Tue, 10 Oct 2023 09:49:51 +0200 Message-ID: <20231010074952.79165-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231010074952.79165-1-philmd@linaro.org> References: <20231010074952.79165-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org While qtest_get_arch() returns the target architecture name, such "i386" or "x86_64", qtest_get_base_arch() return the "base" (or real underlying) architecture, in this example that is "x86". Signed-off-by: Philippe Mathieu-Daudé --- tests/qtest/libqtest.h | 7 +++++++ tests/qtest/libqtest.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 1e1b42241d..54071e74ec 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -654,6 +654,13 @@ bool qtest_big_endian(QTestState *s); */ const char *qtest_get_arch(void); +/** + * qtest_get_base_arch: + * + * Returns: The base architecture for the QEMU executable under test. + */ +const char *qtest_get_base_arch(void); + /** * qtest_get_arch_bits: * diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index a643a6309c..51cc92af21 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -925,6 +925,34 @@ const char *qtest_get_arch(void) return end + 1; } +const char *qtest_get_base_arch(void) +{ + static const struct { + const char *const arch; + const char *const base; + } basearch[] = { + { "aarch64", "arm" }, + { "i386", "x86" }, + { "loongarch64", "loongarch" }, + { "mipsel", "mips" }, + { "mips64", "mips" }, + { "mips64el", "mips" }, + { "ppc64", "ppc" }, + { "riscv32", "riscv" }, + { "riscv64", "riscv" }, + { "sparc64", "sparc" }, + { "x86_64", "x86" }, + }; + const char *arch = qtest_get_arch(); + + for (unsigned i = 0; i < ARRAY_SIZE(basearch); i++) { + if (!strcmp(arch, basearch[i].arch)) { + return basearch[i].base; + } + } + g_assert_not_reached(); +} + unsigned qtest_get_arch_bits(void) { static const char *const arch64[] = { From patchwork Tue Oct 10 07:49:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 731418 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1606420wrw; Tue, 10 Oct 2023 00:51:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyBmbXHUbl5mjIKsoBZjNfYp+kDsY3sK738yw94nbI4+MODJ/j97yCoPMAu3voqCAyYjzk X-Received: by 2002:a37:e20b:0:b0:774:1e8f:222d with SMTP id g11-20020a37e20b000000b007741e8f222dmr17275544qki.62.1696924294024; Tue, 10 Oct 2023 00:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696924294; cv=none; d=google.com; s=arc-20160816; b=VFl6S8olXcyaIjWoh4nvzmUFzB/xe2hwSiqAUrl69kHgbLJM+AR6s+IuQnTvQSwqb/ 2m3jhcl3+FBY91lQziWPF4XGUnQ0mPcBK1mlmQ9bsanzWQk/2jHDeCO+wrV9E8WWOG/c xcmG5Jgf/IH4O1PTKI8FNQPB/iP78WONvep0gN07v9KdjEdHFck5YAfXJtGXZoYF5kBC fajL4wWic+N59C8kUIEmTy22d2ipySVtHfauSzykXbPpzXWhiJQEaUgtF1ULj+T7bG/t JRLv7cxQhN0AJFLAcJNqDINC4tjtaXC13nG9yN5H3rAb3a8G9m0PY/PXN0WvEGPKh+bv ZY3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zHkTGqBrVdowOzimiYZAy4nhJnGIbEuU9/oLP4xBoO4=; fh=vZ42y8n3avyo3v9Ib/TiaqszLPgJVdJGoGlb4zlZE8s=; b=NnwlE+ImOeIym7eGvQYbjW0qYwq5uCtz8U5Qwkwqph/SvnaMMbjAl5dvSPnPLdBsa3 v1daa9pkfa+B+8N5QGDRyevGBVSOPpsb+4qhoLlETLUuOSadYXYoXtChevRD55U0rCPB lVKNO1xoevb4fkWTXroFRoERlKMypaoMuTIhPmAwj6z70vRwVG+tmcS/AjXRI759TbTN c+uxAhOrwBnKyyMeyrmwsiwfceq+Pbo3oR8/8q0X9CHjwesFAox2iQfc6SO3YkmoDGKl dFICbwF2TqafVKZZ+/oLMz0GXGGRmQBqiO72MF14PJlcremHAzrh0qwAurbhs7+gsbRa 3GQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cceNoSFK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h2-20020a05620a400200b0076db1b23b27si7289800qko.715.2023.10.10.00.51.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2023 00:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cceNoSFK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qq7Ve-00007v-UV; Tue, 10 Oct 2023 03:50: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 1qq7Vb-0008WG-C6 for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:28 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qq7VW-0004ri-Kc for qemu-devel@nongnu.org; Tue, 10 Oct 2023 03:50:26 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9b275afb6abso1405656666b.1 for ; Tue, 10 Oct 2023 00:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696924221; x=1697529021; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zHkTGqBrVdowOzimiYZAy4nhJnGIbEuU9/oLP4xBoO4=; b=cceNoSFKiRjBVgQ279UCMOnks+WRv/wqAcmWADRh64kZSNpX6uMDlRc0uG+PjWMgyZ 5121OX6zCRUjwV2y1XcX0FIoSlwF+qSoe3isapsr/Mgvvm36AkgXQPrG2jgJaYGe6LxG HHHDOWY3nSKwiYpHSMFxrd/N27CsAhvsXOFOnt6rjktn+bikjA7yJxIw14rFrpc8r0bW ZX00EmWXS8/P+deo6HDXagLLhkgch6xTLSc06WeUilQiJAORMffRgGf69z/qIG3MbYBI wNK1FSxZ2TRv/wwPP489GZSINTPSR1XtG78LBcQFQcvK3rxYQJyO8rkuEGPW/lX+xu2m 4k3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696924221; x=1697529021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zHkTGqBrVdowOzimiYZAy4nhJnGIbEuU9/oLP4xBoO4=; b=ofiReDAJhYyJEq9VhocNqvtLjk994+5b+f4q9X/ux/+Zd4PFP46B3SGAmjIjVLKZX7 wW2kdTCBJeCaBt++78IbXenPKVKc9fuKbAKvs+5tadYOhrs2RK1kf+q/YdYbQMxO42Qo p+ZE0s6858kbpHPU4sTu0tn294R8G0MJ8s62SbMJtZNo9HYTNi6nxrkPt6TrKtNS6VV4 cQ7brQEFMUHkGSKy9dhhbu8PNig3z6JC/eXn+1kCFwwwxYZ+t4icLyFFNM5yx4tzbHKi VJ/LV4VEPyAyHZvyl7NOuUxDY2m8YoPstwsuAgHe7rTp3zDqp95nby5RIQ9xmztMwADB tQIg== X-Gm-Message-State: AOJu0YzISAiyvcAbK9FN/XqJ05jsiMz226Ds3ObaNEn4A+DN9s+7ieVl ak9KfWrKFxCBktioHmW0e1n9TF+dthanuTn/VYWXJQ== X-Received: by 2002:a17:907:1c1e:b0:9a5:7dec:fab9 with SMTP id nc30-20020a1709071c1e00b009a57decfab9mr12453124ejc.9.1696924220956; Tue, 10 Oct 2023 00:50:20 -0700 (PDT) Received: from m1x-phil.lan (aif79-h01-176-172-113-148.dsl.sta.abo.bbox.fr. [176.172.113.148]) by smtp.gmail.com with ESMTPSA id lf8-20020a170906ae4800b00992e14af9c3sm8091519ejb.143.2023.10.10.00.50.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Oct 2023 00:50:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Paolo Bonzini , qemu-ppc@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , John Snow , Laurent Vivier , Fam Zheng , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Alexander Bulekov , Bandan Das , Stefan Hajnoczi , Darren Kenny , Qiuhao Li , Dmitry Fleytman , Akihiko Odaki , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Harsh Prateek Bora , Jeuk Kim , Gerd Hoffmann , Jason Wang , Amit Shah Subject: [PATCH 4/4] tests/qtest: Use qtest_get_base_arch() Date: Tue, 10 Oct 2023 09:49:52 +0200 Message-ID: <20231010074952.79165-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231010074952.79165-1-philmd@linaro.org> References: <20231010074952.79165-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Additionally use qtest_get_arch_bits() when relevant. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki --- tests/qtest/ahci-test.c | 5 ++--- tests/qtest/am53c974-test.c | 4 +--- tests/qtest/bios-tables-test.c | 6 +++--- tests/qtest/boot-sector.c | 6 +++--- tests/qtest/device-plug-test.c | 6 ++---- tests/qtest/drive_del-test.c | 16 ++++++---------- tests/qtest/erst-test.c | 4 +--- tests/qtest/fuzz-e1000e-test.c | 4 +--- tests/qtest/ivshmem-test.c | 6 +++--- tests/qtest/libqos/qos_external.c | 6 ++++-- tests/qtest/lpc-ich9-test.c | 4 +--- tests/qtest/m48t59-test.c | 6 ++---- tests/qtest/pxe-test.c | 6 +++--- tests/qtest/qos-test.c | 6 ++++-- tests/qtest/readconfig-test.c | 6 +----- tests/qtest/rtas-test.c | 4 +--- tests/qtest/ufs-test.c | 4 +--- tests/qtest/usb-hcd-uhci-test.c | 6 +++--- tests/qtest/virtio-net-test.c | 3 +-- tests/qtest/virtio-rng-test.c | 4 +--- 20 files changed, 44 insertions(+), 68 deletions(-) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index eea8b5f77b..93d1e14896 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1835,7 +1835,7 @@ static void create_ahci_io_test(enum IOMode type, enum AddrMode addr, int main(int argc, char **argv) { - const char *arch, *base; + const char *base; int ret; int fd; int c; @@ -1867,8 +1867,7 @@ int main(int argc, char **argv) } /* Check architecture */ - arch = qtest_get_arch(); - if (strcmp(arch, "i386") && strcmp(arch, "x86_64")) { + if (strcmp(qtest_get_base_arch(), "x86")) { g_test_message("Skipping test for non-x86"); return 0; } diff --git a/tests/qtest/am53c974-test.c b/tests/qtest/am53c974-test.c index ed3ac7db20..dc41182a38 100644 --- a/tests/qtest/am53c974-test.c +++ b/tests/qtest/am53c974-test.c @@ -253,11 +253,9 @@ static void test_reset_before_transfer_ok(void) int main(int argc, char **argv) { - const char *arch = qtest_get_arch(); - g_test_init(&argc, &argv, NULL); - if (strcmp(arch, "i386") == 0) { + if (!strcmp(qtest_get_base_arch(), "x86") && qtest_get_arch_bits() == 32) { qtest_add_func("am53c974/test_cmdfifo_underflow_ok", test_cmdfifo_underflow_ok); qtest_add_func("am53c974/test_cmdfifo_underflow2_ok", diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 7e708d78b3..573e7dfcd9 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -2044,7 +2044,7 @@ static void test_acpi_virt_oem_fields(void) int main(int argc, char *argv[]) { - const char *arch = qtest_get_arch(); + const char *arch = qtest_get_base_arch(); bool has_kvm, has_tcg; char *v_env = getenv("V"); int ret; @@ -2063,7 +2063,7 @@ int main(int argc, char *argv[]) return 0; } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(arch, "x86") == 0) { ret = boot_sector_init(disk); if (ret) { return ret; @@ -2173,7 +2173,7 @@ int main(int argc, char *argv[]) #endif } } - } else if (strcmp(arch, "aarch64") == 0) { + } else if (strcmp(arch, "arm") == 0 && qtest_get_arch_bits() == 64) { if (has_tcg && qtest_has_device("virtio-blk-pci")) { qtest_add_func("acpi/virt", test_acpi_virt_tcg); qtest_add_func("acpi/virt/acpihmatvirt", diff --git a/tests/qtest/boot-sector.c b/tests/qtest/boot-sector.c index 679ee17e2a..f13e9a12ff 100644 --- a/tests/qtest/boot-sector.c +++ b/tests/qtest/boot-sector.c @@ -90,7 +90,7 @@ int boot_sector_init(char *fname) int fd, ret; size_t len; char *boot_code; - const char *arch = qtest_get_arch(); + const char *arch = qtest_get_base_arch(); fd = mkstemp(fname); if (fd < 0) { @@ -98,12 +98,12 @@ int boot_sector_init(char *fname) return 1; } - if (g_str_equal(arch, "i386") || g_str_equal(arch, "x86_64")) { + if (g_str_equal(arch, "x86")) { /* Q35 requires a minimum 0x7e000 bytes disk (bug or feature?) */ len = MAX(0x7e000, sizeof(x86_boot_sector)); boot_code = g_malloc0(len); memcpy(boot_code, x86_boot_sector, sizeof(x86_boot_sector)); - } else if (g_str_equal(arch, "ppc64")) { + } else if (g_str_equal(arch, "ppc") && qtest_get_arch_bits() == 64) { /* For Open Firmware based system, use a Forth script */ boot_code = g_strdup_printf("\\ Bootscript\n%x %x c! %x %x c!\n", LOW(SIGNATURE), SIGNATURE_ADDR, diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index c6f33153eb..59153e3493 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -65,7 +65,6 @@ static void process_device_remove(QTestState *qtest, const char *id) static void test_pci_unplug_request(void) { QTestState *qtest; - const char *arch = qtest_get_arch(); const char *machine_addition = ""; if (!qtest_has_device("virtio-mouse-pci")) { @@ -73,7 +72,7 @@ static void test_pci_unplug_request(void) return; } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { machine_addition = "-machine pc"; } @@ -107,7 +106,6 @@ static void test_q35_pci_unplug_request(void) static void test_pci_unplug_json_request(void) { QTestState *qtest; - const char *arch = qtest_get_arch(); const char *machine_addition = ""; if (!qtest_has_device("virtio-mouse-pci")) { @@ -115,7 +113,7 @@ static void test_pci_unplug_json_request(void) return; } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { machine_addition = "-machine pc"; } diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 8a6f3ac963..ccc42acce9 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -125,9 +125,9 @@ static void drive_del(QTestState *qts) */ static const char *qvirtio_get_dev_type(void) { - const char *arch = qtest_get_arch(); + const char *arch = qtest_get_base_arch(); - if (g_str_equal(arch, "arm") || g_str_equal(arch, "aarch64")) { + if (g_str_equal(arch, "arm")) { return "device"; /* for virtio-mmio */ } else if (g_str_equal(arch, "s390x")) { return "ccw"; @@ -249,7 +249,6 @@ static void test_drive_del_device_del(void) static void test_cli_device_del(void) { QTestState *qts; - const char *arch = qtest_get_arch(); const char *machine_addition = ""; if (!has_device_builtin("virtio-blk")) { @@ -257,7 +256,7 @@ static void test_cli_device_del(void) return; } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { machine_addition = "-machine pc"; } @@ -323,7 +322,6 @@ static void test_empty_device_del(void) static void test_device_add_and_del(void) { QTestState *qts; - const char *arch = qtest_get_arch(); const char *machine_addition = ""; if (!has_device_builtin("virtio-blk")) { @@ -331,7 +329,7 @@ static void test_device_add_and_del(void) return; } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { machine_addition = "-machine pc"; } @@ -394,7 +392,6 @@ static void test_device_add_and_del_q35(void) static void test_drive_add_device_add_and_del(void) { QTestState *qts; - const char *arch = qtest_get_arch(); const char *machine_addition = ""; if (!has_device_builtin("virtio-blk")) { @@ -402,7 +399,7 @@ static void test_drive_add_device_add_and_del(void) return; } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { machine_addition = "-machine pc"; } @@ -447,7 +444,6 @@ static void test_drive_add_device_add_and_del_q35(void) static void test_blockdev_add_device_add_and_del(void) { QTestState *qts; - const char *arch = qtest_get_arch(); const char *machine_addition = ""; if (!has_device_builtin("virtio-blk")) { @@ -455,7 +451,7 @@ static void test_blockdev_add_device_add_and_del(void) return; } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { machine_addition = "-machine pc"; } diff --git a/tests/qtest/erst-test.c b/tests/qtest/erst-test.c index c45bee7f05..8d3665b82c 100644 --- a/tests/qtest/erst-test.c +++ b/tests/qtest/erst-test.c @@ -95,9 +95,7 @@ static void cleanup_vm(ERSTState *s) static void setup_vm_cmd(ERSTState *s, const char *cmd) { - const char *arch = qtest_get_arch(); - - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { s->qs = qtest_pc_boot("%s", cmd); } else { g_printerr("erst-test tests are only available on x86\n"); diff --git a/tests/qtest/fuzz-e1000e-test.c b/tests/qtest/fuzz-e1000e-test.c index 5052883fb6..a8d3596f2c 100644 --- a/tests/qtest/fuzz-e1000e-test.c +++ b/tests/qtest/fuzz-e1000e-test.c @@ -40,11 +40,9 @@ static void test_lp1879531_eth_get_rss_ex_dst_addr(void) int main(int argc, char **argv) { - const char *arch = qtest_get_arch(); - g_test_init(&argc, &argv, NULL); - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { qtest_add_func("fuzz/test_lp1879531_eth_get_rss_ex_dst_addr", test_lp1879531_eth_get_rss_ex_dst_addr); } diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index 9bf8e78df6..32024d9243 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -397,9 +397,9 @@ static void test_ivshmem_hotplug_q35(void) static void test_ivshmem_hotplug(void) { QTestState *qts; - const char *arch = qtest_get_arch(); + const char *arch = qtest_get_base_arch(); - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(arch, "x86") == 0) { qts = qtest_init("-object memory-backend-ram,size=1M,id=mb1" " -machine pc"); } else { @@ -409,7 +409,7 @@ static void test_ivshmem_hotplug(void) qtest_qmp_device_add(qts, "ivshmem-plain", "iv1", "{'addr': %s, 'memdev': 'mb1'}", stringify(PCI_SLOT_HP)); - if (strcmp(arch, "ppc64") != 0) { + if (strcmp(arch, "ppc") != 0 && qtest_get_arch_bits() == 64) { qpci_unplug_acpi_device_test(qts, "iv1", PCI_SLOT_HP); } diff --git a/tests/qtest/libqos/qos_external.c b/tests/qtest/libqos/qos_external.c index c6bb8bff09..f01bb17628 100644 --- a/tests/qtest/libqos/qos_external.c +++ b/tests/qtest/libqos/qos_external.c @@ -31,10 +31,12 @@ static void machine_apply_to_node(const char *name) { - char *machine_name = g_strconcat(qtest_get_arch(), "/", name, NULL); + g_autofree char *machine_name = g_strdup_printf("%s/%u/%s", + qtest_get_base_arch(), + qtest_get_arch_bits(), + name); qos_graph_node_set_availability(machine_name, true); - g_free(machine_name); } void machines_apply_to_node(MachineInfoList *mach_info) diff --git a/tests/qtest/lpc-ich9-test.c b/tests/qtest/lpc-ich9-test.c index 8ac95b89f7..9f27591b74 100644 --- a/tests/qtest/lpc-ich9-test.c +++ b/tests/qtest/lpc-ich9-test.c @@ -28,11 +28,9 @@ static void test_lp1878642_pci_bus_get_irq_level_assert(void) int main(int argc, char **argv) { - const char *arch = qtest_get_arch(); - g_test_init(&argc, &argv, NULL); - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { qtest_add_func("ich9/test_lp1878642_pci_bus_get_irq_level_assert", test_lp1878642_pci_bus_get_irq_level_assert); } diff --git a/tests/qtest/m48t59-test.c b/tests/qtest/m48t59-test.c index b9cd209165..3579effdf4 100644 --- a/tests/qtest/m48t59-test.c +++ b/tests/qtest/m48t59-test.c @@ -239,15 +239,13 @@ static void fuzz_registers(void) static void base_setup(void) { - const char *arch = qtest_get_arch(); - - if (g_str_equal(arch, "sparc")) { + if (g_str_equal(qtest_get_arch(), "sparc")) { /* Note: For sparc64, we'd need to map-in the PCI bridge memory first */ base = 0x71200000; base_year = 1968; base_machine = "SS-5"; use_mmio = true; - } else if (g_str_equal(arch, "ppc") || g_str_equal(arch, "ppc64")) { + } else if (g_str_equal(qtest_get_base_arch(), "ppc")) { base = 0xF0000000; base_year = 1968; base_machine = "ref405ep"; diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c index e4b48225a5..5112bceb76 100644 --- a/tests/qtest/pxe-test.c +++ b/tests/qtest/pxe-test.c @@ -129,7 +129,7 @@ static void test_batch(const testdef_t *tests, bool ipv6) int main(int argc, char *argv[]) { int ret; - const char *arch = qtest_get_arch(); + const char *arch = qtest_get_base_arch(); g_test_init(&argc, &argv, NULL); @@ -143,12 +143,12 @@ int main(int argc, char *argv[]) return ret; - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(arch, "x86") == 0) { test_batch(x86_tests, false); if (g_test_slow()) { test_batch(x86_tests_slow, false); } - } else if (strcmp(arch, "ppc64") == 0) { + } else if (strcmp(arch, "ppc") == 0 && qtest_get_arch_bits() == 64) { test_batch(ppc64_tests, g_test_slow()); if (g_test_slow()) { test_batch(ppc64_tests_slow, true); diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index 5da4091ec3..5271582f6a 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -293,8 +293,10 @@ static void walk_path(QOSGraphNode *orig_path, int len) path_vec[0] = g_string_free(cmd_line, false); if (path->u.test.subprocess) { - gchar *subprocess_path = g_strdup_printf("/%s/%s/subprocess", - qtest_get_arch(), path_str); + gchar *subprocess_path = g_strdup_printf("/%s/%u/%s/subprocess", + qtest_get_base_arch(), + qtest_get_arch_bits(), + path_str); qtest_add_data_func(path_str, subprocess_path, subprocess_run_one_test); g_test_add_data_func(subprocess_path, path_vec, run_one_test); } else { diff --git a/tests/qtest/readconfig-test.c b/tests/qtest/readconfig-test.c index 760f974e63..7837997c6f 100644 --- a/tests/qtest/readconfig-test.c +++ b/tests/qtest/readconfig-test.c @@ -382,13 +382,9 @@ static void test_docs_q35_virtio_serial(void) int main(int argc, char *argv[]) { - const char *arch; g_test_init(&argc, &argv, NULL); - arch = qtest_get_arch(); - - if (g_str_equal(arch, "i386") || - g_str_equal(arch, "x86_64")) { + if (g_str_equal(qtest_get_base_arch(), "x86")) { qtest_add_func("readconfig/x86/memdev", test_x86_memdev); if (qtest_has_device("ich9-usb-ehci1") && qtest_has_device("ich9-usb-uhci1")) { diff --git a/tests/qtest/rtas-test.c b/tests/qtest/rtas-test.c index 1ba42b37d2..26c8e8e926 100644 --- a/tests/qtest/rtas-test.c +++ b/tests/qtest/rtas-test.c @@ -36,11 +36,9 @@ static void test_rtas_get_time_of_day_vof(void) int main(int argc, char *argv[]) { - const char *arch = qtest_get_arch(); - g_test_init(&argc, &argv, NULL); - if (strcmp(arch, "ppc64")) { + if (strcmp(qtest_get_base_arch(), "ppc") && qtest_get_arch_bits() != 64) { g_printerr("RTAS requires qemu-system-ppc64\n"); exit(EXIT_FAILURE); } diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c index ed3dbca154..5a5b10b520 100644 --- a/tests/qtest/ufs-test.c +++ b/tests/qtest/ufs-test.c @@ -552,7 +552,6 @@ static void *ufs_blk_test_setup(GString *cmd_line, void *arg) static void ufs_register_nodes(void) { - const char *arch; QOSGraphEdgeOptions edge_opts = { .before_cmd_line = "-blockdev null-co,node-name=drv0,read-zeroes=on", .after_cmd_line = "-device ufs-lu,bus=ufs0,drive=drv0,lun=0", @@ -575,8 +574,7 @@ static void ufs_register_nodes(void) * Check architecture * TODO: Enable ufs io tests for ppc64 */ - arch = qtest_get_arch(); - if (!strcmp(arch, "ppc64")) { + if (!strcmp(qtest_get_base_arch(), "ppc") && qtest_get_arch_bits() == 64) { g_test_message("Skipping ufs io tests for ppc64"); return; } diff --git a/tests/qtest/usb-hcd-uhci-test.c b/tests/qtest/usb-hcd-uhci-test.c index 4446555f08..144a5541f0 100644 --- a/tests/qtest/usb-hcd-uhci-test.c +++ b/tests/qtest/usb-hcd-uhci-test.c @@ -53,7 +53,7 @@ static void test_usb_storage_hotplug(void) int main(int argc, char **argv) { - const char *arch = qtest_get_arch(); + const char *arch = qtest_get_base_arch(); const char *cmd = "-device piix3-usb-uhci,id=uhci,addr=1d.0" " -drive id=drive0,if=none,file=null-co://," "file.read-zeroes=on,format=raw" @@ -73,9 +73,9 @@ int main(int argc, char **argv) qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug); } - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(arch, "x86") == 0) { qs = qtest_pc_boot("%s", cmd); - } else if (strcmp(arch, "ppc64") == 0) { + } else if (strcmp(arch, "ppc") == 0 && qtest_get_arch_bits() == 64) { qs = qtest_spapr_boot("%s", cmd); } else { g_printerr("usb-hcd-uhci-test tests are only " diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c index fab5dd8b05..c37fe36af6 100644 --- a/tests/qtest/virtio-net-test.c +++ b/tests/qtest/virtio-net-test.c @@ -169,7 +169,6 @@ static void hotplug(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtioPCIDevice *dev = obj; QTestState *qts = dev->pdev->bus->qts; - const char *arch = qtest_get_arch(); if (dev->pdev->bus->not_hotpluggable) { g_test_skip("pci bus does not support hotplug"); @@ -179,7 +178,7 @@ static void hotplug(void *obj, void *data, QGuestAllocator *t_alloc) qtest_qmp_device_add(qts, "virtio-net-pci", "net1", "{'addr': %s}", stringify(PCI_SLOT_HP)); - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { qpci_unplug_acpi_device_test(qts, "net1", PCI_SLOT_HP); } } diff --git a/tests/qtest/virtio-rng-test.c b/tests/qtest/virtio-rng-test.c index 64e131cd8c..173f42ff7b 100644 --- a/tests/qtest/virtio-rng-test.c +++ b/tests/qtest/virtio-rng-test.c @@ -25,12 +25,10 @@ static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc) return; } - const char *arch = qtest_get_arch(); - qtest_qmp_device_add(qts, "virtio-rng-pci", "rng1", "{'addr': %s}", stringify(PCI_SLOT_HP)); - if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + if (strcmp(qtest_get_base_arch(), "x86") == 0) { qpci_unplug_acpi_device_test(qts, "rng1", PCI_SLOT_HP); } }