add shellchat test routines for bulk read

This commit is contained in:
bunnie 2022-10-26 05:29:56 +08:00
parent bffe92cab9
commit 4c1e416244
2 changed files with 14 additions and 9 deletions

View file

@ -107,7 +107,7 @@ features = ["u32_backend", "rand"]
[features]
precursor = ["utralib/precursor"]
hosted = ["utralib/hosted"]
hosted = ["utralib/hosted", "random-pick"]
renode = ["utralib/renode"]
debugprint = []
spinortest = [] # for spinor testing. contra-indicated with PDDB, as it steals memory from the PDDB.

View file

@ -6,11 +6,11 @@ use xous_ipc::String;
use std::io::{Write, Read, Seek, SeekFrom};
use core::fmt::Write as FmtWrite;
#[cfg(feature="shellperf")]
#[cfg(any(feature="shellperf", not(target_os = "xous")))]
const TEST_DICT: &'static str = "perftest";
#[cfg(feature="shellperf")]
use perflib::*;
#[cfg(feature="shellperf")]
#[cfg(any(feature="shellperf", not(target_os = "xous")))]
use sha2::Digest;
#[cfg(feature="shellperf")]
const FILE_ID_SERVICES_SHELLCHAT_SRC_CMDS_PDDB_CMD: u32 = 2;
@ -927,17 +927,14 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
}
}
}
#[cfg(feature="hosted")]
#[cfg(not(target_os = "xous"))]
"rkyvtest" => {
use rkyv::{
archived_value,
de::deserializers::AllocDeserializer,
ser::{Serializer, serializers::WriteSerializer},
AlignedVec,
Archive,
Archived,
Deserialize,
Serialize,
};
let test = pddb::PddbKeyRecord {
name: "test".to_string(),
@ -975,6 +972,14 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
let deserialized = archived.deserialize(&mut AllocDeserializer).unwrap();
log::info!("deserialized: {:?}", deserialized);
}
#[cfg(not(target_os = "xous"))]
"bulktest" => {
let bulk_read = self.pddb.read_dict(TEST_DICT, None, None).unwrap();
log::info!("read {} records", bulk_read.len());
for record in bulk_read {
log::info!("{:?}", record);
}
}
#[cfg(feature="shellperf")]
"v2p" => {
// don't generate a new object since it clears the data, just do a raw dump
@ -1029,7 +1034,7 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
}
}
}
#[cfg(feature="shellperf")]
#[cfg(any(feature="shellperf", not(target_os = "xous")))]
"perfprep" => {
log::info!("Preparing test set for performance profiling");
let words = [
@ -1164,7 +1169,7 @@ fn join_tokens<'a>(buf: &mut String<1024>, tokens: impl Iterator<Item = &'a str>
}
}
#[cfg(feature="perflib")]
#[cfg(any(feature="shellperf", not(target_os = "xous")))]
fn hex(data: Vec<u8>) -> std::string::String {
use std::fmt::Write;
let mut s = std::string::String::with_capacity(2 * data.len());