From b3b252a5d1cd5c96d999b5cb458a6a02028bf6f5 Mon Sep 17 00:00:00 2001 From: lizhaoxin1 Date: Thu, 4 Aug 2022 11:36:17 +0800 Subject: [PATCH] tests: Add integration test for --platform uuid Signed-off-by: lizhaoxin1 --- tests/integration.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index 47b3bfec0..9b3385685 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -3091,6 +3091,42 @@ mod parallel { handle_child_output(r, &output); } + #[test] + #[cfg(target_arch = "x86_64")] + fn test_dmi_uuid() { + let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string()); + let guest = Guest::new(Box::new(focal)); + + let mut child = GuestCommand::new(&guest) + .args(&["--cpus", "boot=1"]) + .args(&["--memory", "size=512M"]) + .args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()]) + .args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE]) + .args(&["--platform", "uuid=1e8aa28a-435d-4027-87f4-40dceff1fa0a"]) + .default_disks() + .default_net() + .capture_output() + .spawn() + .unwrap(); + + let r = std::panic::catch_unwind(|| { + guest.wait_vm_boot(None).unwrap(); + + assert_eq!( + guest + .ssh_command("sudo cat /sys/class/dmi/id/product_uuid") + .unwrap() + .trim(), + "1e8aa28a-435d-4027-87f4-40dceff1fa0a" + ); + }); + + let _ = child.kill(); + let output = child.wait_with_output().unwrap(); + + handle_child_output(r, &output); + } + #[test] fn test_virtio_fs() { _test_virtio_fs(&prepare_virtiofsd, false, None)