sanitize_kernel_label

Function sanitize_kernel_label 

Source
pub fn sanitize_kernel_label(raw: &str) -> String
Expand 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.2kernel_6_14_2
  • 6.15-rc3kernel_6_15_rc3
  • git_tj_sched_ext_for-nextkernel_git_tj_sched_ext_for_next
  • path_linux_a3f2b1kernel_path_linux_a3f2b1