mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
rust/vmstate: Add unit test for vmstate_of macro
The vmstate has too many combinations of VMStateFlags and VMStateField. Currently, the best way to test is to ensure that the Rust vmstate definition is consistent with the (possibly corresponding) C version. Add a unit test to cover some patterns accepted by vmstate_of macro, which correspond to the following C version macros: * VMSTATE_U16 * VMSTATE_UNUSED * VMSTATE_VARRAY_UINT16_UNSAFE * VMSTATE_VARRAY_MULTIPLY Note: Because vmstate_info_* are defined in vmstate-types.c, it's necessary to link libmigration to rust unit tests. In the future, maybe it's possible to spilt libmigration from rust_qemu_api_objs. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250318130219.1799170-12-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b131003721
commit
1998502196
3 changed files with 139 additions and 2 deletions
|
@ -58,7 +58,8 @@ rust_qemu_api_objs = static_library(
|
|||
libchardev.extract_all_objects(recursive: false),
|
||||
libcrypto.extract_all_objects(recursive: false),
|
||||
libauthz.extract_all_objects(recursive: false),
|
||||
libio.extract_all_objects(recursive: false)])
|
||||
libio.extract_all_objects(recursive: false),
|
||||
libmigration.extract_all_objects(recursive: false)])
|
||||
rust_qemu_api_deps = declare_dependency(
|
||||
dependencies: [
|
||||
qom_ss.dependencies(),
|
||||
|
@ -71,7 +72,7 @@ rust_qemu_api_deps = declare_dependency(
|
|||
test('rust-qemu-api-integration',
|
||||
executable(
|
||||
'rust-qemu-api-integration',
|
||||
'tests/tests.rs',
|
||||
files('tests/tests.rs', 'tests/vmstate_tests.rs'),
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_args: ['--test'],
|
||||
install: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue