[PATCH 08/16] rust: build tests for the qemu_api crate

Paolo Bonzini posted 16 patches 1 week ago
There is a newer version of this series
[PATCH 08/16] rust: build tests for the qemu_api crate
Posted by Paolo Bonzini 1 week ago
Fix some bitrot in tests.rs, and allow the unit tests to be run via
"meson test".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/qemu-api/meson.build  | 3 +++
 rust/qemu-api/src/tests.rs | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build
index 42ea815fa5a..436e2f1e836 100644
--- a/rust/qemu-api/meson.build
+++ b/rust/qemu-api/meson.build
@@ -5,6 +5,7 @@ _qemu_api_rs = static_library(
       'src/lib.rs',
       'src/definitions.rs',
       'src/device_class.rs',
+      'src/tests.rs',
     ],
     {'.' : bindings_rs},
   ),
@@ -19,6 +20,8 @@ _qemu_api_rs = static_library(
   ],
 )
 
+rust.test('rust-qemu-api-tests', _qemu_api_rs)
+
 qemu_api = declare_dependency(
   link_with: _qemu_api_rs,
 )
diff --git a/rust/qemu-api/src/tests.rs b/rust/qemu-api/src/tests.rs
index df54edbd4e2..f0cd4d5d716 100644
--- a/rust/qemu-api/src/tests.rs
+++ b/rust/qemu-api/src/tests.rs
@@ -43,7 +43,7 @@ pub struct DummyState {
         dummy_class_init,
         props => DUMMY_PROPERTIES,
         realize_fn => None,
-        reset_fn => None,
+        legacy_reset_fn => None,
         vmsd => VMSTATE,
     }
 }
-- 
2.46.2
Re: [PATCH 08/16] rust: build tests for the qemu_api crate
Posted by Zhao Liu 1 day, 7 hours ago
On Tue, Oct 15, 2024 at 03:17:26PM +0200, Paolo Bonzini wrote:
> Date: Tue, 15 Oct 2024 15:17:26 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 08/16] rust: build tests for the qemu_api crate
> X-Mailer: git-send-email 2.46.2
> 
> Fix some bitrot in tests.rs, and allow the unit tests to be run via
> "meson test".
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  rust/qemu-api/meson.build  | 3 +++
>  rust/qemu-api/src/tests.rs | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 

Codes look good to me,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Re: [PATCH 08/16] rust: build tests for the qemu_api crate
Posted by Paolo Bonzini 1 day, 7 hours ago
On Mon, Oct 21, 2024 at 4:35 PM Zhao Liu <zhao1.liu@intel.com> wrote:
>
> On Tue, Oct 15, 2024 at 03:17:26PM +0200, Paolo Bonzini wrote:
> > Date: Tue, 15 Oct 2024 15:17:26 +0200
> > From: Paolo Bonzini <pbonzini@redhat.com>
> > Subject: [PATCH 08/16] rust: build tests for the qemu_api crate
> > X-Mailer: git-send-email 2.46.2
> >
> > Fix some bitrot in tests.rs, and allow the unit tests to be run via
> > "meson test".
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >  rust/qemu-api/meson.build  | 3 +++
> >  rust/qemu-api/src/tests.rs | 2 +-
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> >
>
> Codes look good to me,
>
> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

Note that, in the extracted series (to which I am moving your
Reviewed-by tags, so no need to go through it again), I'm changing
this to an integration test and making it actually create the object
it defines.

Paolo
Re: [PATCH 08/16] rust: build tests for the qemu_api crate
Posted by Zhao Liu 1 day, 6 hours ago
On Mon, Oct 21, 2024 at 04:36:24PM +0200, Paolo Bonzini wrote:
> Date: Mon, 21 Oct 2024 16:36:24 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: Re: [PATCH 08/16] rust: build tests for the qemu_api crate
> 
> On Mon, Oct 21, 2024 at 4:35 PM Zhao Liu <zhao1.liu@intel.com> wrote:
> >
> > On Tue, Oct 15, 2024 at 03:17:26PM +0200, Paolo Bonzini wrote:
> > > Date: Tue, 15 Oct 2024 15:17:26 +0200
> > > From: Paolo Bonzini <pbonzini@redhat.com>
> > > Subject: [PATCH 08/16] rust: build tests for the qemu_api crate
> > > X-Mailer: git-send-email 2.46.2
> > >
> > > Fix some bitrot in tests.rs, and allow the unit tests to be run via
> > > "meson test".
> > >
> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > ---
> > >  rust/qemu-api/meson.build  | 3 +++
> > >  rust/qemu-api/src/tests.rs | 2 +-
> > >  2 files changed, 4 insertions(+), 1 deletion(-)
> > >
> >
> > Codes look good to me,
> >
> > Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
> 
> Note that, in the extracted series (to which I am moving your
> Reviewed-by tags, so no need to go through it again), I'm changing
> this to an integration test and making it actually create the object
> it defines.

Thank you! I mixed up the versions; I will move over to there.



Re: [PATCH 08/16] rust: build tests for the qemu_api crate
Posted by Zhao Liu 1 day, 13 hours ago
On Tue, Oct 15, 2024 at 03:17:26PM +0200, Paolo Bonzini wrote:
> Date: Tue, 15 Oct 2024 15:17:26 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 08/16] rust: build tests for the qemu_api crate
> X-Mailer: git-send-email 2.46.2
> 
> Fix some bitrot in tests.rs, and allow the unit tests to be run via
> "meson test".
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  rust/qemu-api/meson.build  | 3 +++
>  rust/qemu-api/src/tests.rs | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build
> index 42ea815fa5a..436e2f1e836 100644
> --- a/rust/qemu-api/meson.build
> +++ b/rust/qemu-api/meson.build
> @@ -5,6 +5,7 @@ _qemu_api_rs = static_library(
>        'src/lib.rs',
>        'src/definitions.rs',
>        'src/device_class.rs',
> +      'src/tests.rs',
>      ],
>      {'.' : bindings_rs},
>    ),
> @@ -19,6 +20,8 @@ _qemu_api_rs = static_library(
>    ],
>  )
>  
> +rust.test('rust-qemu-api-tests', _qemu_api_rs)
> +

It seems the change will bring a warning for "./configure --enable-rust":

WARNING: Unknown keyword argument(s) in target rust-qemu-api-tests: rust_abi, prelink, pic.
Re: [PATCH 08/16] rust: build tests for the qemu_api crate
Posted by Paolo Bonzini 1 day, 13 hours ago
On Mon, Oct 21, 2024 at 10:50 AM Zhao Liu <zhao1.liu@intel.com> wrote:
> > +rust.test('rust-qemu-api-tests', _qemu_api_rs)
>
> It seems the change will bring a warning for "./configure --enable-rust":
>
> WARNING: Unknown keyword argument(s) in target rust-qemu-api-tests: rust_abi, prelink, pic.

This is a Meson bug, I'll try to fix it.

Paolo