mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: extract _test_dmi_serial_number to tests_wrappers
Move the DMI serial number test logic from integration.rs into a shared _test_dmi_serial_number() function in tests_wrappers.rs. The original test now delegates to this shared function, enabling reuse by CVM tests. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
b65a3a58f3
commit
5f4ad4bb1e
@@ -2180,3 +2180,33 @@ pub fn _test_split_irqchip(guest: &Guest) {
|
||||
|
||||
handle_child_output(r, &output);
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub(crate) fn _test_dmi_serial_number(guest: &Guest) {
|
||||
let mut child = GuestCommand::new(guest)
|
||||
.default_cpus()
|
||||
.default_memory()
|
||||
.default_kernel_cmdline_with_platform(Some("serial_number=a=b;c=d"))
|
||||
.default_disks()
|
||||
.default_net()
|
||||
.capture_output()
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
guest
|
||||
.ssh_command("sudo cat /sys/class/dmi/id/product_serial")
|
||||
.unwrap()
|
||||
.trim(),
|
||||
"a=b;c=d"
|
||||
);
|
||||
});
|
||||
|
||||
kill_child(&mut child);
|
||||
let output = child.wait_with_output().unwrap();
|
||||
|
||||
handle_child_output(r, &output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user