[LTP] [PATCH v2 0/2] Rewrite openposix clock_settime bugged tests inside LTP
Andrea Cervesato
andrea.cervesato@suse.de
Mon Jun 30 13:56:33 CEST 2025
Both clock_settime_7-1 and clock_settime_8-1 are affected by the
same bug which is probably related to the way tests are written.
sleep() is used by the parent and is not reliable. It can oversleep
or undersleep according to system overload or signals which are
received. And we never check for its return value. Using
clock_nanosleep would make parent more reliable in this case.
At the same time, the test is taking for granted a certain
synchronization between child and parent, which is not always true
in case of system overload.
My suggestion is to rewrite the test using LTP, which has better
timing handling (see tst_timer.h).
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Changes in v2:
- add SAFE_CLOCK_NANOSLEEP
- move child to MONOTONIC clock
- simplify child_nanosleep by passing flags
- calculate delta by checking sleep() time between beginning and ending time
- keep variants only for child
- Link to v1: https://lore.kernel.org/r/20250627-clock_nanosleep05-v1-1-1357109a2c81@suse.com
---
Andrea Cervesato (2):
Add SAFE_CLOCK_NANOSLEEP macro utility
Add clock_settime04 test
include/tst_safe_clocks.h | 23 ++++
runtest/syscalls | 1 +
testcases/kernel/syscalls/clock_settime/.gitignore | 1 +
.../syscalls/clock_settime/clock_settime04.c | 153 +++++++++++++++++++++
4 files changed, 178 insertions(+)
---
base-commit: df591113afeb31107bc45bd5ba28a99b556d1028
change-id: 20250620-clock_nanosleep05-60b3cfba52fe
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
More information about the ltp
mailing list