From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-rust@nongnu.org
Subject: [PATCH 2/3] rust: add qemu-api doctests to "meson test"
Date: Sat, 5 Apr 2025 12:06:02 +0200 [thread overview]
Message-ID: <20250405100603.253421-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20250405100603.253421-1-pbonzini@redhat.com>
Doctest 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.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
.gitlab-ci.d/buildtest.yml | 5 -----
rust/qemu-api/meson.build | 11 +++++++++++
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 00f4bfcd9f3..088d5683c88 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -131,12 +131,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
allow_failure: true
diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build
index 8fa41c0a95e..ede6e14e5e0 100644
--- a/rust/qemu-api/meson.build
+++ b/rust/qemu-api/meson.build
@@ -53,6 +53,17 @@ rust.test('rust-qemu-api-tests', _qemu_api_rs,
qemu_api = declare_dependency(link_with: [_qemu_api_rs],
dependencies: [qemuutil_rs, qemu_api_macros, qom, hwcore, chardev, migration])
+# Doctests are essentially integration tests, so they need the same "depends" as
+# below and cannot be run with "cargo test --doc". Developer tools are only
+# supported for versions 1.74.0 or newer of Rust.
+if rustc.version().version_compare('>=1.74.0')
+ rust.doctest('rust-qemu-api-doctests',
+ _qemu_api_rs,
+ protocol: 'rust',
+ dependencies: qemu_api,
+ suite: ['doc', 'rust'])
+endif
+
test('rust-qemu-api-integration',
executable(
'rust-qemu-api-integration',
--
2.49.0
next prev parent reply other threads:[~2025-04-05 10:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-05 10:06 [PATCH preview 0/3] rust: update build system for Meson 1.8.0 Paolo Bonzini
2025-04-05 10:06 ` [PATCH 1/3] rust: use "objects" for Rust executables as well Paolo Bonzini
2025-04-05 10:06 ` Paolo Bonzini [this message]
2025-04-05 10:06 ` [PATCH 3/3] rust: cell: remove support for running doctests with "cargo test --doc" Paolo Bonzini
2025-04-05 12:23 ` [PATCH 4/3] rust: use native Meson support for clippy and rustdoc Paolo Bonzini
2025-04-07 7:37 ` [PATCH preview 0/3] rust: update build system for Meson 1.8.0 Zhao Liu
2025-04-07 7:51 ` Paolo Bonzini
2025-04-08 20:34 ` Bernhard Beschow
2025-04-08 21:08 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250405100603.253421-3-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).