All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Maennich <maennich@google.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/2] rt_sigpending: add rt_sigpending02 test case
Date: Tue, 12 Feb 2019 16:12:36 +0000	[thread overview]
Message-ID: <20190212161236.74385-3-maennich@google.com> (raw)
In-Reply-To: <20190212161236.74385-1-maennich@google.com>

This is effectively a copy of the sigpending/sigpending02 test case.
Both of them are now bypassing any syscall wrapper.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 runtest/syscalls                              |  1 +
 .../kernel/syscalls/rt_sigpending/.gitignore  |  1 +
 .../kernel/syscalls/rt_sigpending/Makefile    | 23 +++++++++
 .../syscalls/rt_sigpending/rt_sigpending02.c  | 48 +++++++++++++++++++
 4 files changed, 73 insertions(+)
 create mode 100644 testcases/kernel/syscalls/rt_sigpending/.gitignore
 create mode 100644 testcases/kernel/syscalls/rt_sigpending/Makefile
 create mode 100644 testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c

diff --git a/runtest/syscalls b/runtest/syscalls
index 668c87cd1..6280034d0 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -990,6 +990,7 @@ rmdir03A symlink01 -T rmdir03
 rt_sigaction01 rt_sigaction01
 rt_sigaction02 rt_sigaction02
 rt_sigaction03 rt_sigaction03
+rt_sigpending02 rt_sigpending02
 rt_sigprocmask01 rt_sigprocmask01
 rt_sigprocmask02 rt_sigprocmask02
 rt_sigqueueinfo01 rt_sigqueueinfo01
diff --git a/testcases/kernel/syscalls/rt_sigpending/.gitignore b/testcases/kernel/syscalls/rt_sigpending/.gitignore
new file mode 100644
index 000000000..85905fc83
--- /dev/null
+++ b/testcases/kernel/syscalls/rt_sigpending/.gitignore
@@ -0,0 +1 @@
+/rt_sigpending02
diff --git a/testcases/kernel/syscalls/rt_sigpending/Makefile b/testcases/kernel/syscalls/rt_sigpending/Makefile
new file mode 100644
index 000000000..bd617d806
--- /dev/null
+++ b/testcases/kernel/syscalls/rt_sigpending/Makefile
@@ -0,0 +1,23 @@
+#
+#  Copyright (c) International Business Machines  Corp., 2001
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c b/testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c
new file mode 100644
index 000000000..06d1c1578
--- /dev/null
+++ b/testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  Copyright (c) International Business Machines  Corp., 2002
+ *
+ * AUTHORS
+ *	Paul Larson
+ *
+ * DESCRIPTION
+ *	Test to see that the proper errors are returned by rt_sigpending
+ *
+ *	Test 1:
+ *		Call rt_sigpending(sigset_t*=-1, SIGSETSIZE),
+ *		it should return -1 with errno EFAULT
+ */
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+
+#include "tst_test.h"
+#include "ltp_signal.h"
+#include "lapi/syscalls.h"
+
+static void run(void)
+{
+	/* set sigset to point to an invalid location */
+	sigset_t *sigset = (sigset_t *) - 1;
+
+	TEST(tst_syscall(__NR_rt_sigpending, sigset, SIGSETSIZE));
+
+	/* check return code */
+	if (TST_RET == -1) {
+		if (TST_ERR != EFAULT) {
+			tst_res(TFAIL | TTERRNO,
+				"rt_sigpending() Failed with wrong errno, "
+				"expected errno=%d, got ", EFAULT);
+		} else {
+			tst_res(TPASS | TTERRNO, "expected failure");
+		}
+	} else {
+		tst_res(TFAIL,
+			"rt_sigpending() Failed, expected return value=-1, got %ld", TST_RET);
+	}
+}
+
+static struct tst_test test = {
+	.test_all = run
+};
-- 
2.20.1.791.gb4d0f1c61a-goog


  parent reply	other threads:[~2019-02-12 16:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 15:51 [LTP] [PATCH v1] sigpending: use direct syscall Matthias Maennich
2019-02-07 18:58 ` Steve Muckle
2019-02-11  8:28   ` Matthias =?unknown-8bit?q?M=C3=A4nnich?=
2019-02-12 16:12 ` [LTP] [PATCH v2 0/2] sigpending / rt_sigpending Matthias Maennich
2019-02-12 16:12   ` [LTP] [PATCH v2 1/2] sigpending: use direct syscall Matthias Maennich
2019-02-15 23:47     ` Steve Muckle
2019-02-12 16:12   ` Matthias Maennich [this message]
2019-02-16  0:01     ` [LTP] [PATCH v2 2/2] rt_sigpending: add rt_sigpending02 test case Steve Muckle
2019-02-19 14:28       ` Matthias =?unknown-8bit?q?M=C3=A4nnich?=
2019-02-19 17:57         ` Steve Muckle
2019-03-01 10:41           ` Petr Vorel

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=20190212161236.74385-3-maennich@google.com \
    --to=maennich@google.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.