Skip to content

tests: (chrt) skip SCHED_EXT subtest when kernel lacks support#4452

Open
dengbo11 wants to merge 1 commit into
util-linux:masterfrom
dengbo11:fix-chrt
Open

tests: (chrt) skip SCHED_EXT subtest when kernel lacks support#4452
dengbo11 wants to merge 1 commit into
util-linux:masterfrom
dengbo11:fix-chrt

Conversation

@dengbo11

Copy link
Copy Markdown

sched_get_priority_max/min() returns 0 for SCHED_EXT even when the kernel was built without CONFIG_SCHED_CLASS_EXT, so the existing skip_policy() check (grepping chrt --max output) cannot detect the missing support. The test then fails at runtime with EINVAL rather than skipping gracefully.

Add an optional second argument to skip_policy(): when set, the function performs a runtime probe by actually trying to set the policy. Pass '--ext' for the ext subtest so unsupported kernels correctly skip the test.

Addresses: #4429

sched_get_priority_max/min() returns 0 for SCHED_EXT even when the
kernel was built without CONFIG_SCHED_CLASS_EXT, so the existing
skip_policy() check (grepping chrt --max output) cannot detect the
missing support.  The test then fails at runtime with EINVAL rather
than skipping gracefully.

Add an optional second argument to skip_policy(): when set, the
function performs a runtime probe by actually trying to set the
policy.  Pass '--ext' for the ext subtest so unsupported kernels
correctly skip the test.

Addresses: util-linux#4429
Comment thread tests/ts/chrt/chrt
fi

if [ -n "$2" ]; then
$TS_CMD_CHRT $2 0 true >/dev/null 2>&1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using --pid 0 to avoid dependence and exec true? And probably also quotes, "$2".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants