build_and_find_binary

Function build_and_find_binary 

Source
pub fn build_and_find_binary(
    package: &str,
    workspace_dir: &str,
) -> Result<PathBuf>
Expand description

Build a cargo binary package and return its output path.

Runs cargo build -p <package> from workspace_dir — the manifest directory of the crate that DECLARED the scheduler. Cargo walks up from there to that crate’s workspace root, so the lockfile, feature unification (e.g. vendored libbpf-sys), and target dir all come from the scheduler’s own workspace, regardless of the calling process’s working directory. For a declare_scheduler! scheduler workspace_dir is the invoking crate’s CARGO_MANIFEST_DIR; for ktstr’s own in-tree builders it is ktstr’s crate dir (the workspace root in this repo). Reused artifacts may embed an immutable stable-source pathname; [writable_source_path] maps it back to the caller’s checkout before Cargo runs.

The scheduler-under-test is built with the RELEASE profile by DEFAULT: a debug sched_ext scheduler is far slower and its BPF verifier instruction counts differ, so it is never the intended thing to test. KTSTR_SCHEDULER_PROFILE_ENV overrides the profile name (set by cargo ktstr <cmd> --profile <NAME>); an unset / empty value keeps the release default. The build passes cargo build --profile <name> verbatim (dev = the default profile, release == --release, any custom [profile.<name>]), so the returned artifact path resolves under the matching target/<dir>/.