From e48832a1397065666c05ff5001ced2ac2eaf3674 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 8 Feb 2024 15:04:23 +0800 Subject: [PATCH] make TRNG API test easier to run since we're using it, might as well take it out of a comment and turn it into a gated feature --- services/shellchat/Cargo.toml | 1 + services/shellchat/src/cmds/trng_cmd.rs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/services/shellchat/Cargo.toml b/services/shellchat/Cargo.toml index dd3c4e345..deffa8d3f 100644 --- a/services/shellchat/Cargo.toml +++ b/services/shellchat/Cargo.toml @@ -145,6 +145,7 @@ shellperf = [ ] # this also needs the project-wide "perfcounter" feature to be selected. shellchat is the exclusive manager of the performance counter, do not use with e.g. "vaultperf" feature extra-tests = [] mass-storage = [] +rand-api = [] locktests = [ ] # for debugging some specific `std` tests cherry-picked out of the test suite default = [] # "debugprint" diff --git a/services/shellchat/src/cmds/trng_cmd.rs b/services/shellchat/src/cmds/trng_cmd.rs index ca6f6fd59..160d545c3 100644 --- a/services/shellchat/src/cmds/trng_cmd.rs +++ b/services/shellchat/src/cmds/trng_cmd.rs @@ -81,8 +81,9 @@ impl<'a> ShellCmdApi<'a> for TrngCmd { } write!(ret, "Pumped {}x1k values out of the engine", ROUNDS).unwrap(); } - // rand_core API tests - commented out because they only need to be run once, basically. - /* + // rand_core API tests - not included by default because it only needs to be run whenever + // the rand API is updated + #[cfg(feature = "rand-api")] "api" => { // the purpose of these tests is to check the edge-case code because // the trng fetch is u32, but rand_core allows u8 @@ -143,7 +144,7 @@ impl<'a> ShellCmdApi<'a> for TrngCmd { let mut test4100 = [0u8; 4100]; OsRng.fill_bytes(&mut test4100); log::info!("test 4100: {:?}", &test4100[4092..]); - } */ + } "errs" => { write!(ret, "TRNG error stats: {:?}", env.trng.get_error_stats().unwrap()).unwrap(); }