mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
unit tests: Fix unit tests and docs for AArch64
Currently, not every feature of the cloud-hypervisor is enabled on AArch64, which means that on AArch64 machines, the `run_unit_tests.sh` needs to be tailored and some unit test cases should be run on x86_64 only. Also this commit fixes the typo and unifies `Arm64` and `AArch64` in the AArch64 document. Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
@@ -28,16 +28,26 @@ fn pagesize() -> usize {
|
||||
/// # Example - Use the `SystemAddress` builder.
|
||||
///
|
||||
/// ```
|
||||
/// # #[cfg(target_arch = "x86_64")]
|
||||
/// # use vm_allocator::{GsiApic, SystemAllocator};
|
||||
/// # #[cfg(target_arch = "aarch64")]
|
||||
/// # use vm_allocator::SystemAllocator;
|
||||
/// # use vm_memory::{Address, GuestAddress, GuestUsize};
|
||||
/// let mut allocator = SystemAllocator::new(
|
||||
/// GuestAddress(0x1000), 0x10000,
|
||||
/// #[cfg(target_arch = "x86_64")] GuestAddress(0x1000),
|
||||
/// #[cfg(target_arch = "x86_64")] 0x10000,
|
||||
/// GuestAddress(0x10000000), 0x10000000,
|
||||
/// GuestAddress(0x20000000), 0x100000,
|
||||
/// vec![GsiApic::new(5, 19)]).unwrap();
|
||||
/// assert_eq!(allocator.allocate_irq(), Some(5));
|
||||
/// assert_eq!(allocator.allocate_irq(), Some(6));
|
||||
/// assert_eq!(allocator.allocate_mmio_addresses(None, 0x1000, Some(0x1000)), Some(GuestAddress(0x1fff_f000)));
|
||||
/// #[cfg(target_arch = "x86_64")] vec![GsiApic::new(5, 19)]).unwrap();
|
||||
/// #[cfg(target_arch = "x86_64")]
|
||||
/// assert_eq!(allocator.allocate_irq(), Some(5));
|
||||
/// #[cfg(target_arch = "aarch64")]
|
||||
/// assert_eq!(allocator.allocate_irq(), Some(32));
|
||||
/// #[cfg(target_arch = "x86_64")]
|
||||
/// assert_eq!(allocator.allocate_irq(), Some(6));
|
||||
/// #[cfg(target_arch = "aarch64")]
|
||||
/// assert_eq!(allocator.allocate_irq(), Some(33));
|
||||
/// assert_eq!(allocator.allocate_mmio_addresses(None, 0x1000, Some(0x1000)), Some(GuestAddress(0x1fff_f000)));
|
||||
///
|
||||
/// ```
|
||||
pub struct SystemAllocator {
|
||||
|
||||
Reference in New Issue
Block a user