From 45e92a731ba6cd47a3f7f8d13e20b6404ba6ae58 Mon Sep 17 00:00:00 2001 From: Wilfred Mallawa Date: Mon, 1 Jul 2024 12:03:28 +1000 Subject: [PATCH] test_suite: cleanup after test CSR artifacts Signed-off-by: Wilfred Mallawa --- src/test_suite.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test_suite.rs b/src/test_suite.rs index e6d7afb..108c064 100644 --- a/src/test_suite.rs +++ b/src/test_suite.rs @@ -412,6 +412,25 @@ pub fn test_set_certificate(cntx: *mut c_void, cert_slot_id: u8) -> Result<(), ( std::fs::remove_dir_all(cleanup_path).expect("Failed to cleanup test slot"); } + let csr_artifacts = [ + "./csr_response.cert", + "./csr_response.cert.der", + "./csr_response.der", + "./csr_response.req", + "./set-cert.der", + ]; + + for artifact in csr_artifacts { + match std::fs::remove_file(artifact) { + Err(e) => { + if e.kind() == std::io::ErrorKind::NotFound { + warn!("{:?}: does not exist", artifact) + } + } + _ => {} + } + } + Ok(()) }