Skip to contentSkip to conversation

Rewrite exit_group01 test

PATCH Applied Andrea Cervesato 2 participants 4 messages Nov 22, 2023 – Nov 23, 2023 Library code

lore
Share & tools
lore
#0 lore raw

v5 cover Rewrite exit_group01 test

From: Andrea Cervesato <[email protected]>

exit_group01 test has been completely rewritten and tst_gettid() has been added to support missing gettid() syscall from GLIBC

Andrea Cervesato (2):
Add tst_gettid wrapper around gettid syscall
Refactor exit_group01 using new API

 include/tst_pid.h                             |   8 +
 lib/tst_pid.c                                 |   5 +
 testcases/kernel/syscalls/exit_group/Makefile |   2 +
 .../kernel/syscalls/exit_group/exit_group01.c | 161 ++++++++++++------
 4 files changed, 125 insertions(+), 51 deletions(-)
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH v5 1/2 Add tst_gettid wrapper around gettid syscall

From: Andrea Cervesato <[email protected]>

---
 include/tst_pid.h | 8 ++++++++
 lib/tst_pid.c     | 5 +++++
 2 files changed, 13 insertions(+)
include/tst_pid.h +8 -0
index 774c845ce..951138abc 100644
@@ -50,4 +50,12 @@ static inline int tst_get_free_pids(void (*cleanup_fn)(void))
  */
 pid_t tst_getpid(void);
 
+/*
+ * Direct gettid() syscall. Some glibc versions cache gettid() return value
+ * which can cause confusing issues for example in processes created by
+ * direct clone() syscall (without using the glibc wrapper). Use this function
+ * whenever the current process may be a thread of the main test process.
+ */
+pid_t tst_gettid(void);
+
 #endif /* TST_PID_H__ */
lib/tst_pid.c +5 -0
index cfaa5db36..4e9dc7a52 100644
@@ -166,3 +166,8 @@ pid_t tst_getpid(void)
 {
 	return syscall(SYS_getpid);
 }
+
+pid_t tst_gettid(void)
+{
+	return syscall(SYS_gettid);
+}
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

PATCH v5 2/2 Refactor exit_group01 using new API

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

We provided a different approach to exit_group() testing, spawning multiple threads inside the child and checking if they get killed with the parent process.

---
 testcases/kernel/syscalls/exit_group/Makefile |   2 +
 .../kernel/syscalls/exit_group/exit_group01.c | 161 ++++++++++++------
 2 files changed, 112 insertions(+), 51 deletions(-)
testcases/kernel/syscalls/exit_group/Makefile +2 -0
index 1273a4e9c..adbac3c51 100644
@@ -3,6 +3,8 @@
 
 top_srcdir		?= ../../../..
 
+exit_group01: CFLAGS+=-pthread
+
 include $(top_srcdir)/include/mk/testcases.mk
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/exit_group/exit_group01.c +110 -51

178 lines not on this page · raw message

Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
In reply to Andrea Cervesato

Hello,

Merged, thanks!

Quoted 17 lines · Andrea Cervesato

From: Andrea Cervesato <[email protected]>

exit_group01 test has been completely rewritten and tst_gettid() has been added to support missing gettid() syscall from GLIBC

Andrea Cervesato (2):
Add tst_gettid wrapper around gettid syscall
Refactor exit_group01 using new API

 include/tst_pid.h                             |   8 +
 lib/tst_pid.c                                 |   5 +
 testcases/kernel/syscalls/exit_group/Makefile |   2 +
 .../kernel/syscalls/exit_group/exit_group01.c | 161 ++++++++++++------
 4 files changed, 125 insertions(+), 51 deletions(-)
Signature · 1 line
2.35.3
Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp