Re: [PATCH] selftests: sched: add sched as a default selftest target

From: Shan
Date: Thu Feb 20 2025 - 09:53:14 EST


On 20-02-2025 01:15 pm, Shrikanth Hegde wrote:


On 2/19/25 12:16, Sinadin Shan wrote:
The sched tests are missing a target entry and hence out-of-tree build
support.

For instance:
make -C tools/testing/selftests install INSTALL_LOCATION=/foo/bar

is expected to build the sched tests and place them at /foo/bar.
But this is not observed since a TARGET entry is not present for sched.

This was suggested by Shuah in this conversation
Link: https://lore.kernel.org/linux-kselftest/60dd0240-8e45-4958- acf2-7eeee917785b@xxxxxxxxxxxxxxxxxxx/

Add support for sched selftests by adding sched as a default TARGET

Signed-off-by: Sinadin Shan <sinadin.shan@xxxxxxxxxx>
---
  tools/testing/selftests/Makefile | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/ selftests/Makefile
index 8daac70c2f9d2..e2d0d389ad912 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -91,6 +91,7 @@ TARGETS += rlimits
  TARGETS += rseq
  TARGETS += rtc
  TARGETS += rust
+TARGETS += sched
  TARGETS += sched_ext
  TARGETS += seccomp
  TARGETS += sgx

There is only one test currently in sched: i.e cs_prctl_test.c. to see the cookies validation when core scheduling is in effect.

If CONFIG_SCHED_CORE=n, the test fails. So you might end up seeing default selftests failing on such systems? or this is only compiling?>

Yes, this patch would enable the test to be compiled and run by default.

Likely the selftests/sched needs to modified for CONFIG_SCHED_CORE=n

Agree. Chris, I suppose then a graceful skip would be a more right option for kernels with core scheduling disabled?

Regards,
Shan


When CONFIG_SCHED_CORE=n
./cs_prctl_test

## Create a thread/process/process group hierarchy
Not a core sched system
...
Not a core sched system
(283) FAILED: get_cs_cookie(0) == 0