From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/2] msgget03: don't depend on existed shared resources
Date: Thu, 22 Jul 2021 09:55:19 +0200 [thread overview]
Message-ID: <YPkkZ0Zq9DyHKBaT@pevik> (raw)
In-Reply-To: <20210712075223.10682-2-aleksei.kodanev@bell-sw.com>
Hi Alexey, Li,
> It's unlikely, but still possible that some of them could be
> created/released during the test as well, so the patch only
> checks errno.
> Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
> ---
> v2: * Move the loop to the test run function and try to get
> ENOSPC errno there.
> .../kernel/syscalls/ipc/msgget/msgget03.c | 31 ++++++++++---------
> 1 file changed, 16 insertions(+), 15 deletions(-)
> diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget03.c b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
> index 76cf82cd3..1ade8f942 100644
> --- a/testcases/kernel/syscalls/ipc/msgget/msgget03.c
> +++ b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
> @@ -26,29 +26,30 @@ static key_t msgkey;
> static void verify_msgget(void)
> {
> - TST_EXP_FAIL2(msgget(msgkey + maxmsgs, IPC_CREAT | IPC_EXCL), ENOSPC,
> - "msgget(%i, %i)", msgkey + maxmsgs, IPC_CREAT | IPC_EXCL);
> + int res = 0, num;
> +
> + errno = 0;
> + for (num = 0; num <= maxmsgs; ++num) {
In different patch [1] (I forget you already send patches to fix this) I counted
items in /proc/sysvipc/shm. Not sure what is safer: <= looks a bit drastic
(how about bug which reports ENOSPC much earlier than it should be?), but
obviously new mapping from other program created in the middle of testing.
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/project/ltp/patch/20210722073523.5099-1-pvorel@suse.cz/
> + res = msgget(msgkey + num, IPC_CREAT | IPC_EXCL);
> + if (res == -1)
> + break;
> + queues[queue_cnt++] = res;
> + }
> +
> + if (res != -1 || errno != ENOSPC)
> + tst_brk(TFAIL | TERRNO, "Failed to trigger ENOSPC error");
> +
> + tst_res(TPASS, "Maximum number of queues reached (%d), used by test %d",
> + maxmsgs, queue_cnt);
> }
...
next prev parent reply other threads:[~2021-07-22 7:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-12 7:52 [LTP] [PATCH v2 1/2] shmget03: don't depend on existed shared resources Alexey Kodanev
2021-07-12 7:52 ` [LTP] [PATCH v2 2/2] msgget03: " Alexey Kodanev
2021-07-22 7:55 ` Petr Vorel [this message]
2021-07-22 12:14 ` Cyril Hrubis
2021-07-22 13:01 ` Petr Vorel
2021-07-22 13:02 ` Cyril Hrubis
2021-07-23 8:46 ` xuyang2018.jy
2021-07-23 12:24 ` Petr Vorel
2021-07-27 5:51 ` xuyang2018.jy
2021-08-04 1:45 ` xuyang2018.jy
2021-08-04 14:48 ` Cyril Hrubis
2021-08-04 15:45 ` Petr Vorel
2021-08-05 3:43 ` xuyang2018.jy
2021-08-05 6:36 ` Petr Vorel
2021-08-05 6:58 ` xuyang2018.jy
2021-07-23 12:11 ` Petr Vorel
2021-07-12 8:28 ` [LTP] [PATCH v2 1/2] shmget03: " Li Wang
2021-07-12 8:37 ` Alexey Kodanev
2021-07-12 8:42 ` Li Wang
2021-07-12 8:55 ` Li Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YPkkZ0Zq9DyHKBaT@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.