selftests/sched_ext: Skip rt_stall on older kernels and list skipped tests

rt_stall tests the ext DL server which was introduced in commit
cd959a3562 ("sched_ext: Add a DL server for sched_ext tasks").
On older kernels that lack this feature, the test calls ksft_exit_fail()
internally which terminates the entire runner process, preventing
subsequent tests from running.

Add a guard in setup() that checks for the ext_server field in struct rq
via __COMPAT_struct_has_field() and returns SCX_TEST_SKIP if not present.

Also print the names of skipped tests in the results summary, mirroring
the existing behavior for failed tests.

Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Cheng-Yang Chou
2026-03-25 03:14:04 +08:00
committed by Tejun Heo
parent 9edd04c418
commit 7ef26d62f3
2 changed files with 12 additions and 1 deletions

View File

@@ -119,6 +119,11 @@ static enum scx_test_status setup(void **ctx)
{
struct rt_stall *skel;
if (!__COMPAT_struct_has_field("rq", "ext_server")) {
fprintf(stderr, "SKIP: ext DL server not supported\n");
return SCX_TEST_SKIP;
}
skel = rt_stall__open();
SCX_FAIL_IF(!skel, "Failed to open");
SCX_ENUM_INIT(skel);

View File

@@ -134,6 +134,7 @@ int main(int argc, char **argv)
{
const char *filter = NULL;
const char *failed_tests[MAX_SCX_TESTS];
const char *skipped_tests[MAX_SCX_TESTS];
unsigned testnum = 0, i;
unsigned passed = 0, skipped = 0, failed = 0;
int opt;
@@ -199,7 +200,7 @@ int main(int argc, char **argv)
passed++;
break;
case SCX_TEST_SKIP:
skipped++;
skipped_tests[skipped++] = test->name;
break;
case SCX_TEST_FAIL:
failed_tests[failed++] = test->name;
@@ -211,6 +212,11 @@ int main(int argc, char **argv)
printf("PASSED: %u\n", passed);
printf("SKIPPED: %u\n", skipped);
printf("FAILED: %u\n", failed);
if (skipped > 0) {
printf("\nSkipped tests:\n");
for (i = 0; i < skipped; i++)
printf(" - %s\n", skipped_tests[i]);
}
if (failed > 0) {
printf("\nFailed tests:\n");
for (i = 0; i < failed; i++)