pub fn resolve_scheduler(
spec: &SchedulerSpec,
manifest_dir: &str,
) -> Result<(Option<PathBuf>, ResolveSource)>Expand description
Resolve a scheduler binary from a SchedulerSpec.
Returns the resolved path (if any) paired with the
ResolveSource naming the branch that produced it. The source is
load-bearing for downstream provenance: only
ResolveSource::AutoBuilt guarantees the binary matches the
declaring crate’s workspace tree; every other variant locates a
pre-existing file whose git hash is UNKNOWN to this process.
manifest_dir is the declaring crate’s CARGO_MANIFEST_DIR (from
Scheduler::manifest_dir),
forwarded to crate::build_and_find_binary so the on-demand
Discover build runs in the scheduler’s OWN workspace.
Variant mapping:
-
Eevdf/KernelBuiltin { .. }→(None, NotFound)(no user-space binary). -
Path(p)→(Some(p), Path)(explicit caller-named path; validated for existence). -
Discover(name)→ four steps:- exact parent manifest lookup
(
Manifest). Presence is authoritative: invalid or missing data is a hard error and cannot fall through. KTSTR_SCHEDULERenv override (EnvVar) — a global, name-agnostic binary path applying to everyDiscoverscheduler.- cargo-test mode only:
$PATHlookup (PathLookup), so an installed scheduler resolves without a workspace build. cargo build -p <name>in the declaring crate’s workspace (AutoBuilt), in BOTH modes.
Cargo owns freshness: it rebuilds when the scheduler’s sources (incl.
src/bpf/*.bpf.cvia its build.rs) change, is a no-op when they are up to date, and fails when the scheduler cannot build. A failed build is a hard error, full stop — a scheduler that will not build is a failed test, never a silently-stale pre-built binary. The error carries theSchedulerBuildRefusedmarker so dispatch forces a hard FAIL even underexpect_err: a host-side build fault must not invert to PASS. The$PATHlookup is gated to cargo-test mode so gauntlet runs always land on the workspace-built scheduler revision rather than a system-wide install. - exact parent manifest lookup
(