rust: build integration test for the qemu_api crate

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>
This commit is contained in:
Paolo Bonzini 2024-10-18 16:30:56 +02:00
parent 4f7521916d
commit cde3c425d1
5 changed files with 110 additions and 56 deletions

View file

@ -3345,7 +3345,15 @@ if have_rust and have_system
# Prohibit code that is forbidden in Rust 2024
rustc_args += ['-D', 'unsafe_op_in_unsafe_fn']
add_project_arguments(rustc_args, native: false, language: 'rust')
# Apart from procedural macros, our Rust executables will often link
# with C code, so include all the libraries that C code needs. This
# is safe; https://github.com/rust-lang/rust/pull/54675 says that
# passing -nodefaultlibs to the linker "was more ideological to
# start with than anything".
add_project_arguments(rustc_args + ['-C', 'default-linker-libraries'],
native: false, language: 'rust')
add_project_arguments(rustc_args, native: true, language: 'rust')
endif