All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [COMMITTED] [PATCH] mq_timedreceive_5-3: Initialize maxmsg properly
@ 2021-02-12 15:15 Cyril Hrubis
  2021-02-15  5:35 ` Joerg Vehlow
  0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2021-02-12 15:15 UTC (permalink / raw)
  To: ltp

The test can be actually executed as non-root user but the maxmsg must
be set to a value that is less by user limit for messages and since we
do not send any messages we can safely initialize it to 1.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 .../conformance/interfaces/mq_timedreceive/5-3.c               | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
index cc592f5a7..87f3365d5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
@@ -55,7 +55,8 @@ int main(void)
 	sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid());
 
 	attr.mq_msgsize = BUFFER;
-	attr.mq_maxmsg = BUFFER;
+	attr.mq_maxmsg = 1;
+
 	mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
 	if (mqdes == (mqd_t) - 1) {
 		perror(ERROR_PREFIX "mq_open");
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [COMMITTED] [PATCH] mq_timedreceive_5-3: Initialize maxmsg properly
  2021-02-12 15:15 [LTP] [COMMITTED] [PATCH] mq_timedreceive_5-3: Initialize maxmsg properly Cyril Hrubis
@ 2021-02-15  5:35 ` Joerg Vehlow
  2021-02-15 10:55   ` Cyril Hrubis
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Vehlow @ 2021-02-15  5:35 UTC (permalink / raw)
  To: ltp

Hi Cyril,

On 2/12/2021 4:15 PM, Cyril Hrubis wrote:
> The test can be actually executed as non-root user but the maxmsg must
> be set to a value that is less by user limit for messages and since we
> do not send any messages we can safely initialize it to 1.
This is applies to more than only this test. I also recognized this when 
fixing the time issue, but decided not to change it, because it is not 
the only affected test.
The max message size could be up to /proc/sys/fs/mqueue/msg_max. This is 
usually 10.

J?rg

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [COMMITTED] [PATCH] mq_timedreceive_5-3: Initialize maxmsg properly
  2021-02-15  5:35 ` Joerg Vehlow
@ 2021-02-15 10:55   ` Cyril Hrubis
  2021-02-15 11:31     ` Joerg Vehlow
  0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2021-02-15 10:55 UTC (permalink / raw)
  To: ltp

Hi!
> > The test can be actually executed as non-root user but the maxmsg must
> > be set to a value that is less by user limit for messages and since we
> > do not send any messages we can safely initialize it to 1.
> This is applies to more than only this test. I also recognized this when 
> fixing the time issue, but decided not to change it, because it is not 
> the only affected test.

Feel free to send a patch for the rest :-).

Setting the mq_maxmsg to BUFFER which is supposed to be constant for the
mq_msgsize is quite confusing and also prevents these tests from being
executed as ordinary user so I think that it's worth fixing.

> The max message size could be up to /proc/sys/fs/mqueue/msg_max. This is 
> usually 10.

Looking at the rest of the tests I guess the original author either did
not care that much or was clueless since it does not really make sense
to set mq_maxmsg to the same number as mq_msgsize in tests that send
just one or two message.

So we should either set it to 2 in all tests, or set it to 1 or 2
depending on how many messages test sends.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [COMMITTED] [PATCH] mq_timedreceive_5-3: Initialize maxmsg properly
  2021-02-15 10:55   ` Cyril Hrubis
@ 2021-02-15 11:31     ` Joerg Vehlow
  0 siblings, 0 replies; 4+ messages in thread
From: Joerg Vehlow @ 2021-02-15 11:31 UTC (permalink / raw)
  To: ltp

Hi,

On 2/15/2021 11:55 AM, Cyril Hrubis wrote:
> Feel free to send a patch for the rest :-).
Don't want to many open patches at the same time ;)
> Looking at the rest of the tests I guess the original author either did
> not care that much or was clueless since it does not really make sense
> to set mq_maxmsg to the same number as mq_msgsize in tests that send
> just one or two message.
>
> So we should either set it to 2 in all tests, or set it to 1 or 2
> depending on how many messages test sends.
Couldn't agree more

J?rg

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-15 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 15:15 [LTP] [COMMITTED] [PATCH] mq_timedreceive_5-3: Initialize maxmsg properly Cyril Hrubis
2021-02-15  5:35 ` Joerg Vehlow
2021-02-15 10:55   ` Cyril Hrubis
2021-02-15 11:31     ` Joerg Vehlow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.