Skip to content

Commit

Permalink
debug windows test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
anisse committed Jun 16, 2024
1 parent e769ebc commit d33fb12
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/fusetests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ fn parse_cpu_regs(input: Vec<&str>, r: &mut cpu::Regs, halted: &mut bool) -> Res
}
}
fn parse_memory_values(input: Vec<&str>, memory_values: &mut Vec<MemValues>) -> Result<(), String> {
println!("parsing {} memory lines", input.len());
for l in input.iter().filter(|l| **l != "-1") {
println!("test line: '{l}'");
let mem: Vec<&str> = l.split_ascii_whitespace().collect();
//parse address and all value
let base_addr = match u16::from_str_radix(mem[0], 16) {
Expand Down Expand Up @@ -165,9 +167,17 @@ fn parse_tests(input: &str, expected: &str) -> Option<Vec<Test>> {
results.len()
)
}
println!(
"Number of tests: {} (out of {} chars / {} lines)",
inputs.len(),
input.len(),
input.lines().count()
);
for (i, l) in inputs.iter().enumerate() {
let lines: Vec<&str> = l.lines().collect();
println!("Lines in current input test: {}: {lines:?}", lines.len());
let res: Vec<&str> = results[i].lines().collect();
println!("Lines in current result test: {}: {res:?}", res.len());
let mut t = Test::default();
if lines.len() < 5 {
panic!("Not enough lines {:?}", lines)
Expand Down Expand Up @@ -242,9 +252,10 @@ fn parse_tests(input: &str, expected: &str) -> Option<Vec<Test>> {
let memval = res
.into_iter()
.skip(1)
.filter(|l| !l.starts_with(" "))
.filter(|l| !l.starts_with(" ") && !l.is_empty())
.skip(2)
.collect();
println!("Result memval: {memval:?}");
parse_memory_values(memval, &mut t.changed_mem_values)
.unwrap_or_else(|e| panic!("test res {} ({}): {}", t.desc, i, e));
tests.push(t)
Expand Down

0 comments on commit d33fb12

Please sign in to comment.