update: auto distinguish boards to retest

- automatically print
This commit is contained in:
Wataru Otsubo 2024-07-25 20:07:28 +09:00
parent 79e7291031
commit ae29be2daa
4 changed files with 93 additions and 3 deletions

View file

@ -194,6 +194,7 @@ impl PsbQaqcResult {
pub fn from_masterlogresult(result: MasterLogResult) -> Vec<Self> {
let mut converted = vec![];
for (pos, boardresult) in result.board_results {
let isretest = boardresult.is_need_retest().is_some();
let new = PsbQaqcResult {
motherboard_id: boardresult.id.id,
daughterboard_id: None,
@ -214,7 +215,7 @@ impl PsbQaqcResult {
firmware_ver: None,
parameter_ver: None,
fpga_dna: None,
retest: false,
retest: isretest,
comment: "".to_string(),
};
converted.push(new);
@ -366,6 +367,16 @@ fn main() -> Result<()> {
};
debug!("{:?}", result);
// Print boards to retest
for (pos, boardresult) in &result.board_results {
if let Some(reason) = boardresult.is_need_retest() {
println!(
"Board {} at {} need retest for {}",
boardresult.id.id, pos, reason
);
}
}
let expanded_results = PsbQaqcResult::from_masterlogresult(result);
let mut wtr = match outfile.exists() {

View file

@ -24,6 +24,36 @@ pub struct MasterBoardResult {
pub result: u8,
}
impl MasterBoardResult {
/// Check the board needs to be retested with reason.
///
/// None if it doesn't need retest.
pub fn is_need_retest(&self) -> Option<String> {
let mut result = false;
let mut reasons = vec![];
if self.qspip != 1 {
result = true;
reasons.push(format!("QSPIp is not 1({})", self.qspip));
}
if self.recov != 1 {
result = true;
reasons.push(format!("Recov is not 1({})", self.recov));
}
if self.power != 1 {
result = true;
reasons.push(format!("Power is not 1({})", self.qspip));
}
if self.clock != 1 {
result = true;
reasons.push(format!("Clock is not 1({})", self.clock));
}
match result {
true => Some(reasons.join(", ")),
false => None,
}
}
}
/// Full result for a single QAQC run from a log file on JATHub master.
#[derive(Debug)]
pub struct MasterLogResult {