summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Yang Chou <yphbchou0911@gmail.com>2026-03-25 03:14:04 +0800
committerTejun Heo <tj@kernel.org>2026-03-24 10:33:25 -1000
commit7ef26d62f3fd841fd18ab6fa93a6bc2de9d17dff (patch)
tree248b76ba190febf35a847380ec4aedd4a7ba9479
parent9edd04c4189e047d4b4f6efd1255e2a32cb167b8 (diff)
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 cd959a356205 ("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>
-rw-r--r--tools/testing/selftests/sched_ext/rt_stall.c5
-rw-r--r--tools/testing/selftests/sched_ext/runner.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/tools/testing/selftests/sched_ext/rt_stall.c b/tools/testing/selftests/sched_ext/rt_stall.c
index 81ea9b4883e5..a5041fc2e44f 100644
--- a/tools/testing/selftests/sched_ext/rt_stall.c
+++ b/tools/testing/selftests/sched_ext/rt_stall.c
@@ -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);
diff --git a/tools/testing/selftests/sched_ext/runner.c b/tools/testing/selftests/sched_ext/runner.c
index 4c68efa1512a..d84f71eee049 100644
--- a/tools/testing/selftests/sched_ext/runner.c
+++ b/tools/testing/selftests/sched_ext/runner.c
@@ -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++)