Skip to contentSkip to conversation

syscalls/rt_sigqueueinfo01: rewrote testcase

PATCH Superseded Christian Amann 2 participants 2 messages Apr 25, 2019 – May 6, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 syscalls/rt_sigqueueinfo01: rewrote testcase

The previous implementation only tested if the syscall can be called at all. Now it also checks if the correct signal and data is sent and received.

---
 testcases/kernel/syscalls/rt_sigqueueinfo/Makefile |   2 +
 .../syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h     |  22 +++
 .../syscalls/rt_sigqueueinfo/rt_sigqueueinfo01.c   | 188 +++++++++++----------
 3 files changed, 125 insertions(+), 87 deletions(-)
 create mode 100644 testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h
testcases/kernel/syscalls/rt_sigqueueinfo/Makefile +2 -0
index 2ef86f06f..498ba8e31 100644
@@ -21,3 +21,5 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+rt_sigqueueinfo01: CFLAGS += -pthread
testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h new file +22 -0
new file mode 100644
index 000000000..927e4bf3b
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <[email protected]>
+ */
+
+#ifdef HAVE_STRUCT_SIGACTION_SA_SIGACTION
+
+#ifndef __RT_SIGQUEUEINFO_H__
+#define __RT_SIGQUEUEINFO_H__
+
+#define gettid() syscall(SYS_gettid)
+
+#include "lapi/syscalls.h"
+
+static int sys_rt_sigqueueinfo(pid_t tgid, int sig, siginfo_t *uinfo)
+{
+	return tst_syscall(__NR_rt_sigqueueinfo, tgid, sig, uinfo);
+}
+
+#endif /* __RT_SIGQUEUEINFO_H__ */
+#endif /* HAVE_STRUCT_SIGACTION_SA_SIGACTION */
testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo01.c +101 -87

203 lines not on this page · raw message

Signature · 1 line
2.16.4
#1 lore raw

PATCH v2 1/1 syscalls/rt_sigqueueinfo01: rewrote testcase

Hi Christian,

Quoted 5 lines

The previous implementation only tested if the syscall can be called at all. Now it also checks if the correct signal and data is sent and received.

Thanks for your patch.
Minor comments, not relevant to the actual testing below.

Kind regards,
Petr

testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h

Quoted 21 lines
 testcases/kernel/syscalls/rt_sigqueueinfo/Makefile |   2 +
 .../syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h     |  22 +++
 .../syscalls/rt_sigqueueinfo/rt_sigqueueinfo01.c   | 188 +++++++++++----------
 3 files changed, 125 insertions(+), 87 deletions(-)
 create mode 100644 testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h
testcases/kernel/syscalls/rt_sigqueueinfo/Makefile +2 -0
index 2ef86f06f..498ba8e31 100644
@@ -21,3 +21,5 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+rt_sigqueueinfo01: CFLAGS += -pthread
testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h new file +0 -0
new file mode 100644
index 000000000..927e4bf3b

Do you plan to add more rt_sigqueueinfo() tests? Otherwise we might just add this content into C file.

testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h line 7

Quoted 8 lines
testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h new file +7 -0
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <[email protected]>
+ */
+
+#ifdef HAVE_STRUCT_SIGACTION_SA_SIGACTION

Also I'd use this guard only in C file (IMHO not required for header) and load this header after this guard.

testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h line 12

Quoted 5 lines
testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h new file +5 -0
+
+#ifndef __RT_SIGQUEUEINFO_H__
+#define __RT_SIGQUEUEINFO_H__
+
+#define gettid() syscall(SYS_gettid)

I guess this does not clash even with glibc 2.30, which added gettid(), because we don't include <sys/types.h>. But I wonder if it's useful to define for one usage. BTW we have 22 {tst_,}syscall(__NR_gettid) usages, 2 definitions like your (#define gettid() syscall(__NR_gettid)) and 4 int gettid(void) functions. If considered useful, it should be in include/lapi/.

...

testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h line 20

Quoted 8 lines
testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h new file +8 -0
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <[email protected]>
+ */
+
+/*
+ * Description:

You can be more radical with doc cleanup. "Description:" or redundant line before */ can go away.

testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h

Quoted 9 lines
testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h new file +9 -0
+ *
+ * This tests the rt_sigqueueinfo() syscall.
+ *
+ * It does so by creating a thread which registers the corresponding
+ * signal handler. After that the main thread sends a signal and data
+ * to the handler thread. If the correct signal and data is received,
+ * the test is successful.
+ *
+ */

Kind regards,
Petr