* [LTP] [PATCH 1/1] sigpending: Use 3 variants via test_multiplex()
@ 2019-03-25 15:14 Petr Vorel
2019-03-26 10:10 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2019-03-25 15:14 UTC (permalink / raw)
To: ltp
We're now testing sigpending() libc wrapper, __NR_sigpending and
__NR_rt_sigpending syscalls.
This brings again testing libc sigpending() implementation, which was
removed in
63f8a3f77 ("sigpending: use direct syscall")
and removes sharing code and directory rt_sigpending introduced in
b03885fff ("rt_sigpending02: reuse code from sigpending02")
+ removed unused headers.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,
this patch expects Cyril's multiplex function [1] be merged.
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/project/ltp/list/?series=98725&state=*
---
runtest/syscalls | 1 -
.../kernel/syscalls/rt_sigpending/.gitignore | 1 -
.../kernel/syscalls/rt_sigpending/Makefile | 15 ----
.../kernel/syscalls/sigpending/sigpending02.c | 74 +++++++++++--------
4 files changed, 44 insertions(+), 47 deletions(-)
delete mode 100644 testcases/kernel/syscalls/rt_sigpending/.gitignore
delete mode 100644 testcases/kernel/syscalls/rt_sigpending/Makefile
diff --git a/runtest/syscalls b/runtest/syscalls
index a13d51918..e52f80bef 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1001,7 +1001,6 @@ 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
deleted file mode 100644
index 85905fc83..000000000
--- a/testcases/kernel/syscalls/rt_sigpending/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/rt_sigpending02
diff --git a/testcases/kernel/syscalls/rt_sigpending/Makefile b/testcases/kernel/syscalls/rt_sigpending/Makefile
deleted file mode 100644
index 57ba3dac2..000000000
--- a/testcases/kernel/syscalls/rt_sigpending/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019, Linux Test Project
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-CPPFLAGS += -DTEST_RT_SIGPENDING
-
-rt_sigpending02: $(abs_srcdir)/../sigpending/sigpending02.c
- $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
-
-MAKE_TARGETS := rt_sigpending02
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/sigpending/sigpending02.c b/testcases/kernel/syscalls/sigpending/sigpending02.c
index 94e51bb16..ce0d2ff79 100644
--- a/testcases/kernel/syscalls/sigpending/sigpending02.c
+++ b/testcases/kernel/syscalls/sigpending/sigpending02.c
@@ -1,40 +1,52 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) International Business Machines Corp., 2002
+ * Copyright (c) International Business Machines Corp., 2002
+ * Copyright (c) Linux Test Project, 2009-2019
*
* AUTHORS
- * Paul Larson
- * Matthias Maennich
+ * Paul Larson
+ * Matthias Maennich
*
* DESCRIPTION
- * Test to assert basic functionality of sigpending. All the tests can also be
- * compiled to use the rt_sigpending syscall instead. To simplify the
- * documentation, only sigpending() is usually mentioned below.
- *
- * Test 1:
- * Suppress handling SIGUSR1 and SIGUSR1, raise them and assert their
- * signal pending.
- *
- * Test 2:
- * Call sigpending(sigset_t*=-1), it should return -1 with errno EFAULT
+ * Test 1: Suppress handling SIGUSR1 and SIGUSR1, raise them and assert their
+ * signal pending.
+ * Test 2: Call sigpending(sigset_t*=-1), 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"
-#if defined(TEST_SIGPENDING)
-#define tested_sigpending(sigset) TEST(tst_syscall(__NR_sigpending, sigset))
-#elif defined(TEST_RT_SIGPENDING)
-#define tested_sigpending(sigset) \
- TEST(tst_syscall(__NR_rt_sigpending, sigset, SIGSETSIZE))
-#else
-#error Neither TEST_SIGPENDING nor TEST_RT_SIGPENDING is defined!
-#endif
+static void sigpending_info(void)
+{
+ switch (tst_variant) {
+ case 0:
+ tst_res(TINFO, "Testing libc sigpending()");
+ break;
+ case 1:
+ tst_res(TINFO, "Testing __NR_sigpending syscall");
+ break;
+ case 2:
+ tst_res(TINFO, "Testing __NR_rt_sigpending syscall");
+ break;
+ }
+}
+
+static int tested_sigpending(sigset_t *sigset)
+{
+ switch (tst_variant) {
+ case 0:
+ return sigpending(sigset);
+ break;
+ case 1:
+ return tst_syscall(__NR_sigpending, sigset);
+ break;
+ case 2:
+ return tst_syscall(__NR_rt_sigpending, sigset, SIGSETSIZE);
+ break;
+ }
+ return -1;
+}
static int sighandler_counter;
static void sighandler(int signum LTP_ATTRIBUTE_UNUSED)
@@ -62,7 +74,7 @@ static void test_sigpending(void)
/* Initially no signal should be pending */
sigset_t pending;
sigemptyset(&pending);
- tested_sigpending(&pending);
+ TEST(tested_sigpending(&pending));
for (i = 1; i < SIGMAX; ++i)
if (sigismember(&pending, i))
@@ -78,7 +90,7 @@ static void test_sigpending(void)
/* now we should have exactly one pending signal (SIGUSR1) */
sigemptyset(&pending);
- tested_sigpending(&pending);
+ TEST(tested_sigpending(&pending));
for (i = 1; i < SIGMAX; ++i)
if ((i == SIGUSR1) != sigismember(&pending, i))
tst_brk(TFAIL, "only SIGUSR1 should be pending by now");
@@ -92,7 +104,7 @@ static void test_sigpending(void)
/* now we should have exactly two pending signals (SIGUSR1, SIGUSR2) */
sigemptyset(&pending);
- tested_sigpending(&pending);
+ TEST(tested_sigpending(&pending));
for (i = 1; i < SIGMAX; ++i)
if ((i == SIGUSR1 || i == SIGUSR2) != sigismember(&pending, i))
tst_brk(TFAIL,
@@ -119,7 +131,7 @@ static void test_efault_on_invalid_sigset(void)
/* set sigset to point to an invalid location */
sigset_t *sigset = tst_get_bad_addr(NULL);
- tested_sigpending(sigset);
+ TEST(tested_sigpending(sigset));
/* check return code */
if (TST_RET == -1) {
@@ -139,10 +151,12 @@ static void test_efault_on_invalid_sigset(void)
static void run(void)
{
+ sigpending_info();
test_sigpending();
test_efault_on_invalid_sigset();
}
static struct tst_test test = {
- .test_all = run
+ .test_all = run,
+ .test_variants = 3,
};
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH 1/1] sigpending: Use 3 variants via test_multiplex()
2019-03-25 15:14 [LTP] [PATCH 1/1] sigpending: Use 3 variants via test_multiplex() Petr Vorel
@ 2019-03-26 10:10 ` Cyril Hrubis
2019-03-26 10:47 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2019-03-26 10:10 UTC (permalink / raw)
To: ltp
Hi!
> static void run(void)
> {
> + sigpending_info();
> test_sigpending();
> test_efault_on_invalid_sigset();
> }
>
> static struct tst_test test = {
> - .test_all = run
> + .test_all = run,
> + .test_variants = 3,
> };
I would rather see .setup = singpending_info, here so that we don't spam
the output that much, otherwise it looks good.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH 1/1] sigpending: Use 3 variants via test_multiplex()
2019-03-26 10:10 ` Cyril Hrubis
@ 2019-03-26 10:47 ` Petr Vorel
2019-03-26 10:58 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2019-03-26 10:47 UTC (permalink / raw)
To: ltp
Hi Cyril,
> Hi!
> > static void run(void)
> > {
> > + sigpending_info();
> > test_sigpending();
> > test_efault_on_invalid_sigset();
> > }
> > static struct tst_test test = {
> > - .test_all = run
> > + .test_all = run,
> > + .test_variants = 3,
> > };
> I would rather see .setup = singpending_info, here so that we don't spam
> the output that much, otherwise it looks good.
No problem, but with the following diff is the output the same. Am I missing
something?
Kind regards,
Petr
+++ testcases/kernel/syscalls/sigpending/sigpending02.c
@@ -151,12 +151,12 @@ static void test_efault_on_invalid_sigset(void)
static void run(void)
{
- sigpending_info();
test_sigpending();
test_efault_on_invalid_sigset();
}
static struct tst_test test = {
+ .setup = sigpending_info,
.test_all = run,
.test_variants = 3,
};
---
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
sigpending02.c:24: INFO: Testing libc sigpending()
sigpending02.c:113: PASS: basic sigpending test successful
sigpending02.c:143: PASS: expected failure: EFAULT
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
sigpending02.c:27: INFO: Testing __NR_sigpending syscall
sigpending02.c:42: CONF: syscall(-1) __NR_sigpending not supported
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
sigpending02.c:30: INFO: Testing __NR_rt_sigpending syscall
sigpending02.c:113: PASS: basic sigpending test successful
sigpending02.c:143: PASS: expected failure: EFAULT
Summary:
passed 4
failed 0
skipped 0
warnings 0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH 1/1] sigpending: Use 3 variants via test_multiplex()
2019-03-26 10:47 ` Petr Vorel
@ 2019-03-26 10:58 ` Cyril Hrubis
2019-03-26 11:02 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2019-03-26 10:58 UTC (permalink / raw)
To: ltp
Hi!
> > > static struct tst_test test = {
> > > - .test_all = run
> > > + .test_all = run,
> > > + .test_variants = 3,
> > > };
>
> > I would rather see .setup = singpending_info, here so that we don't spam
> > the output that much, otherwise it looks good.
>
> No problem, but with the following diff is the output the same. Am I missing
> something?
Ah, my bad, we are using test_all instead of test function, so indeed
the output is the same. I blame it on ENOCOFFEE error my brain reported
in the morning.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH 1/1] sigpending: Use 3 variants via test_multiplex()
2019-03-26 10:58 ` Cyril Hrubis
@ 2019-03-26 11:02 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2019-03-26 11:02 UTC (permalink / raw)
To: ltp
Hi Cyril,
> > > > static struct tst_test test = {
> > > > - .test_all = run
> > > > + .test_all = run,
> > > > + .test_variants = 3,
> > > > };
> > > I would rather see .setup = singpending_info, here so that we don't spam
> > > the output that much, otherwise it looks good.
> > No problem, but with the following diff is the output the same. Am I missing
> > something?
> Ah, my bad, we are using test_all instead of test function, so indeed
> the output is the same. I blame it on ENOCOFFEE error my brain reported
> in the morning.
OK, pushed the original variant. At least you have good error checking :).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-26 11:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 15:14 [LTP] [PATCH 1/1] sigpending: Use 3 variants via test_multiplex() Petr Vorel
2019-03-26 10:10 ` Cyril Hrubis
2019-03-26 10:47 ` Petr Vorel
2019-03-26 10:58 ` Cyril Hrubis
2019-03-26 11:02 ` Petr Vorel
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.