All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xie Ziyao <xieziyao@huawei.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 5/7] epoll_create1: Add test for epoll_create1_02
Date: Tue, 17 Aug 2021 14:49:22 +0800	[thread overview]
Message-ID: <20210817064924.127970-6-xieziyao@huawei.com> (raw)
In-Reply-To: <20210817064924.127970-1-xieziyao@huawei.com>

Verify that epoll_create1 returns -1 and set errno to EINVAL with an invalid
value specified in flags.

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
 runtest/syscalls                              |  1 +
 .../kernel/syscalls/epoll_create1/.gitignore  |  3 +-
 .../syscalls/epoll_create1/epoll_create1_02.c | 38 +++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/runtest/syscalls b/runtest/syscalls
index b28d19ac7..f6fe140b2 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -157,6 +157,7 @@ dup3_01 dup3_01
 dup3_02 dup3_02

 epoll_create1_01 epoll_create1_01
+epoll_create1_02 epoll_create1_02
 epoll01 epoll-ltp
 epoll_ctl01 epoll_ctl01
 epoll_ctl02 epoll_ctl02
diff --git a/testcases/kernel/syscalls/epoll_create1/.gitignore b/testcases/kernel/syscalls/epoll_create1/.gitignore
index 7de2e4231..3e0482de9 100644
--- a/testcases/kernel/syscalls/epoll_create1/.gitignore
+++ b/testcases/kernel/syscalls/epoll_create1/.gitignore
@@ -1 +1,2 @@
-/epoll_create1_01
+epoll_create1_01
+epoll_create1_02
diff --git a/testcases/kernel/syscalls/epoll_create1/epoll_create1_02.c b/testcases/kernel/syscalls/epoll_create1/epoll_create1_02.c
index e69de29bb..2308a65d6 100644
--- a/testcases/kernel/syscalls/epoll_create1/epoll_create1_02.c
+++ b/testcases/kernel/syscalls/epoll_create1/epoll_create1_02.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
+ * Author: Xie Ziyao <xieziyao@huawei.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Verify that epoll_create1 returns -1 and set errno to EINVAL with an invalid
+ * value specified in flags.
+ */
+
+#include <sys/epoll.h>
+
+#include "tst_test.h"
+#include "lapi/epoll.h"
+#include "lapi/syscalls.h"
+
+static struct test_case_t {
+	int flags;
+	int exp_err;
+	const char *desc;
+} tc[] = {
+	{-1, EINVAL, "-1"},
+	{EPOLL_CLOEXEC + 1, EINVAL, "EPOLL_CLOEXEC+1"}
+};
+
+static void run(unsigned int n)
+{
+	TST_EXP_FAIL(tst_syscall(__NR_epoll_create1, tc[n].flags),
+		     tc[n].exp_err, "create(%s)", tc[n].desc);
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tc),
+	.test = run,
+};
--
2.17.1


  parent reply	other threads:[~2021-08-17  6:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17  6:49 [LTP] [PATCH 0/7] epoll: Add more basic test for epoll_{create, create1, ctl} Xie Ziyao
2021-08-17  6:49 ` [LTP] [PATCH 1/7] epoll_ctl: Add docparse formatting and cleanup for epoll_ctl01 Xie Ziyao
2021-08-24 15:23   ` Cyril Hrubis
2021-08-17  6:49 ` [LTP] [PATCH 2/7] epoll_ctl: Add docparse formatting and cleanup for epoll_ctl02 Xie Ziyao
2021-08-24 15:24   ` Cyril Hrubis
2021-08-17  6:49 ` [LTP] [PATCH 3/7] epoll_ctl: Add test for epoll_ctl03 Xie Ziyao
2021-08-24 15:38   ` Cyril Hrubis
2021-08-26  2:02     ` Xie Ziyao
2021-08-17  6:49 ` [LTP] [PATCH 4/7] epoll_create1: Add docparse formatting and cleanup for epoll_create1_01 Xie Ziyao
2021-08-25  9:46   ` Cyril Hrubis
2021-08-17  6:49 ` Xie Ziyao [this message]
2021-08-25 11:35   ` [LTP] [PATCH 5/7] epoll_create1: Add test for epoll_create1_02 Cyril Hrubis
2021-08-17  6:49 ` [LTP] [PATCH 6/7] epoll_create: Add test for epoll_create01 Xie Ziyao
2021-08-25 12:00   ` Cyril Hrubis
2021-08-17  6:49 ` [LTP] [PATCH 7/7] epoll_create: Add test for epoll_create02 Xie Ziyao
2021-08-25 12:01   ` Cyril Hrubis

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=20210817064924.127970-6-xieziyao@huawei.com \
    --to=xieziyao@huawei.com \
    --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.