[LTP] [PATCH v3 00/12] Fix tests failing with setsid

Andrea Cervesato
2025-01-09T14:12:28Z

Following tests are failing when running on a new session started with
setsid command/syscall: pty01, ptem01, setpgid01.

Tihs patch-set refactor them in order to fix this issue. Some tests like
pty01 and ptem01 have been split into multiple files due to their
complexity.

Fixes: https://github.com/linux-test-project/kirk/issues/28
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Changes in v3:
- move slave/master opening in common.h
- check if master device exists inside open_master()
- check if slave device has right permissions inside open_slave()
- add TST_EXP_EQ_STRN macro
- fix SAFE_PTSNAME macro
- move master handling inside setup/cleanup in most of the test
- Link to v2: https://lore.kernel.org/r/20250106-fix_setsid_tests-v2-0-c43f57a2bab6@suse.com

Changes in v2:
- add SAFE_PTSNAME macro
- ptem01: check ptsname() with TBROK
- Link to v1: https://lore.kernel.org/r/20241211-fix_setsid_tests-v1-0-e103f36c6462@suse.com

---
Andrea Cervesato (12):
Refactor setpgid01 test
Add SAFE_PTSNAME macro
Refactor ptem01 test
Add ptem02 test
Add ptem03 test
Add ptem04 test
Add ptem05 test
Add ptem06 test
Add TST_EXP_EQ_STRN macro
Refactor pty01 test
Add pty08 test
Add pty09 test

include/tst_safe_macros.h | 4 +
include/tst_test_macros.h | 21 ++
lib/tst_safe_macros.c | 14 +
runtest/pty | 7 +
testcases/kernel/pty/.gitignore | 7 +
testcases/kernel/pty/common.h | 68 ++++
testcases/kernel/pty/ptem01.c | 456 +++-----------------------
testcases/kernel/pty/ptem02.c | 71 ++++
testcases/kernel/pty/ptem03.c | 49 +++
testcases/kernel/pty/ptem04.c | 49 +++
testcases/kernel/pty/ptem05.c | 55 ++++
testcases/kernel/pty/ptem06.c | 52 +++
testcases/kernel/pty/pty01.c | 409 +++--------------------
testcases/kernel/pty/pty08.c | 38 +++
testcases/kernel/pty/pty09.c | 74 +++++
testcases/kernel/syscalls/setpgid/setpgid01.c | 152 ++-------
16 files changed, 610 insertions(+), 916 deletions(-)
---
base-commit: 546ad9ccc9c61bf848cb0eadc24203202b20b08c
change-id: 20241204-fix_setsid_tests-876a46267285

Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>