Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/nucleus-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,14 +672,19 @@ fn run_lockstep(path: &Path, explain: bool) -> ExitCode {
}
};

let check_report = match nucleus_compiler::check(&text) {
Ok(report) => report,
let (check_report, family_warning) = match check_family(&text) {
Ok(result) => result,
Err(err) => {
print_parse_error(&toml_path, &err);
return ExitCode::FAILURE;
}
};

if let Some(warning) = &family_warning {
eprintln!("warning: {warning}");
eprintln!(" falling back to STM32F446RE; results may be inaccurate.\n");
}

if !check_report.is_ok() {
let n = check_report.conflicts.len();
eprintln!(
Expand Down
22 changes: 22 additions & 0 deletions crates/nucleus-cli/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,28 @@ fn lockstep_with_present_firmware_runs_both_backends_concurrently_without_hangin
);
}

#[test]
fn lockstep_warns_on_unknown_family_instead_of_silently_falling_back() {
// Regression test for issue 53: run_lockstep called check() instead of
// check_family(), so an unrecognized [device].family silently validated
// against the F446RE fallback DB with no warning — unlike `check` and
// `test`, which both surface UnknownFamily via check_family()/test_plan().
let proj = TempProject::new();
std::fs::write(
proj.path().join("stm32.toml"),
"[device]\nfamily = \"STM32H750\"\n",
)
.unwrap();

let out = nucleus(&["lockstep".as_ref(), proj.path().as_os_str()]);

let stderr = String::from_utf8_lossy(&out.stderr);
assert!(
stderr.contains("unsupported device family"),
"expected an UnknownFamily warning, got stderr:\n{stderr}"
);
}

#[test]
fn init_rejects_unknown_board() {
let proj = TempProject::new();
Expand Down
Loading