From: Paolo Bonzini <pbonzini@redhat.com>
To: Junjie Mao <junjie.mao@hotmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Subject: Re: [PATCH 08/13] rust: build integration test for the qemu_api crate
Date: Mon, 21 Oct 2024 12:47:04 +0200 [thread overview]
Message-ID: <CABgObfZ79VZUbwqm_vsYvSGdbk5Fz-b06bf5__b3D+LC9wNfnA@mail.gmail.com> (raw)
In-Reply-To: <SY0P300MB1026A61776DE7025EC7B9F1C95432@SY0P300MB1026.AUSP300.PROD.OUTLOOK.COM>
[-- Attachment #1: Type: text/plain, Size: 2738 bytes --]
Il lun 21 ott 2024, 12:34 Junjie Mao <junjie.mao@hotmail.com> ha scritto:
>
> Paolo Bonzini <pbonzini@redhat.com> writes:
>
> > Adjust the integration test to compile with a subset of QEMU object
> > files, and make it actually create an object of the class it defines.
> >
> > Follow the Rust filesystem conventions, where tests go in tests/ if
> > they use the library in the same way any other code would.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Reviewed-by: Junjie Mao <junjie.mao@hotmail.com>
>
> A few minor comments on cosmetic below.
>
> > ---
> > meson.build | 10 ++++-
> > rust/qemu-api/meson.build | 20 +++++++--
> > rust/qemu-api/src/tests.rs | 49 ----------------------
> > rust/qemu-api/tests/tests.rs | 78 ++++++++++++++++++++++++++++++++++++
> > 4 files changed, 104 insertions(+), 53 deletions(-)
> > delete mode 100644 rust/qemu-api/src/tests.rs
> > create mode 100644 rust/qemu-api/tests/tests.rs
> >
> <snip>
> > diff --git a/rust/qemu-api/tests/tests.rs b/rust/qemu-api/tests/tests.rs
> > new file mode 100644
> > index 00000000000..57bab62772d
> > --- /dev/null
> > +++ b/rust/qemu-api/tests/tests.rs
> > @@ -0,0 +1,78 @@
> > +// Copyright 2024, Linaro Limited
> > +// Author(s): Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +
> > +use core::ffi::CStr;
> > +
> > +use qemu_api::{
> > + bindings::*, declare_properties, define_property,
> > + definitions::Class,
> > + definitions::ObjectImpl,
> > + device_class_init, vm_state_description,
>
> Cargo fmt (with the current rust/rustfmt.toml) formats those lines in a
> different way, and ...
>
I will tweak this.
Paolo
> +};
> > +
> <snip>
> > + impl ObjectImpl for DummyState {
> > + type Class = DummyClass;
> > + const TYPE_INFO: qemu_api::bindings::TypeInfo =
> qemu_api::type_info! { Self };
> > + const TYPE_NAME: &'static CStr = c"dummy";
> > + const PARENT_TYPE_NAME: Option<&'static CStr> =
> Some(TYPE_DEVICE);
> > + const ABSTRACT: bool = false;
> > + const INSTANCE_INIT: Option<unsafe extern "C" fn(obj: *mut
> Object)> = None;
> > + const INSTANCE_POST_INIT: Option<unsafe extern "C" fn(obj: *mut
> Object)> = None;
> > + const INSTANCE_FINALIZE: Option<unsafe extern "C" fn(obj: *mut
> Object)> = None;
> > + }
> > +
> > + impl Class for DummyClass {
> > + const CLASS_INIT: Option<
> > + unsafe extern "C" fn(klass: *mut ObjectClass, data: *mut
> core::ffi::c_void),
> > + > = Some(dummy_class_init);
>
> ... ditto. Shall we tweak the formats here or adjust the rustfmt
> settings later?
>
> --
> Best Regards
> Junjie Mao
>
>
[-- Attachment #2: Type: text/html, Size: 4742 bytes --]
next prev parent reply other threads:[~2024-10-21 10:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 14:42 [PATCH 00/13] rust: miscellaneous cleanups + QOM integration tests Paolo Bonzini
2024-10-18 14:42 ` [PATCH 01/13] meson: import rust module into a global variable Paolo Bonzini
2024-10-18 14:42 ` [PATCH 02/13] meson: remove repeated search for rust_root_crate.sh Paolo Bonzini
2024-10-18 14:42 ` [PATCH 03/13] meson: pass rustc_args when building all crates Paolo Bonzini
2024-10-18 14:42 ` [PATCH 04/13] rust: do not use --no-size_t-is-usize Paolo Bonzini
2024-10-18 14:42 ` [PATCH 05/13] rust: remove uses of #[no_mangle] Paolo Bonzini
2024-10-21 10:07 ` Junjie Mao
2024-10-18 14:42 ` [PATCH 06/13] rust: remove unused macro module_init! Paolo Bonzini
2024-10-21 10:16 ` Junjie Mao
2024-10-21 10:46 ` Paolo Bonzini
2024-10-18 14:42 ` [PATCH 07/13] rust: modernize #[derive(Object)] for ELF platforms Paolo Bonzini
2024-10-21 10:23 ` Junjie Mao
2024-10-18 14:43 ` [PATCH 08/13] rust: build integration test for the qemu_api crate Paolo Bonzini
2024-10-21 10:28 ` Junjie Mao
2024-10-21 10:47 ` Paolo Bonzini [this message]
2024-10-21 11:28 ` Junjie Mao
2024-10-21 11:43 ` Paolo Bonzini
2024-10-21 11:51 ` Junjie Mao
2024-10-21 13:02 ` Paolo Bonzini
2024-10-18 14:43 ` [PATCH 09/13] rust: clean up define_property macro Paolo Bonzini
2024-10-21 10:35 ` Junjie Mao
2024-10-21 10:44 ` Paolo Bonzini
2024-10-21 11:37 ` Junjie Mao
2024-10-18 14:43 ` [PATCH 10/13] qdev: make properties array "const" Paolo Bonzini
2024-10-18 14:43 ` [PATCH 11/13] rust: make properties array immutable Paolo Bonzini
2024-10-21 11:42 ` Junjie Mao
2024-10-18 14:43 ` [PATCH 12/13] rust: provide safe wrapper for MaybeUninit::zeroed() Paolo Bonzini
2024-10-21 11:46 ` Junjie Mao
2024-10-18 14:43 ` [PATCH 13/13] rust: do not use TYPE_CHARDEV unnecessarily Paolo Bonzini
2024-10-21 11:48 ` Junjie Mao
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=CABgObfZ79VZUbwqm_vsYvSGdbk5Fz-b06bf5__b3D+LC9wNfnA@mail.gmail.com \
--to=pbonzini@redhat.com \
--cc=junjie.mao@hotmail.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=qemu-devel@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).