diff mbox series

syscalls/msgstress01: Set upper bound for num_messages

Message ID 20250512-fixes-msgstress01-v1-1-d335f7c131c0@suse.com
State Changes Requested
Headers show
Series syscalls/msgstress01: Set upper bound for num_messages | expand

Checks

Context Check Description
ltpci/debian_stable_s390x-linux-gnu-gcc_s390x success success
ltpci/debian_stable_powerpc64le-linux-gnu-gcc_ppc64el success success
ltpci/debian_stable_gcc success success
ltpci/debian_stable_aarch64-linux-gnu-gcc_arm64 success success
ltpci/ubuntu_jammy_gcc success success
ltpci/debian_stable_gcc success success
ltpci/fedora_latest_clang success success
ltpci/alpine_latest_gcc success success
ltpci/debian_testing_gcc success success
ltpci/ubuntu_bionic_gcc success success
ltpci/quay-io-centos-centos_stream9_gcc success success
ltpci/debian_oldstable_gcc success success
ltpci/debian_testing_clang success success
ltpci/debian_oldstable_clang success success
ltpci/opensuse-archive_42-2_gcc success success
ltpci/opensuse-leap_latest_gcc success success

Commit Message

Ricardo B. Marlière May 12, 2025, 11:23 a.m. UTC
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(+)


---
base-commit: 4a0e3a8fa7b592958f8e3cd366f63c78fba9f014
change-id: 20250512-fixes-msgstress01-4157ceb54b38

Best regards,

Comments

Martin Doucha May 12, 2025, 11:40 a.m. UTC | #1
Hi,
if num_messages is higher than avail_messages, the test should at least 
print a messages that the default value was reduced. And if the new 
value is less than half of the default, the message should be TWARN.

On 12. 05. 25 13:23, Ricardo B. Marlière wrote:
> 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,
diff mbox series

Patch

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);