[LTP] [PATCH] syscalls/msgstress01: Set upper bound for num_messages

Ricardo B. Marlière rbm@suse.com
Mon May 12 13:23:20 CEST 2025


From: Ricardo B. Marlière <rbm@suse.com>

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 add a MIN()
to force the value of avail_msg into num_messages.

Suggested-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
Hello,

as discussed through Github [1], here's the proposed fix.

Thank you,
rbm

[1] https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/21977
---
 testcases/kernel/syscalls/ipc/msgstress/msgstress01.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
index ae637e5d7ad89c1257c9cce0145122497c19ee64..3525b0b2b973b174ac8df089580a85c19057f05e 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
+++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
@@ -271,6 +271,8 @@ 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);
 
+	num_messages = MIN(avail_msg, num_messages);
+
 	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,
-- 
Ricardo B. Marlière <rbm@suse.com>



More information about the ltp mailing list