add testing commands for rekeying.

This commit is contained in:
bunnie 2022-07-19 03:17:08 +08:00
parent 900df7b223
commit fa984845ed
2 changed files with 14 additions and 0 deletions

View file

@ -107,4 +107,5 @@ autobasis-ci = []
ditherpunk = ["png"]
tracking-alloc = ["tracking-allocator", "tracing", "tracing-subscriber"]
dbg-ecupdate = [] # for issuing manual commands to initiate an EC update (vs UX). Also need to enable this feature in the status crate. Intended for debug only.
test-rekey = []
default = [] # "debugprint"

View file

@ -216,6 +216,19 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
Err(_) => write!(ret, "Error encountered listing dictionaries").ok().unwrap_or(()),
}
}
#[cfg(feature="test-rekey")]
"rekey" => {
let old_dna = if let Some(dna_str) = tokens.next() {
dna_str.parse::<u64>().unwrap_or(0)
} else {
0
};
log::info!("rekey result: {:?}", self.pddb.rekey_pddb(pddb::PddbRekeyOp::FromDnaFast(old_dna)));
}
#[cfg(feature="pddbtest")]
"dump" => {
self.pddb.dbg_dump("full").unwrap();
}
#[cfg(feature="pddbtest")]
"largetest" => {
// fill memory with junk