diff mbox series

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

Message ID 20241015131735.518771-9-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series rust: allow older versions of rustc and bindgen | expand

Commit Message

Paolo Bonzini Oct. 15, 2024, 1:17 p.m. UTC
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(-)

Comments

Paolo Bonzini Oct. 21, 2024, 8:51 a.m. UTC | #1
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
Zhao Liu Oct. 21, 2024, 9:07 a.m. UTC | #2
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.
Paolo Bonzini Oct. 21, 2024, 2:36 p.m. UTC | #3
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
Zhao Liu Oct. 21, 2024, 2:51 p.m. UTC | #4
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>
Zhao Liu Oct. 21, 2024, 4:04 p.m. UTC | #5
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.
diff mbox series

Patch

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,
     }
 }