pub fn sanitize_kernel_label(raw: &str) -> StringExpand description
Sanitise a kernel label (the producer-side identity emitted by
cargo ktstr’s resolver) into a nextest-safe identifier of the
shape kernel_[a-z0-9_]+.
Replaces every [^A-Za-z0-9] byte with _, lowercases, collapses
runs of _, and prefixes with kernel_. Empty / pathologically-
short input collapses to kernel_ alone, which the parser
downstream still recognises as a valid suffix (the empty
sanitized marker just won’t disambiguate two kernels — but the
producer side guarantees non-empty labels, so the empty case is
defensive only).
Example mappings:
6.14.2→kernel_6_14_26.15-rc3→kernel_6_15_rc3git_tj_sched_ext_for-next→kernel_git_tj_sched_ext_for_nextpath_linux_a3f2b1→kernel_path_linux_a3f2b1