From 0e7fcc623e0d339c35d58b998336d6bfbc84bc78 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Wed, 1 Apr 2026 18:45:05 -0700 Subject: [PATCH] test_infra: Implement FromStr for GuestVmType Add FromStr trait implementation for GuestVmType to enable parsing from CLI string arguments. Supports "regular" and "confidential" string values. Signed-off-by: Muminul Islam --- test_infra/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test_infra/src/lib.rs b/test_infra/src/lib.rs index bfdccf0c6..d6e21cd5c 100644 --- a/test_infra/src/lib.rs +++ b/test_infra/src/lib.rs @@ -2493,6 +2493,18 @@ pub enum GuestVmType { Confidential, } +impl FromStr for GuestVmType { + type Err = (); + + fn from_str(s: &str) -> Result { + match s { + "regular" => Ok(GuestVmType::Regular), + "confidential" => Ok(GuestVmType::Confidential), + _ => Err(()), + } + } +} + // Get the direct igvm boot file path based on the console type fn direct_igvm_boot_path(console: Option<&str>) -> Option { // get the default hvc0 igvm file if console string is not passed