All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] rust: add Derive macro unit tests
@ 2025-07-04 10:26 Manos Pitsidianakis
  2025-07-04 10:26 ` [PATCH 1/2] rust/qemu-api-macros: normalize TryInto output Manos Pitsidianakis
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Manos Pitsidianakis @ 2025-07-04 10:26 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-rust, Alex Bennée, Paolo Bonzini, Zhao Liu,
	Manos Pitsidianakis

We don't currently test our proc macros and it'd be nice to do so.

Usually this would be done with something like
https://crates.io/crates/trybuild which runs cargo and tries to compile
a test input, and checks for success/failure. However we cannot use it
with meson directly, plus it would drag in a lot of dependencies anyway.

Instead of compiling, we can easily just expand test input into token
streams since we already split macro implementation into separate
functions, allowing us to either get a TokenStream back or a compile
error message.

You can run the added tests directly with this meson command:

  meson test rust-qemu-api-macros-tests

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
---
Manos Pitsidianakis (2):
      rust/qemu-api-macros: normalize TryInto output
      rust/qemu-api-macros: add unit tests

 rust/qemu-api-macros/meson.build  |   3 +
 rust/qemu-api-macros/src/lib.rs   |   7 +-
 rust/qemu-api-macros/src/tests.rs | 135 ++++++++++++++++++++++++++++++++++++++
 rust/qemu-api-macros/src/utils.rs |   1 +
 4 files changed, 144 insertions(+), 2 deletions(-)
---
base-commit: c77283dd5d79149f4e7e9edd00f65416c648ee59
change-id: 20250704-rust_add_derive_macro_unit_tests-3e7daf905d62

--
γαῖα πυρί μιχθήτω



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-07-08 20:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-04 10:26 [PATCH 0/2] rust: add Derive macro unit tests Manos Pitsidianakis
2025-07-04 10:26 ` [PATCH 1/2] rust/qemu-api-macros: normalize TryInto output Manos Pitsidianakis
2025-07-04 12:16   ` Zhao Liu
2025-07-04 10:26 ` [PATCH 2/2] rust/qemu-api-macros: add unit tests Manos Pitsidianakis
2025-07-04 12:37   ` Zhao Liu
2025-07-04 12:35 ` [PATCH 0/2] rust: add Derive macro " Zhao Liu
2025-07-04 12:18   ` Manos Pitsidianakis
2025-07-08  9:59 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.