kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments
Subsystems (3)
PATCH v3 1/1 kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments
Recently an issue was reported that was difficult to detect except by tweaking the adjtimex tick value, and noticing how quickly the adjustment took to be made:
https://lkml.org/lkml/2015/9/1/488
Thus this patch introduces a new test which manipulates the adjtimex tick value and validates the results are what we expect.
---
v2: - Use sysconf(_SC_CLK_TCK) to properly get USER_HZ value.
v3: - Set STA_PLL to ensure offset is cleared
- Add rational for 100ppm error bound
tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/adjtick.c | 210 +++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/adjtick.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -8,7 +8,7 @@ LDFLAGS += -lrt -lpthread TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \ inconsistency-check raw_skew threadtest rtctest -TEST_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex change_skew \ +TEST_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex adjtick change_skew \ skew_consistency clocksource-switch leap-a-day \ leapcrash set-tai set-2038
@@ -24,6 +24,7 @@ include ../lib.mk run_destructive_tests: run_tests ./alarmtimer-suspend ./valid-adjtimex + ./adjtick ./change_skew ./skew_consistency ./clocksource-switch
tools/testing/selftests/timers/adjtick.c new file +210 -0
210 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 7 lines · John Stultz
Recently an issue was reported that was difficult to detect except by tweaking the adjtimex tick value, and noticing how quickly the adjustment took to be made:
https://lkml.org/lkml/2015/9/1/488Thus this patch introduces a new test which manipulates the adjtimex tick value and validates the results are what we expect.
So I tried to run this:
triton:~/tip/tools/testing/selftests/timers> ./adjtick
systick: 10000
Estimating tick (act: 9000 usec, -100000 ppm): 10000 usec, 1 ppmWARNING: Unexpected adjtimex return values, make sure ntpd is not running. triton:~/tip/tools/testing/selftests/timers>
note the weird placement of the warning, and there's also no newline at the end.
It would also be nice to print out roughly how long the test will take - since it runs longer than 1-2 seconds.
Thanks,
Ingo