per_name_scheduler_env

Function per_name_scheduler_env 

Source
pub fn per_name_scheduler_env(name: &str) -> String
Expand description

Per-scheduler-NAME override environment variable for a SchedulerSpec::Discover(name) scheduler: KTSTR_SCHEDULER_BIN_<NAME>, where <NAME> is the discover name uppercased with every non-alphanumeric character replaced by _ (e.g. scx_layered -> KTSTR_SCHEDULER_BIN_SCX_LAYERED, scx-ktstr -> KTSTR_SCHEDULER_BIN_SCX_KTSTR).

The BIN infix keeps the per-name namespace disjoint from the KTSTR_SCHEDULER_* meta-variables (KTSTR_SCHEDULER_ENV = the global override, KTSTR_SCHEDULER_PROFILE_ENV = the build profile): without it a scheduler named profile would derive KTSTR_SCHEDULER_PROFILE and shadow the build-profile selector. - and _ both map to _ (env-var names can’t contain -), so scx-foo and scx_foo derive the same var — not a practical ambiguity, as a scheduler is referred to by one canonical spelling per run.

Checked BEFORE the global KTSTR_SCHEDULER_ENV in the Discover resolution cascade, so a test that declares several distinct Discover schedulers (one entry.scheduler plus staged schedulers) can point each at its own pre-built binary. The global var remains the coarse fallback for the common single-scheduler case. A set per-name var whose path does not exist falls through to the global var and then the build cascade (lenient, matching the global var’s own missing-path behavior).