tests: streamline module names to unit_tests
This better aligns with the rest of the code and makes it clearer that these tests can run "as is" in a normal hosted environments without the special test environment. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
parent
c990f1bdaa
commit
d1680b9ff9
53 changed files with 59 additions and 59 deletions
|
|
@ -192,7 +192,7 @@ pub fn get_host_cpu_phys_bits(hypervisor: &dyn hypervisor::Hypervisor) -> u8 {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ pub fn get_host_cpu_phys_bits(_hypervisor: &dyn hypervisor::Hypervisor) -> u8 {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1428,7 +1428,7 @@ fn update_cpuid_topology(
|
|||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use linux_loader::loader::bootparam::boot_e820_entry;
|
||||
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ pub fn setup_mptable(
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use vm_memory::bitmap::BitmapSlice;
|
||||
use vm_memory::{GuestUsize, VolatileMemoryError, VolatileSlice, WriteVolatile};
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ pub fn configure_segments_and_sregs(
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use vm_memory::GuestAddress;
|
||||
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ pub fn setup_smbios(
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ impl TdHob {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1815,7 +1815,7 @@ pub fn detect_image_type(file: &mut RawFile) -> Result<ImageType> {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ impl<T: Cacheable> CacheMap<T> {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
struct NumCache(());
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ pub fn is_fixed_vhd(f: &mut File) -> std::io::Result<bool> {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::fs::File;
|
||||
use std::io::{Seek, SeekFrom, Write};
|
||||
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ impl BusDevice for FwCfg {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::ffi::CString;
|
||||
use std::io::Write;
|
||||
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ impl Transportable for Gpio {}
|
|||
impl Migratable for Gpio {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use vm_device::interrupt::{InterruptIndex, InterruptSourceConfig};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ impl BusDevice for Rtc {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
read_be_u16, read_be_u32, read_le_i32, read_le_u16, read_le_u64, write_be_u16,
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ impl Transportable for Serial {}
|
|||
impl Migratable for Serial {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::sync::Mutex;
|
||||
|
||||
use vm_device::interrupt::{InterruptIndex, InterruptSourceConfig};
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ impl Transportable for Pl011 {}
|
|||
impl Migratable for Pl011 {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::sync::Mutex;
|
||||
|
||||
use vm_device::interrupt::{InterruptIndex, InterruptSourceConfig};
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ impl BusDevice for Tpm {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use std::sync::Arc;
|
|||
|
||||
use libfuzzer_sys::{fuzz_target, Corpus};
|
||||
use seccompiler::SeccompAction;
|
||||
use virtio_devices::vsock::tests::TestBackend;
|
||||
use virtio_devices::vsock::unit_tests::TestBackend;
|
||||
use virtio_devices::{VirtioDevice, VirtioInterrupt, VirtioInterruptType};
|
||||
use virtio_queue::{Queue, QueueT};
|
||||
use vm_memory::bitmap::AtomicBitmap;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ impl<T: CpuStateManager> InstructionHandler<T> for Cmp_rm64_imm8 {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
use crate::arch::x86::emulator::mock_vmm::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ impl<T: CpuStateManager> InstructionHandler<T> for Mov_RAX_moffs64 {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
use crate::arch::x86::emulator::mock_vmm::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ impl<T: CpuStateManager> InstructionHandler<T> for Movsb_m8_m8 {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
use crate::arch::x86::emulator::mock_vmm::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ impl<T: CpuStateManager> InstructionHandler<T> for Or_rm8_r8 {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
use crate::arch::x86::emulator::mock_vmm::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ impl<T: CpuStateManager> InstructionHandler<T> for Stosb_m8_AL {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
use crate::arch::x86::emulator::mock_vmm::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -786,7 +786,7 @@ mod mock_vmm {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
use crate::arch::x86::emulator::mock_vmm::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ pub fn segment_from_gdt(entry: u64, table_index: u8) -> SegmentRegister {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ impl Vgic for KvmGicV3Its {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use crate::HypervisorVmConfig;
|
||||
use crate::aarch64::gic::{
|
||||
get_dist_regs, get_icc_regs, get_redist_regs, set_dist_regs, set_icc_regs, set_redist_regs,
|
||||
|
|
|
|||
|
|
@ -2937,7 +2937,7 @@ impl KvmVcpu {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
#[test]
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
fn test_get_and_set_regs() {
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ impl Vaia for KvmAiaImsics {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use crate::HypervisorVmConfig;
|
||||
use crate::arch::riscv64::aia::VaiaConfig;
|
||||
use crate::kvm::KvmAiaImsics;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ pub fn virtio_features_to_tap_offload(features: u64) -> c_uint {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ impl FromStr for MacAddr {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ impl AsRawFd for Tap {
|
|||
|
||||
#[cfg(test)]
|
||||
#[cfg(devcli_testenv)] // we need special permissions in the ENV to create Tap devices
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::net::Ipv4Addr;
|
||||
use std::sync::{LazyLock, Mutex, mpsc};
|
||||
use std::time::Duration;
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ impl Parseable for StringList {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1180,7 +1180,7 @@ impl PciBarConfiguration {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use vm_memory::ByteValued;
|
||||
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -553,7 +553,7 @@ pub fn performance_restore_latency(control: &PerformanceTestControl) -> f64 {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ impl Drop for RateLimiterGroup {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
pub(crate) mod unit_tests {
|
||||
use std::os::fd::AsRawFd;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ impl Default for RateLimiter {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
pub(crate) mod unit_tests {
|
||||
use std::{fmt, thread};
|
||||
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -1205,7 +1205,7 @@ fn main() {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ impl Ptm for PtmSetBufferSize {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn test_ptmresult() -> Result<()> {
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ impl Snapshottable for VirtioPciCommonConfig {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use vm_memory::GuestMemoryAtomic;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
|
|
|
|||
|
|
@ -670,14 +670,14 @@ where
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::io::{Error as IoError, Result as IoResult};
|
||||
|
||||
use libc::EFD_NONBLOCK;
|
||||
use virtio_queue::QueueOwnedT;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
use super::super::super::tests::TestContext;
|
||||
use super::super::super::unit_tests::TestContext;
|
||||
use super::super::defs as csm_defs;
|
||||
use super::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ impl TxBuf {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::io::{Error as IoError, ErrorKind, Result as IoResult};
|
||||
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -514,10 +514,10 @@ impl<B> Transportable for Vsock<B> where B: VsockBackend + Sync + 'static {}
|
|||
impl<B> Migratable for Vsock<B> where B: VsockBackend + Sync + 'static {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use libc::EFD_NONBLOCK;
|
||||
|
||||
use super::super::tests::{NoopVirtioInterrupt, TestContext};
|
||||
use super::super::unit_tests::{NoopVirtioInterrupt, TestContext};
|
||||
use super::super::*;
|
||||
use super::*;
|
||||
use crate::ActivateError;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ pub trait VsockChannel {
|
|||
pub trait VsockBackend: VsockChannel + VsockEpollListener + Send {}
|
||||
|
||||
#[cfg(any(test, fuzzing))]
|
||||
pub mod tests {
|
||||
pub mod unit_tests {
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
|
|
|||
|
|
@ -418,13 +418,13 @@ impl VsockPacket {
|
|||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::undocumented_unsafe_blocks)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use virtio_bindings::virtio_ring::VRING_DESC_F_WRITE;
|
||||
use virtio_queue::QueueOwnedT;
|
||||
use vm_memory::GuestAddress;
|
||||
use vm_virtio::queue::testing::VirtqDesc as GuestQDesc;
|
||||
|
||||
use super::super::tests::TestContext;
|
||||
use super::super::unit_tests::TestContext;
|
||||
use super::*;
|
||||
use crate::GuestMemoryMmap;
|
||||
use crate::vsock::defs::MAX_PKT_BUF_SIZE;
|
||||
|
|
|
|||
|
|
@ -867,7 +867,7 @@ impl VsockMuxer {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::cmp::min;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
|
@ -875,7 +875,7 @@ mod tests {
|
|||
use virtio_queue::QueueOwnedT;
|
||||
|
||||
use super::super::super::csm::defs as csm_defs;
|
||||
use super::super::super::tests::TestContext as VsockTestContext;
|
||||
use super::super::super::unit_tests::TestContext as VsockTestContext;
|
||||
use super::*;
|
||||
|
||||
impl PartiallyReadCommand {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ impl AddressAllocator {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ impl Bus {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
struct DummyDevice;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ pub trait BitposIteratorExt: Iterator<Item = u64> + Sized {
|
|||
impl<I: Iterator<Item = u64> + Sized> BitposIteratorExt for I {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
fn bitpos_check(inp: &[u64], out: &[u64]) {
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ impl MemoryRangeTable {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use crate::protocol::{MemoryRange, MemoryRangeTable};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -3170,7 +3170,7 @@ impl Drop for VmConfig {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use std::fs::File;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
|
||||
|
|
|
|||
|
|
@ -2992,7 +2992,7 @@ impl CpuElf64Writable for CpuManager {
|
|||
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use arch::layout::{BOOT_STACK_POINTER, ZERO_PAGE_START};
|
||||
use arch::x86_64::interrupts::*;
|
||||
use arch::x86_64::regs::*;
|
||||
|
|
@ -3140,7 +3140,7 @@ mod tests {
|
|||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
#[cfg(feature = "kvm")]
|
||||
use std::{mem, mem::offset_of};
|
||||
|
||||
|
|
|
|||
|
|
@ -5496,7 +5496,7 @@ impl Drop for DeviceManager {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ impl DoubleEndedIterator for BftIter<'_> {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::{DeviceNode, DeviceTree};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -3167,7 +3167,7 @@ impl GuestDebuggable for Vm {
|
|||
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
fn test_vm_state_transitions(state: VmState) {
|
||||
|
|
@ -3443,7 +3443,7 @@ mod tests {
|
|||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod unit_tests {
|
||||
use arch::aarch64::fdt::create_fdt;
|
||||
use arch::aarch64::layout;
|
||||
use arch::{DeviceType, MmioDeviceInfo};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue