syscalls/msgstress01: Set upper bound for num_messages
PATCH v2 1/1 syscalls/msgstress01: Set upper bound for num_messages
From: Ricardo B. Marlière <[email protected]>
The msgstress01 test has a workaround to limit the amount of processes it will spawn, but it is only used if the option str_num_messages (-n) is passed. This is known to be problematic in low memory SUTs, so make sure it's used.
---
Changes in v2:
- Print a message if num_messages value is reduced
- Link to v1: https://lore.kernel.org/r/[email protected]
--- testcases/kernel/syscalls/ipc/msgstress/msgstress01.c | 8 ++++++++ 1 file changed, 8 insertions(+)
testcases/kernel/syscalls/ipc/msgstress/msgstress01.c +8 -0
@@ -271,6 +271,14 @@ static void setup(void)if (tst_parse_int (str_num_messages, &num_messages,1 , avail_msg))tst_brk (TBROK ,"Invalid number of messages '%s'" , str_num_messages); +if (num_messages > avail_msg) { +if (avail_msg < num_messages /2 ) +tst_res (TWARN ,"Number of messages reduced to %d" , avail_msg); +else +tst_res (TINFO ,"Number of messages reduced to %d" , avail_msg); + num_messages = avail_msg; + } +if (tst_parse_int (str_num_iterations, &num_iterations,1 ,MAXNREPS ))tst_brk (TBROK ,"Invalid number of messages iterations '%s'" , str_num_iterations);
---
base-commit: 4a0e3a8fa7b592958f8e3cd366f63c78fba9f014
change-id: 20250512-fixes-msgstress01-4157ceb54b38
Best regards,
Signature · 5 lines
Ricardo B. Marlière <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
testcases/kernel/syscalls/ipc/msgstress/msgstress01.c static void setup(void) · line 280
Quoted 7 lines · Ricardo B. Marlière via ltp
testcases/kernel/syscalls/ipc/msgstress/msgstress01.c +7
-0+if (num_messages > avail_msg) { +if (avail_msg < num_messages /2 ) +tst_res (TWARN ,"Number of messages reduced to %d" , avail_msg); +else +tst_res (TINFO ,"Number of messages reduced to %d" , avail_msg); + num_messages = avail_msg; + }
We can simplify with:
tst_res(
avail_msg < num_messages / 2 ? TWARN : TINFO, "Number of messages reduced to %d", avail_msg);
- Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp