mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tpm: add startup response tests
Cover the accepted TPM2_Startup(CLEAR) response codes so the swtpm reset handling keeps tolerating already-initialized TPMs. Assisted-by: Copilot:GPT-5.5 Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -562,3 +562,19 @@ impl Drop for Emulator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_startup_response_accepts_success_and_initialized() {
|
||||
assert!(startup_response_is_ok(TPM_SUCCESS));
|
||||
assert!(startup_response_is_ok(TPM_RC_INITIALIZE));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_startup_response_rejects_other_errors() {
|
||||
assert!(!startup_response_is_ok(0x101));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user