mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-04 11:05:56 +00:00
kernel-cases: SOLIDCRAFT_KERNEL=truck grades as the default kernel
The kernel accepts `truck` (as well as unset) for its truck backend, and `boolean_kernel()` reports that backend as `default`. The rig compared the raw setting with that name, so a run with SOLIDCRAFT_KERNEL=truck reported every case as "this build runs booleans on the default kernel, not truck" instead of grading it. The rig now names unset, empty and `truck` alike as `default`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
@@ -11,7 +11,16 @@ use crate::{read_json, recipe};
|
||||
|
||||
/// The kernel this process runs on (`SOLIDCRAFT_KERNEL`, set by the caller).
|
||||
fn kernel() -> String {
|
||||
std::env::var("SOLIDCRAFT_KERNEL").ok().filter(|k| !k.is_empty()).unwrap_or_else(|| "default".into())
|
||||
kernel_name(std::env::var("SOLIDCRAFT_KERNEL").ok().as_deref())
|
||||
}
|
||||
|
||||
/// The rig's name for a `SOLIDCRAFT_KERNEL` setting: unset, empty or `truck` (all of which the
|
||||
/// kernel runs as truck) is `default`, the name `boolean_kernel` reports for truck.
|
||||
fn kernel_name(setting: Option<&str>) -> String {
|
||||
match setting.map(str::trim) {
|
||||
None | Some("") | Some("truck") => "default".into(),
|
||||
Some(other) => other.into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// How many cases a chain of `base` recipes may go through (a ladder case builds on the one
|
||||
@@ -371,6 +380,15 @@ mod tests {
|
||||
let _ = std::fs::remove_dir_all(&root);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn truck_named_explicitly_is_the_default_kernel() {
|
||||
// `SOLIDCRAFT_KERNEL=truck` runs truck, so the rig must not call it a build mismatch.
|
||||
for setting in [None, Some(""), Some(" "), Some("truck")] {
|
||||
assert_eq!(kernel_name(setting), "default");
|
||||
}
|
||||
assert_eq!(kernel_name(Some("smlib")), "smlib");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_base_cycle_is_an_error_not_a_hang() {
|
||||
let root = std::env::temp_dir().join(format!("kernel-cases-cycle-{}", std::process::id()));
|
||||
|
||||
Reference in New Issue
Block a user