tests: cover new SMBIOS platform fields

The structured SMBIOS platform config introduced six new keys
(system_manufacturer, system_product_name, system_version,
system_family, system_sku_number, chassis_asset_tag), but
integration coverage only existed for serial_number, uuid, and
oem_strings.

Add _test_dmi_system_and_chassis, which boots a guest with all
six keys set and checks each value via `dmidecode -s` using the
same leaf name as the CLI key. Execute it in both the regular
and SEV-SNP integration suites.

On-behalf-of: SAP leander.kohler@sap.com
Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
This commit is contained in:
Leander Kohler
2026-05-27 12:12:44 +02:00
committed by Rob Bradford
parent b3f79e3a2f
commit 3b79503e2f
3 changed files with 61 additions and 0 deletions

View File

@@ -2325,6 +2325,54 @@ pub(crate) fn _test_dmi_oem_strings(guest: &Guest) {
handle_child_output(r, &output);
}
#[cfg(target_arch = "x86_64")]
pub(crate) fn _test_dmi_system_and_chassis(guest: &Guest) {
let fields = [
("system_manufacturer", "system-manufacturer", "Manufacturer"),
("system_product_name", "system-product-name", "ProductName"),
("system_version", "system-version", "Version"),
("system_family", "system-family", "Family"),
("system_sku_number", "system-sku-number", "SkuNumber"),
("chassis_asset_tag", "chassis-asset-tag", "AssetTag"),
];
let platform = fields
.iter()
.map(|(key, _, value)| format!("{key}={value}"))
.collect::<Vec<_>>()
.join(",");
let mut child = GuestCommand::new(guest)
.default_cpus()
.default_memory()
.default_kernel_cmdline_with_platform(Some(&platform))
.default_disks()
.default_net()
.capture_output()
.spawn()
.unwrap();
let r = std::panic::catch_unwind(|| {
guest.wait_vm_boot().unwrap();
for (_, dmidecode_field, expected) in fields {
assert_eq!(
guest
.ssh_command(&format!("sudo dmidecode -s {dmidecode_field}"))
.unwrap()
.trim(),
expected,
"DMI field {dmidecode_field} mismatch"
);
}
});
kill_child(&mut child);
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
}
pub(crate) fn _test_serial_off(guest: &Guest) {
let mut child = GuestCommand::new(guest)
.default_cpus()

View File

@@ -2051,6 +2051,13 @@ mod common_parallel {
_test_dmi_oem_strings(&guest);
}
#[test]
#[cfg(target_arch = "x86_64")]
fn test_dmi_system_and_chassis() {
let guest = basic_regular_guest!(JAMMY_IMAGE_NAME);
_test_dmi_system_and_chassis(&guest);
}
#[test]
fn test_virtio_fs() {
_test_virtio_fs(&prepare_virtiofsd, false, false, None);

View File

@@ -219,6 +219,12 @@ mod common_cvm {
_test_dmi_oem_strings(&guest);
}
#[test]
fn test_dmi_system_and_chassis() {
let guest = basic_cvm_guest!(JAMMY_IMAGE_NAME);
_test_dmi_system_and_chassis(&guest);
}
#[test]
fn test_multiple_network_interfaces() {
let guest = basic_cvm_guest!(JAMMY_IMAGE_NAME);