[LTP] [PATCH v5 1/2] sched/starvation: Fix sched_setaffinity return check
Edward Liaw
edliaw@google.com
Wed Jun 19 18:28:06 CEST 2024
From: Edward Liaw via ltp <ltp@lists.linux.it>
TST_EXP_POSITIVE to check the return value is incorrect because
sched_setaffinity returns 0 on success / -1 on failure.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Edward Liaw <edliaw@google.com>
---
testcases/kernel/sched/cfs-scheduler/starvation.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/sched/cfs-scheduler/starvation.c b/testcases/kernel/sched/cfs-scheduler/starvation.c
index eb9fd6ff5..c845af849 100644
--- a/testcases/kernel/sched/cfs-scheduler/starvation.c
+++ b/testcases/kernel/sched/cfs-scheduler/starvation.c
@@ -54,7 +54,8 @@ static void setup(void)
CPU_SET(0, &mask);
- TST_EXP_POSITIVE(sched_setaffinity(0, sizeof(mask), &mask));
+ if (sched_setaffinity(0, sizeof(mask), &mask) < 0)
+ tst_brk(TBROK | TERRNO, "sched_setaffinity() failed");
if (tst_parse_long(str_loop, &loop, 1, LONG_MAX))
tst_brk(TBROK, "Invalid number of loop number '%s'", str_loop);
--
2.45.2.627.g7a2c4fd464-goog
More information about the ltp
mailing list