mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
split out sha tests and upgrade api to 0.10 in shellchat
This commit is contained in:
parent
eb28893128
commit
3bfcce9a06
3 changed files with 15 additions and 15 deletions
|
|
@ -121,6 +121,7 @@ spinortest = [
|
|||
] # for spinor testing. contra-indicated with PDDB, as it steals memory from the PDDB.
|
||||
benchmarks = [
|
||||
] # adds the benchmark routines. Left off normally to free up code and memory space.
|
||||
hashtest = []
|
||||
aestests = [] # adds AES tests
|
||||
tts = [] # adds text to speech plugin
|
||||
pddbtest = ["rand_chacha"]
|
||||
|
|
@ -146,4 +147,4 @@ extra-tests = []
|
|||
mass-storage = []
|
||||
locktests = [
|
||||
] # for debugging some specific `std` tests cherry-picked out of the test suite
|
||||
default = [] # "debugprint"
|
||||
default = ["hashtest"] # "debugprint"
|
||||
|
|
|
|||
|
|
@ -144,9 +144,9 @@ use tts::*;
|
|||
mod engine;
|
||||
#[cfg(feature = "benchmarks")]
|
||||
use engine::*;
|
||||
#[cfg(feature = "benchmarks")]
|
||||
#[cfg(feature = "hashtest")]
|
||||
mod sha;
|
||||
#[cfg(feature = "benchmarks")]
|
||||
#[cfg(feature = "hashtest")]
|
||||
use sha::*;
|
||||
#[cfg(feature = "aestests")]
|
||||
mod aes_cmd;
|
||||
|
|
@ -183,7 +183,7 @@ pub struct CmdEnv {
|
|||
#[cfg(feature = "tts")]
|
||||
tts_cmd: Tts,
|
||||
|
||||
#[cfg(feature = "benchmarks")]
|
||||
#[cfg(feature = "hashtest")]
|
||||
sha_cmd: Sha,
|
||||
#[cfg(feature = "aestests")]
|
||||
aes_cmd: Aes,
|
||||
|
|
@ -229,7 +229,7 @@ impl CmdEnv {
|
|||
event_csr: AtomicCsr::new(event1_csr.as_mut_ptr() as *mut u32),
|
||||
};
|
||||
//let fcc = Fcc::new(&mut common);
|
||||
#[cfg(feature = "benchmarks")]
|
||||
#[cfg(feature = "hashtest")]
|
||||
let sha = Sha::new(&xns, &mut _common);
|
||||
#[cfg(feature = "aestests")]
|
||||
let aes = Aes::new(&xns, &mut _common);
|
||||
|
|
@ -321,7 +321,7 @@ impl CmdEnv {
|
|||
#[cfg(feature = "tts")]
|
||||
tts_cmd: Tts::new(&xns),
|
||||
|
||||
#[cfg(feature = "benchmarks")]
|
||||
#[cfg(feature = "hashtest")]
|
||||
sha_cmd: sha,
|
||||
#[cfg(feature = "aestests")]
|
||||
aes_cmd: aes,
|
||||
|
|
@ -371,7 +371,7 @@ impl CmdEnv {
|
|||
&mut self.test_cmd,
|
||||
#[cfg(feature = "tts")]
|
||||
&mut self.tts_cmd,
|
||||
#[cfg(feature = "benchmarks")]
|
||||
#[cfg(feature = "hashtest")]
|
||||
&mut self.sha_cmd,
|
||||
#[cfg(feature = "aestests")]
|
||||
&mut self.aes_cmd,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
use core::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
use digest::Digest;
|
||||
use num_traits::*;
|
||||
use sha2::*;
|
||||
use sha2::Digest;
|
||||
use xous_ipc::String;
|
||||
|
||||
use crate::{CommonEnv, ShellCmdApi};
|
||||
|
|
@ -25,7 +24,7 @@ const TEST_ITERS: usize = 1000;
|
|||
const TEST_MAX_LEN: usize = 8192;
|
||||
const TEST_FIXED_LEN: bool = true;
|
||||
/*
|
||||
benchamrk notes:
|
||||
benchmark notes:
|
||||
TEST_MAX_LEN = 16384 (fixed length) / TEST_ITERS = 1000: hw 25.986ms/hash, sw 155.11ms/hash
|
||||
TEST_MAX_LEN = 16384 (random length) / TEST_ITERS = 1000: hw 15.262ms/hash, sw 80.053ms/hash
|
||||
TEST_MAX_LEN = 256 (random length) / TEST_ITERS = 1000: hw 6.968ms/hash, sw 3.987ms/hash
|
||||
|
|
@ -72,9 +71,10 @@ pub fn benchmark_thread(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
|
|||
let mut hasher = match FromPrimitive::from_usize(msg.body.id()) {
|
||||
Some(BenchOp::StartSha512Sw) => {
|
||||
hw_mode = false;
|
||||
sha2::Sha512::new_with_strategy(FallbackStrategy::SoftwareOnly)
|
||||
// should be software-only, but we can't specify that with the lastest API...
|
||||
sha2::Sha512::new()
|
||||
}
|
||||
_ => sha2::Sha512::new_with_strategy(FallbackStrategy::WaitForHardware),
|
||||
_ => sha2::Sha512::new(), // should be "wait for hardware"...
|
||||
};
|
||||
let mut accumulator = [0 as u8; 64];
|
||||
for i in 0..TEST_ITERS {
|
||||
|
|
@ -190,7 +190,7 @@ impl<'a> ShellCmdApi<'a> for Sha {
|
|||
];
|
||||
|
||||
let mut pass: bool = true;
|
||||
let mut hasher = sha2::Sha512::new_with_strategy(FallbackStrategy::WaitForHardware);
|
||||
let mut hasher = sha2::Sha512::new();
|
||||
|
||||
hasher.update(K_DATA);
|
||||
let digest = hasher.finalize();
|
||||
|
|
@ -217,8 +217,7 @@ impl<'a> ShellCmdApi<'a> for Sha {
|
|||
];
|
||||
|
||||
let mut pass: bool = true;
|
||||
let mut hasher =
|
||||
sha2::Sha512Trunc256::new_with_strategy(FallbackStrategy::WaitForHardware);
|
||||
let mut hasher = sha2::Sha512_256::new();
|
||||
|
||||
hasher.update(K_DATA);
|
||||
let digest = hasher.finalize();
|
||||
|
|
|
|||
Loading…
Reference in a new issue