From nobody Sun Sep 28 17:04:55 2025 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1758863916; cv=none; d=zohomail.com; s=zohoarc; b=Xyw1BFUxDnP3G1tUVUakjuuleXvsPrICkeMnHeUWJgO/rjxJ2j7jEa+7HsFfIGJUJKz/hV9WaZ6FYI81v/aocWenxd0M3iBa0eUnfQgTNj5PaGTqH8FgJ47NCBkcDjjDvzzFQQ5nLRE61Y/AuJjvGVifYsu3a6QURkLMhuQhFYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758863916; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ErpjM5v///jsQEmH//OMXKSRg7T93UzIYGTiGLLhSpc=; b=GG8czyBaZFwnENDb+l4qU56uCgZ0Rgg7aG4Z56iejeLaJkDP8gFs6XWAmr57t0Ba5d3se76WBnux+GeQcp8iBBVwLRVzILb9JTV8v5YJ99i2CX11AEOMuTlPMqXlhF0lU17vT+L3h3GxzGZoOHw7DxDiZUvjHEVC7RNLYHvymvE= 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+importer=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 1758863916588493.82473813745753; Thu, 25 Sep 2025 22:18:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v20p5-0004qG-FF; Fri, 26 Sep 2025 01:16:47 -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 1v20os-0004kV-23 for qemu-devel@nongnu.org; Fri, 26 Sep 2025 01:16:35 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v20oi-00060B-1V for qemu-devel@nongnu.org; Fri, 26 Sep 2025 01:16:33 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-b5565f0488bso1244075a12.2 for ; Thu, 25 Sep 2025 22:16:18 -0700 (PDT) Received: from gromero0.. (189-47-45-49.dsl.telesp.net.br. [189.47.45.49]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed672a51fsm42160085ad.63.2025.09.25.22.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 22:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1758863775; x=1759468575; 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=ErpjM5v///jsQEmH//OMXKSRg7T93UzIYGTiGLLhSpc=; b=nMryvUoaMxaTTO6jqTBDLADTLhXmYoN5YQvl3H77qgorOGSv/ND+7+1KyvewOD2K4E /J7hJ+b3CZG/1MLDZZWzEuvtvpcwt2P5jQ+Jhz3suPUuRyL3V4PUDFU8RAeK72nsj7JY +ire1igJomlxadvUMB+xplUqeI3zgNWoz5TU4UoKaOUKyvQLuXwi7rAOHTEyNec+LKpq rflYhJTiQT79JZjZ9y0eQ4NHIBBdpc270QDMXWYSdKZONxLYPQxnxWtkqxHjKS33s3rC +P72xCmUIxlxp2yGevjzRdfuQ1Q65BGDvb/pIVZDEgfc7wBunWUoCXzfC6MqznDGXfks 4UgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758863775; x=1759468575; 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=ErpjM5v///jsQEmH//OMXKSRg7T93UzIYGTiGLLhSpc=; b=YFSsIsTsEfTI99DvCQy9qH07IJZ7gJERSFvRQTt+69WTUgQNUnfIvT3XaFyh60A5Fj T1s2f+44+xvSEgtriBWenHqm/9tmGE8UFCtwJ9rb/DNx3bZLVDid5T/mv77t0QZx0X4b ws3c29UOmzsIegXlRh2nJ3WFYwFY7d+IgsuSWFWpctQXtIuAUx9XPmZf3Hkux9nCL/mv 3dE0GWiiJ99fqq4O4b+/IcufF7dvD7AlqiWaL2UzLLDgqywmwa8+ZwD1hgKhymEXQ+a/ l++4/ui3DxqRWx4f6JSGx2XBRxCJD5UTcFvYI5u9Z2sIL/jucnkkTNI3/e0EE3K5MK+N eadQ== X-Gm-Message-State: AOJu0YwafCI7oIp2p9uR9T4eEfSdE1/vZ5nTKSmH+AR7ksQJCi+U/vsX yLyu44ICzTSvIfsyRvK1rytIZ/kbfQtUzSS6DjbY3edADczykbCVf3LphYVsO171QPICnbSJsPo rItJG X-Gm-Gg: ASbGnctaefIGY1+QjDHf1s079F/Gcysg2V69WoXu7DuMyiYBM35WWMzKCMk1xe83LBU iuZMU4ymrrRtjzwN4+VwuxXWxW5+WEUZhgJkUB6rTlsDTWpvH9AkQcWODex9PQ8vMsuC9R0NUAC Bvk1Zctn2NTV6mSBJ1hI1H5LVSmZ271tVXM87lJ60IOdU9aZDbKYfTG9f7YWllrlDJLYvl1n5ZJ 7foAL+Ps0e1RcDuaCvyfZwulr4D5llRIkAIeq/fCbGqkn9FTSdduwwhnBtoehyuXuY3+DmVy9Pk 06SEinYzMRDxG7M3T+PHlItDF7GrtQC4X0FMl9hZuxzLT9zTF3+wLtuvsHRFM3sTC/p87vX3wp3 S48hzrViYH7sWTONiZ+HYHzAE7AMNCCvO2tzqdOIODjpDFiNuIjbQU1hpTIX/CP1yhKqg X-Google-Smtp-Source: AGHT+IFRyPVOrEnEpQLIMDsrPcD3BrCW77aiKC4vjEC+82B5VTCizBN4m4Qj99MITrhmBs7V4SW/Aw== X-Received: by 2002:a17:902:ced2:b0:271:ac7a:8f18 with SMTP id d9443c01a7336-27ed4a9615cmr78110225ad.43.1758863774712; Thu, 25 Sep 2025 22:16:14 -0700 (PDT) From: Gustavo Romero To: qemu-devel@nongnu.org, alex.bennee@linaro.org, thuth@redhat.com, berrange@redhat.com Cc: qemu-arm@nongnu.org, gustavo.romero@linaro.org, manos.pitsidianakis@linaro.org, peter.maydell@linaro.org Subject: [PATCH v4 3/9] tests/functional: Provide GDB to the functional tests Date: Fri, 26 Sep 2025 05:15:36 +0000 Message-Id: <20250926051542.104432-4-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250926051542.104432-1-gustavo.romero@linaro.org> References: <20250926051542.104432-1-gustavo.romero@linaro.org> 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=gustavo.romero@linaro.org; helo=mail-pg1-x52d.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1758863918801116600 Content-Type: text/plain; charset="utf-8" The probe of GDB is done in 'configure' and the full path is passed to meson.build via the -Dgdb=3Doption. Because a single functional test can cover different arches, such as aarch64, ppc64, and x86_64, only a GDB that supports all the arches in the target list is passed to Meson for use in the functional tests. To handle this check, a new shell function, is_target_arch_in_arch_list, is introduced in 'configure'. Meson then can pass the location of GDB to the test via an environment variable: QEMU_TEST_GDB. Signed-off-by: Gustavo Romero Signed-off-by: Thomas Huth --- configure | 21 +++++++++++++++++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 2 ++ tests/functional/meson.build | 6 ++++++ 4 files changed, 31 insertions(+) diff --git a/configure b/configure index 0f7eb95586..20e05d233f 100755 --- a/configure +++ b/configure @@ -1142,12 +1142,31 @@ fi ######################################### # gdb test =20 +# Check if all target arches are in a provided list of arches. +is_target_arch_in_arch_list() { + arch_list=3D$1 + for target in $target_list; do + arch=3D${target%%-*} + if test "${arch_list#*$arch}" =3D "$arch_list"; then + # Target arch not in arch list + return 1 + fi + done + return 0 +} + if test -n "$gdb_bin"; then gdb_version_string=3D$($gdb_bin --version | head -n 1) # Extract last field in the version string gdb_version=3D${gdb_version_string##* } if version_ge $gdb_version 9.1; then gdb_arches=3D$($python "$source_path/scripts/probe-gdb-support.py"= $gdb_bin) + + if is_target_arch_in_arch_list "$gdb_arches"; then + gdb_multiarch=3D"yes" + else + gdb_multiarch=3D"" + fi else gdb_bin=3D"" fi @@ -1984,6 +2003,8 @@ if test "$skip_meson" =3D no; then test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engin= e=3D$LIB_FUZZING_ENGINE" test "$plugins" =3D yes && meson_option_add "-Dplugins=3Dtrue" test "$tcg" !=3D enabled && meson_option_add "-Dtcg=3D$tcg" + test "$gdb_multiarch" =3D yes && meson_option_add "-Dgdb=3D$gdb_bin" + run_meson() { NINJA=3D$ninja $meson setup "$@" "$PWD" "$source_path" } diff --git a/meson_options.txt b/meson_options.txt index fff1521e58..5bb41bcbc4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -36,6 +36,8 @@ option('trace_file', type: 'string', value: 'trace', option('coroutine_backend', type: 'combo', choices: ['ucontext', 'sigaltstack', 'windows', 'wasm', 'auto'], value: 'auto', description: 'coroutine backend to use') +option('gdb', type: 'string', value: '', + description: 'Path to GDB') =20 # Everything else can be set via --enable/--disable-* option # on the configure script command line. After adding an option diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 0ebe6bc52a..f4bd21220e 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -58,6 +58,7 @@ meson_options_help() { printf "%s\n" ' --enable-ubsan enable undefined behaviour san= itizer' printf "%s\n" ' --firmwarepath=3DVALUES search PATH for firmware fil= es [share/qemu-' printf "%s\n" ' firmware]' + printf "%s\n" ' --gdb=3DVALUE Path to GDB' printf "%s\n" ' --iasl=3DVALUE Path to ACPI disassembler' printf "%s\n" ' --includedir=3DVALUE Header file directory [inclu= de]' printf "%s\n" ' --interp-prefix=3DVALUE where to find shared librari= es etc., use %M for' @@ -323,6 +324,7 @@ _meson_option_parse() { --disable-fuzzing) printf "%s" -Dfuzzing=3Dfalse ;; --enable-gcrypt) printf "%s" -Dgcrypt=3Denabled ;; --disable-gcrypt) printf "%s" -Dgcrypt=3Ddisabled ;; + --gdb=3D*) quote_sh "-Dgdb=3D$2" ;; --enable-gettext) printf "%s" -Dgettext=3Denabled ;; --disable-gettext) printf "%s" -Dgettext=3Ddisabled ;; --enable-gio) printf "%s" -Dgio=3Denabled ;; diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 2a0c5aa141..725630d308 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -77,6 +77,12 @@ foreach speed : ['quick', 'thorough'] test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + meson.current_source_dir()) =20 + # Define the GDB environment variable if gdb is available. + gdb =3D get_option('gdb') + if gdb !=3D '' + test_env.set('QEMU_TEST_GDB', gdb) + endif + foreach test : target_tests testname =3D '@0@-@1@'.format(target_base, test) if fs.exists('generic' / 'test_' + test + '.py') --=20 2.34.1