From nobody Sat Nov 15 19:02:43 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748365589; cv=none; d=zohomail.com; s=zohoarc; b=A9XeVzv0cSq43SqqbMgf+si/kqkJuUtBVmMg1eXhmxi+htYY6ffL0Cj33of2rVna6QkSClTShqiLM7pw1O26qv27dxn689SQQCFxwS4y6oMy0g+MiTEhPS5iKtq/KujCxd9OhvsvU3CTqygfbj07f4nNF6TSShPrSFawUYhFwPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748365589; 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=P8BpKjEJltmzcm/OLNaNl+hh0ixQXBWzKCZWpkn3gDY=; b=Om4dF1FxijYdPgTfsHa4qiKCM05MGTR+OY97w0nObTlk9sTbhXISe1YYYT994zIap3KtABTtfwyvibIeBSrtnKiz8rqrFzKBq+FCFpwlQXSt93Wewfz3fyB6rS0nT8sAONJJoLWt3kSQ87Wa+t1tM8nIi0d4YWIzMB8QfzoSZUo= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748365589307834.0122942043087; Tue, 27 May 2025 10:06:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uJxj0-0005hy-Vp; Tue, 27 May 2025 13:04:27 -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 1uJxiy-0005gZ-NY for qemu-devel@nongnu.org; Tue, 27 May 2025 13:04:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uJxiw-0006hk-Su for qemu-devel@nongnu.org; Tue, 27 May 2025 13:04:24 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-4bXJiNk-Ol27uMS0vmdbEw-1; Tue, 27 May 2025 13:04:20 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-ad51ceda1d9so3651566b.1 for ; Tue, 27 May 2025 10:04:16 -0700 (PDT) Received: from [192.168.122.1] ([151.95.46.79]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad8954b1601sm84478766b.64.2025.05.27.10.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 10:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748365462; h=from:from:reply-to:subject:subject: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=P8BpKjEJltmzcm/OLNaNl+hh0ixQXBWzKCZWpkn3gDY=; b=KVzQMfAQ1IIPnC3nL2QfveK9ekMpvk0TZb9goDFwW/k9vuYQM19z1UNKeg4vJkRup7wx50 DfQQmlCtt9IBIMUSvFnPAHVXzZlD44fU/nre46choWYBGKj5ZrY3N1Hryw1HqdQOYs+peK qiuZ2JdNUowKkm9KBWrrbJ2ACEj7I5c= X-MC-Unique: 4bXJiNk-Ol27uMS0vmdbEw-1 X-Mimecast-MFC-AGG-ID: 4bXJiNk-Ol27uMS0vmdbEw_1748365456 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748365455; x=1748970255; 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=P8BpKjEJltmzcm/OLNaNl+hh0ixQXBWzKCZWpkn3gDY=; b=dwr1QQ/rxdzrLNCHiRxPhUJQtwBKmpF3i+vcSxIuU+Zp7n7Ii/iXgmisElw7VD97NS 9cS7GAYlggflmx+XekFs2ajjQkdo4Uj/zBpXVjagtkxCZ0ZRs3wPHiGnx6Ag4Q909uOY gKMcpcNqeK6mD22CQxLVQ0AabrxKBC6pCe+i//cCAyEtlBTKnxThP0gxKm/d02wM2gML 7/tGZyWDEM5RjSlSmHJUtUwor7xq4WS8ADOqP4RKazrYNRUY9NMnOO/K3aAGFupPQkZt zFXVZtEwoFui99V4+RwmreH/xwBSlCiR/SnHStjRnmNxd6TYXarE9kgrbjY2MYKOf0qQ 4oSg== X-Gm-Message-State: AOJu0Yz8z4Qlx8q3yPN2MjAevTPJK2j35M05ba7x+yNbKQo5as5IkTdA UuooPpxQc+oOmlKe5zi05pCOYBaOSGN9EenPAmAJY7ioZSNpCmO7n57oPIRAyP7n14btij1CQiO WUHL5bP2C7thCBC//SCZM4qKZmV2kVO/aPvrSl78/ZLr8s/VNJNPc96axwQtrOiGGowXVKtOXNj U1VGHZDw89xptHULdMI/0TF7rLWgumpOTnaV/yvirA X-Gm-Gg: ASbGncsuRk3AUiO+SXsKcEpYnQBjCIWZ+HdVIjH1T9rqa2eUQ+OMes6uuSkqLrG340I HvpFhUJBzvQx84Uq5TwwUc3A/N6QDsa1DgzKM3eDahrrdrthACgmaZMTiCZTTo+JscjxOnG68MT KR/EwK22KRv9DKzUG8y1pv8P/voldsPAVw09nsEYe3TLKxywpaU5DWC4SWgwQjkKszpFxcCUt81 UvqZrKxBYREm8NTVmiPG7zDkK3e9CE/WWMHIWopbuqKZE5UFejU7Shgb9dSsfHB0Yj6YAV0ucQq dIP2Uk4PF2vcKQ== X-Received: by 2002:a17:907:c1e:b0:ad8:55d8:38b7 with SMTP id a640c23a62f3a-ad89888d678mr161594266b.7.1748365455260; Tue, 27 May 2025 10:04:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0deVlRLi5YZvAYmuPNc+rsjSmR4hrl2Qq6DmZN5KnWkgeeSH+5FB9M1l5cPVAl4NLDtac2Q== X-Received: by 2002:a17:907:c1e:b0:ad8:55d8:38b7 with SMTP id a640c23a62f3a-ad89888d678mr161588866b.7.1748365454765; Tue, 27 May 2025 10:04:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-rust@nongnu.org Subject: [PATCH 4/6] rust: add qemu-api doctests to "meson test" Date: Tue, 27 May 2025 19:04:02 +0200 Message-ID: <20250527170404.1580482-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527170404.1580482-1-pbonzini@redhat.com> References: <20250527170404.1580482-1-pbonzini@redhat.com> 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=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1748365591083116600 Content-Type: text/plain; charset="utf-8" Doctests are weird. They are essentially integration tests, but they're "ran" by executing rustdoc --test, which takes a compiler-ish command line. This is supported by Meson 1.8.0. Because they run the linker and need all the .o files, run them in the build jobs rather than the test jobs. Signed-off-by: Paolo Bonzini --- docs/devel/rust.rst | 2 ++ .gitlab-ci.d/buildtest-template.yml | 3 ++- .gitlab-ci.d/buildtest.yml | 11 +++-------- rust/qemu-api/meson.build | 9 +++++++++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/devel/rust.rst b/docs/devel/rust.rst index 11328c05b45..f66f2bef60b 100644 --- a/docs/devel/rust.rst +++ b/docs/devel/rust.rst @@ -66,6 +66,8 @@ be run via ``meson test`` or ``make``:: =20 make check-rust =20 +Note that doctests require all ``.o`` files from the build to be available. + Supported tools ''''''''''''''' =20 diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-t= emplate.yml index 118371e377d..fea4e8da2f1 100644 --- a/.gitlab-ci.d/buildtest-template.yml +++ b/.gitlab-ci.d/buildtest-template.yml @@ -76,7 +76,8 @@ fi - section_end buildenv - section_start test "Running tests" - - $MAKE NINJA=3D":" $MAKE_CHECK_ARGS + # doctests need all the compilation artifacts + - $MAKE NINJA=3D":" MTESTARGS=3D"--no-suite doc" $MAKE_CHECK_ARGS - section_end test =20 .native_test_job_template: diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 248aaed1370..0fdde54bf8e 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -41,7 +41,7 @@ build-system-ubuntu: IMAGE: ubuntu2204 CONFIGURE_ARGS: --enable-docs --enable-rust TARGETS: alpha-softmmu microblazeel-softmmu mips64el-softmmu - MAKE_CHECK_ARGS: check-build + MAKE_CHECK_ARGS: check-build check-doc =20 check-system-ubuntu: extends: .native_test_job_template @@ -115,7 +115,7 @@ build-system-fedora: CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs --enabl= e-crypto-afalg --enable-rust TARGETS: microblaze-softmmu mips-softmmu xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-soft= mmu - MAKE_CHECK_ARGS: check-build + MAKE_CHECK_ARGS: check-build check-doc =20 build-system-fedora-rust-nightly: extends: @@ -127,12 +127,7 @@ build-system-fedora-rust-nightly: IMAGE: fedora-rust-nightly CONFIGURE_ARGS: --disable-docs --enable-rust --enable-strict-rust-lints TARGETS: aarch64-softmmu - MAKE_CHECK_ARGS: check-build - after_script: - - source scripts/ci/gitlab-ci-section - - section_start test "Running Rust doctests" - - cd build - - pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} test --doc -p qemu= _api + MAKE_CHECK_ARGS: check-build check-doc =20 allow_failure: true =20 diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build index c647493f712..10e8210f30f 100644 --- a/rust/qemu-api/meson.build +++ b/rust/qemu-api/meson.build @@ -44,6 +44,15 @@ rust.test('rust-qemu-api-tests', _qemu_api_rs, qemu_api =3D declare_dependency(link_with: [_qemu_api_rs], dependencies: [qemuutil_rs, qemu_api_macros, qom, hwcore, chardev, migra= tion]) =20 +# Doctests are essentially integration tests, so they need the same depend= encies. +# Note that running them requires the object files for C code, so place th= em +# in a separate suite that is run by the "build" CI jobs rather than "chec= k". +rust.doctest('rust-qemu-api-doctests', + _qemu_api_rs, + protocol: 'rust', + dependencies: qemu_api, + suite: ['doc', 'rust']) + test('rust-qemu-api-integration', executable( 'rust-qemu-api-integration', --=20 2.49.0