From: Avinesh Kumar <akumar@suse.de>
To: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] Add epoll_create1_03 test
Date: Mon, 10 Oct 2022 11:53:17 +0530 [thread overview]
Message-ID: <8145468.T7Z3S40VBb@localhost> (raw)
In-Reply-To: <20221007083406.16036-1-andrea.cervesato@suse.com>
Hi Andrea,
On Friday, October 7, 2022 2:04:06 PM IST Andrea Cervesato via ltp wrote:
> The test verifies epoll_create1 will raises EMFILE when
> /proc/sys/fs/epoll/max_user_watches is reached.
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> .../syscalls/epoll_create1/epoll_create1_03.c | 34 +++++++++++++++++++
> 1 file changed, 34 insertions(+)
> create mode 100644 testcases/kernel/syscalls/epoll_create1/epoll_create1_03.c
>
> diff --git a/testcases/kernel/syscalls/epoll_create1/epoll_create1_03.c b/testcases/kernel/syscalls/epoll_create1/epoll_create1_03.c
> new file mode 100644
> index 000000000..7f51edf7a
> --- /dev/null
> +++ b/testcases/kernel/syscalls/epoll_create1/epoll_create1_03.c
> @@ -0,0 +1,34 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2022 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +/*\
> + * [Description]
> + *
> + * Verify that epoll_create1 returns -1 and set errno to EMFILE when maximum
> + * number of epoll watchers is reached.
> + */
> +
> +#include <sys/epoll.h>
> +
> +#include "tst_test.h"
> +#include "lapi/epoll.h"
> +#include "lapi/syscalls.h"
> +
> +static void run(void)
> +{
> + int i, max_inst;
> +
> + SAFE_FILE_LINES_SCANF("/proc/sys/fs/epoll/max_user_watches", "%d", &max_inst);
> +
> + for (i = 0; i < max_inst; i++)
> + TST_EXP_PASS_SILENT(epoll_create1(0) == 0);
I don't think this is correct,
epoll_create1(0) will return a file descriptor (a nonnegative integer).
And IIUC, TST_EXP_PASS* macros take a function call only and not a compare statement.
> +
> + TST_EXP_FAIL(epoll_create1(0), EMFILE);
> +}
> +
> +static struct tst_test test = {
> + .min_kver = "2.6.27",
> + .test_all = run,
> +};
>
Also,
Test reports TBROK if run for more than one iteration -
$ ./epoll_create1_03 -i2
tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
epoll_create1_03.c:28: TPASS: epoll_create1(0) : EMFILE (24)
epoll_create1_03.c:23: TBROK: Failed to open FILE '/proc/sys/fs/epoll/max_user_watches' for reading: EMFILE (24)
Kind Regards,
Avinesh
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-10-10 6:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 8:34 [LTP] [PATCH v1] Add epoll_create1_03 test Andrea Cervesato via ltp
2022-10-10 6:23 ` Avinesh Kumar [this message]
2022-10-10 7:09 ` Andrea Cervesato via ltp
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=8145468.T7Z3S40VBb@localhost \
--to=akumar@suse.de \
--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.