tests: (chrt) improve skip_policy with runtime probe

The skip_policy function relied solely on "chrt --max" output to
detect kernel support for scheduling policies.  This is unreliable
for SCHED_EXT where sched_get_priority_max() returns 0 even on
kernels without CONFIG_SCHED_CLASS_EXT, causing the test to fail
with EINVAL instead of skipping gracefully.

Rework skip_policy to accept optional chrt probe arguments and
verify actual kernel support by attempting to set the policy on
the chrt process itself (--pid 0).  Cache "chrt --max" output once
at startup to avoid repeated execution.

Additionally, filter the platform-dependent runtime parameter from
do_chrt output unless --sched-runtime was explicitly used.  This
removes the need for kernel version gating on the basic batch and
other subtests, allowing them to run on all kernel versions.

Fixes: https://github.com/util-linux/util-linux/issues/4429
Signed-off-by: Karel Zak <kzak@redhat.com>
1 file changed