sidecar_dir

Function sidecar_dir 

Source
pub fn sidecar_dir() -> PathBuf
Expand description

Resolve the sidecar output directory for the current test process.

Override: KTSTR_SIDECAR_DIR (used as-is when non-empty). When the override is set, serialize_and_write_sidecar ALSO skips the per-directory pre-clear so any pre-existing sidecars in the operator-chosen directory are preserved verbatim — see sidecar_dir_override.

Default: {CARGO_TARGET_DIR or "target"}/ktstr/{kernel}-{project_commit}/, where {kernel} is the version detected from KTSTR_KERNEL’s metadata (or "unknown" when no kernel is set / detection fails) and {project_commit} is the project-tree HEAD short hex from detect_project_commit (with -dirty suffix when the worktree differs from HEAD), or "unknown" when the test process is not running inside a git repository or the probe fails. Every sidecar written from the same cargo ktstr test invocation lands in the same directory; two runs sharing the same kernel + project commit (e.g. re-running the same suite without committing changes) reuse the same directory, with the second run pre-clearing any *.ktstr.json files left by the first via pre_clear_run_dir_once — the directory is a last-writer-wins snapshot keyed on (kernel, project commit), not an append-only archive of every invocation.