[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 12/40] rust: build integration test for the qemu_api crate
From: |
Paolo Bonzini |
Subject: |
Re: [PULL 12/40] rust: build integration test for the qemu_api crate |
Date: |
Fri, 20 Dec 2024 11:42:09 +0100 |
User-agent: |
Mozilla Thunderbird |
On Thu, Dec 19, 2024 at 12:22 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
On 12/19/24 10:53, Bernhard Beschow wrote:
>
>
> Am 4. November 2024 17:26:51 UTC schrieb Paolo Bonzini <pbonzini@redhat.com>:
>> 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.
>>
>> Reviewed-by: Junjie Mao <junjie.mao@hotmail.com>
>> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> meson.build | 10 ++++-
>> rust/qemu-api/meson.build | 26 ++++++++++--
>> rust/qemu-api/src/lib.rs | 3 --
>> rust/qemu-api/src/tests.rs | 49 ----------------------
>> rust/qemu-api/tests/tests.rs | 78 ++++++++++++++++++++++++++++++++++++
>> 5 files changed, 110 insertions(+), 56 deletions(-)
>> delete mode 100644 rust/qemu-api/src/tests.rs
>> create mode 100644 rust/qemu-api/tests/tests.rs
>
> When `--enable-modules` is passed to configure, this patch results in
numerous undefined symbols.
Thanks for the report... This doesn't seem easy to fix without adding
more hacks on top, but I'll try to do it right.
Which might very well be doing it in Meson. One needs to teach Meson
to add --start-group/--end-group options for rustc just like Meson does
for the C compiler; or alternatively to support "objects: ..." for
Rust executables.
For example, with https://github.com/mesonbuild/meson/pull/14026, the fix
is simply this:
diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build
index 9425ba7100c..0c08d2e51f5 100644
--- a/rust/qemu-api/meson.build
+++ b/rust/qemu-api/meson.build
@@ -59,7 +59,8 @@ test('rust-qemu-api-integration',
rust_args: ['--test'],
install: false,
dependencies: [qemu_api, qemu_api_macros],
- link_whole: [rust_qemu_api_objs, libqemuutil]),
+ link_with: libqemuutil,
+ link_whole: [rust_qemu_api_objs]),
args: [
'--test', '--test-threads', '1',
'--format', 'pretty',
Until then, --enable-modules is broken together with Rust.
Paolo