[PATCH] starvation: honor -t instead of calibrating

Victor Cheng-Yen Yang via ltp <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
tst_parse_int() returns 0 both when the option is absent and when it
parses successfully, so its return value cannot distinguish the two.

Use the zero-initialized timeout as the "not set" sentinel and skip
calibration entirely when -t is supplied correctly.

Signed-off-by: Victor Cheng-Yen Yang <cyyang772-MUIXKm3Oiri1Z/[email protected]>
---
 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 045254ba4..ff041bdcd 100644
--- a/testcases/kernel/sched/cfs-scheduler/starvation.c
+++ b/testcases/kernel/sched/cfs-scheduler/starvation.c
@@ -107,7 +107,8 @@ static void setup(void)
 
 	if (tst_parse_int(str_timeout, &timeout, 1, INT_MAX))
 		tst_brk(TBROK, "Invalid number of timeout '%s'", str_timeout);
-	else
+
+	if (!timeout)
 		timeout = callibrate() / 1000;
 
 	if (tst_has_slow_kconfig())
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.