fix warnings and clean up configs

tighten up the scope of some features to reduce warning messages
This commit is contained in:
bunnie 2022-07-04 18:13:11 +08:00
parent c46b5179ff
commit e26106e334
6 changed files with 16 additions and 7 deletions

View file

@ -39,7 +39,10 @@ pub(crate) const PDDB_VERSION: u32 = 0x00_00_02_01;
#[allow(dead_code)]
// PDDB_A_LEN may be shorter than xous::PDDB_LEN, to speed up testing.
#[allow(dead_code)]
// pub(crate) const PDDB_A_LEN: usize = xous::PDDB_LEN as usize;
#[cfg(not(any(feature="pddbtest",feature="autobasis",feature="ci")))]
pub(crate) const PDDB_A_LEN: usize = xous::PDDB_LEN as usize;
#[allow(dead_code)]
#[cfg(any(feature="pddbtest",feature="autobasis",feature="ci"))]
pub const PDDB_A_LEN: usize = 4 * 1024 * 1024;
/// range for the starting point of a journal number, picked from a random seed
@ -133,7 +136,7 @@ pub(crate) enum Opcode {
/// Write debug dump (only available in hosted mode)
#[cfg(not(any(target_os = "none", target_os = "xous")))]
DangerousDebug = 25,
#[cfg(feature="pddbtest")]
#[cfg(all(feature="pddbtest", feature="autobasis"))]
BasisTesting = 26,
/// This key type could not be decoded

View file

@ -47,7 +47,7 @@ pub const KCOM_CT_LEN: usize = 4004;
pub(crate) const WRAPPED_AES_KEYSIZE: usize = AES_KEYSIZE + 8;
const SCD_VERSION: u32 = 2;
#[cfg(feature="pddbtest")]
#[cfg(all(feature="pddbtest", feature="autobasis"))]
pub const BASIS_TEST_ROOTNAME: &'static str = "test";
#[derive(Zeroize)]

View file

@ -654,7 +654,7 @@ impl Pddb {
.or(Err(Error::new(ErrorKind::Other, "Xous internal error"))).map(|_| ())
}
#[cfg(feature="pddbtest")]
#[cfg(all(feature="pddbtest", feature="autobasis"))]
pub fn basis_testing(&self, config: &[Option<bool>; 32]) {
let mut op = 0;
let mut valid = 0;

View file

@ -1265,7 +1265,7 @@ fn wrapped_main() -> ! {
}
}
}
#[cfg(feature="pddbtest")]
#[cfg(all(feature="pddbtest", feature="autobasis"))]
Opcode::BasisTesting => xous::msg_scalar_unpack!(msg, op, valid, _, _, {
let mut config: [Option<bool>; 32] = [None::<bool>; 32];
for i in 0..32 {

View file

@ -101,7 +101,7 @@ spinortest = [] # for spinor testing. contra-indicated with PDDB, as it steals m
benchmarks = [] # adds the benchmark routines. Left off normally to free up code and memory space.
aestests = [] # adds AES tests
tts = [] # adds text to speech plugin
pddbtest = []
pddbtest = ["rand_chacha"]
autobasis = ["rand_chacha"]
autobasis-ci = []
ditherpunk = ["png"]

View file

@ -1,4 +1,5 @@
use crate::{ShellCmdApi, CommonEnv};
#[cfg(all(feature="pddbtest", feature="autobasis"))]
use pddb::PDDB_A_LEN;
use xous_ipc::String;
#[allow(unused_imports)]
@ -307,7 +308,7 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
log::info!("largetest failed");
}
}
#[cfg(feature="pddbtest")]
#[cfg(all(feature="pddbtest", feature="autobasis"))]
"btest" => {
// This test will:
// - generate bases iteratively:
@ -824,14 +825,19 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
}
}
#[cfg(all(feature="pddbtest", feature="autobasis"))]
enum VectorType {
Small(usize),
Large(usize),
Junk,
}
#[cfg(all(feature="pddbtest", feature="autobasis"))]
const SMALL_SIZE: usize = 2011;
#[cfg(all(feature="pddbtest", feature="autobasis"))]
const LARGE_SIZE: usize = 28813;
#[cfg(all(feature="pddbtest", feature="autobasis"))]
const JUNK_SIZE: usize = 128 * 1024 - 2;
#[cfg(all(feature="pddbtest", feature="autobasis"))]
fn make_vector(basis_number: usize, vtype: VectorType) -> Vec::<u8> {
use rand::prelude::*;
use rand_chacha::ChaCha8Rng;