[LTP] [PATCH] syscalls: add RT group scheduling check to sched_setparam03

fangqiurong fangqiurong@kylinos.cn
Wed Nov 26 09:33:05 CET 2025


Add tst_check_rt_group_sched_support() call in setup() to ensure
the test properly validates RT group scheduling support before
running SCHED_FIFO tests.

The sched_setparam03 test case failed with a TBROK status when running on cgroupv2 environments where the process was restricted from setting the real-time policy (returning EPERM).

This commit adds a call to tst_check_rt_group_sched_support() which uses the configuration message TCONF: CONFIG_RT_GROUP_SCHED not support on cgroupv2.

The test now correctly skips instead of reporting a TBROK failure due to expected kernel configuration limitations.

BEFORE:
sched_setparam03.c:47: TINFO: Testing libc variant
sched_setparam03.c:50: TBROK: sched_setscheduler(0, SCHED_FIFO, 1): EPERM (1)

Summary:
passed 0
failed 0
broken 1
skipped 0
warnings 0

NOW:
sched_setparam03.c:47: TINFO: Testing libc variant
tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
tst_cgroup.c:1543: TCONF: CONFIG_RT_GROUP_SCHED not support on cgroupv2
sched_setparam03.c:47: TINFO: Testing syscall variant
tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
tst_cgroup.c:1543: TCONF: CONFIG_RT_GROUP_SCHED not support on cgroupv2

Summary:
passed 0
failed 0
broken 0
skipped 2
warnings 0

Signed-off-by: fangqiurong <fangqiurong@kylinos.cn>
---
 testcases/kernel/syscalls/sched_setparam/sched_setparam03.c | 1 +
 testcases/realtime/func/sched_football/sched_football.c     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
index a8effcadb..a86ed85c5 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
@@ -45,6 +45,7 @@ void setup(void)
 	struct sched_param p = { .sched_priority = 1 };
 
 	tst_res(TINFO, "Testing %s variant", tv->desc);
+	tst_check_rt_group_sched_support();
 
 	if (tv->sched_setscheduler(0, SCHED_FIFO, &p))
 		tst_brk(TBROK | TERRNO, "sched_setscheduler(0, SCHED_FIFO, 1)");
diff --git a/testcases/realtime/func/sched_football/sched_football.c b/testcases/realtime/func/sched_football/sched_football.c
index 4465bdde8..93d711146 100644
--- a/testcases/realtime/func/sched_football/sched_football.c
+++ b/testcases/realtime/func/sched_football/sched_football.c
@@ -161,6 +161,7 @@ static void do_test(void)
 
 	tst_res(TINFO, "players_per_team: %d game_length: %d",
 	       players_per_team, game_length);
+	tst_check_rt_group_sched_support();
 
 	/* total = offense + defense + fans + referee */
 	pthread_barrier_init(&start_barrier, NULL, players_per_team * 4 + 1);
-- 
2.25.1



More information about the ltp mailing list