selftests/sched_ext: Skip rt_stall on older kernels and list skipped tests
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- tools/testing/selftests/sched_ext/rt_stall.c | 5 +++++ tools/testing/selftests/sched_ext/runner.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
tools/testing/selftests/sched_ext/rt_stall.c +5 -0
@@ -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);
tools/testing/selftests/sched_ext/runner.c +7 -1
@@ -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++)
Signature · 1 line
2.48.1
Applied to sched_ext/for-7.1.
Thanks.
Signature · 1 line
tejun