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 {

View file

@ -19,7 +19,7 @@ mod integrated_test {
let mut cmd = Command::cargo_bin("psb-qaqc")?;
cmd.current_dir("tests")
.arg("add-master-log")
.arg("./example_logs/valid/7.log")
.arg("./example_logs/valid/44.log")
.arg(test_out.as_path())
.assert()
.success()
@ -32,7 +32,7 @@ mod integrated_test {
let r = BufReader::new(f);
assert!(r.lines().any(|line| {
line.unwrap().eq(
"8866,,B-0-1,0,1,1,0,1,8,1,,7,2024-07-20T17:15:46Z,7.log,0.1.0,alice,,,,false,",
"214,,B-0-1,1,1,1,1,1,0,1,,44,2024-07-25T08:41:27Z,44.log,1.0.1,Bob,,,,false,",
)
}));
}

View file

@ -0,0 +1,49 @@
Shift script: 1.0.1
----------------------
Date: 2024-07-25T08:41:27+0000
QAQC runid: 44
Shifters: Bob
----------------------
PBS Assignment:
Position / assigned-ID : B-0-1 / PS000214
Position / assigned-ID : B-1-1 / PS000215
Position / assigned-ID : B-0-2 / PS000213
Position / assigned-ID : B-1-2 / PS000211
Position / assigned-ID : B-0-3 / PS000212
Position / assigned-ID : B-1-3 / PS000210
Position / assigned-ID : B-0-4 / PS000207
Position / assigned-ID : B-1-4 / PS000209
Position / assigned-ID : B-0-5 / PS000208
Position / assigned-ID : B-1-5 / PS000206
Position / assigned-ID : B-0-6 / PS000205
Position / assigned-ID : B-1-6 / PS000204
Position / assigned-ID : B-0-7 / PS000203
Position / assigned-ID : B-1-7 / PS000202
Position / assigned-ID : B-0-8 / PS000201
Position / assigned-ID : B-1-8 / PS000239
Position / assigned-ID : B-0-9 / PS000238
Position / assigned-ID : B-1-9 / PS000237
======================
QAQC status| QSPIp | Recov | Power | Clock | ASDTP | Reset | Result |
----------------------------------------------------------------------
Station0
JATHub_ 1| 1| 1| 1| 1| 1| 0| 1|
JATHub_ 2| 1| 1| 1| 1| 1| 0| 1|
JATHub_ 3| 1| 1| 1| 1| 1| 0| 1|
JATHub_ 4| 1| 1| 1| 2| 1| 4| 2|
JATHub_ 5| 1| 1| 1| 1| 1| 0| 1|
JATHub_ 6| 1| 1| 1| 1| 1| 1| 1|
JATHub_ 7| 1| 1| 1| 1| 1| 0| 1|
JATHub_ 8| 1| 1| 1| 1| 1| 0| 1|
JATHub_ 9| 1| 1| 1| 2| 1| 0| 2|
Station1
JATHub_11| 2| 1| 2| 1| 2| 1| 2|
JATHub_12| 1| 1| 1| 1| 1| 0| 1|
JATHub_13| 1| 1| 1| 2| 1| 0| 2|
JATHub_14| 1| 1| 1| 2| 1| 0| 2|
JATHub_15| 1| 1| 1| 2| 1| 0| 2|
JATHub_16| 1| 1| 2| 1| 1| 1| 2|
JATHub_17| 1| 1| 1| 1| 1| 0| 1|
JATHub_18| 1| 1| 1| 1| 1| 3| 1|
JATHub_19| 1| 1| 1| 1| 1| 0| 1|
======================