Add timekeeping tests to kernel selftest
Subsystems (3)
v3 cover Add timekeeping tests to kernel selftest
I've hosted my timekeeping tests on github for the last few years:
https://github.com/johnstultz-work/timetests
but I suspect not too many folks have actually used them.
I've been meaning to get them reworked and submitted into the selftest infrastructure, but haven't had much time until recently.
I've added both the non-desctructive and destructive tests (which set the time, possibly to strange values, or tries to trigger historical issues that could crash the machine). The destructive tests are run (as root, or with proper privledge) via:
# make run_destructive_tests
Changes in v3:
* Lots of -Wall build warning fixups
* Handle the CROSS_COMPILER build variable properly (Thanks to LinusW for pointing that out)
* Integrate w/ ksft_exit_* infrastructure
Let me know if there is any further comments or feedback!
thanks
-john
John Stultz (19):
selftests/timers: Cleanup Makefile to make it easier to add future
tests
selftests/timers: Quiet warning due to lack of return check on brk selftests/timers: Add nanosleep test from timetest suite selftests/timers: Add inconsistency-check test from timetests selftests/timers: Add nsleep-lat test from timetest suite selftests/timers: Add clock skew estimation test from timetest suite selftests/timers: Add set-timer-lat test from timetest suite selftests/timers: Add threaded time inconsistency test from timetest
suite
selftests/timers: Add mqueue latency test from the timetest suite selftests/timers: Add adjtimex validation test from timetest suite selftests/timers: Add alarmtimer-suspend test from timetests suite selftests/timers: Add change_skew test from timetest suite selftests/timers: Add skew_consistency test from the timetests suite selftests/timers: Add clocksource-switch test from timetest suite selftests/timers: Add leap-a-day test from timetest suite selftests/timers: Add leapcrash test from the timetest suite selftests/timers: Add set-tai from the timetest suite selftests/timers: Add set-2038 test from timetest suite
MAINTAINERS: Add selftests/timers to the timekeeping maintainance list
MAINTAINERS | 1 + tools/testing/selftests/timers/Makefile | 37 ++- .../testing/selftests/timers/alarmtimer-suspend.c | 186 ++++++++++++ tools/testing/selftests/timers/change_skew.c | 107 +++++++ .../testing/selftests/timers/clocksource-switch.c | 179 ++++++++++++ .../testing/selftests/timers/inconsistency-check.c | 207 +++++++++++++ tools/testing/selftests/timers/leap-a-day.c | 323 +++++++++++++++++++++ tools/testing/selftests/timers/leapcrash.c | 120 ++++++++ tools/testing/selftests/timers/mqueue-lat.c | 124 ++++++++ tools/testing/selftests/timers/nanosleep.c | 174 +++++++++++ tools/testing/selftests/timers/nsleep-lat.c | 190 ++++++++++++ tools/testing/selftests/timers/posix_timers.c | 9 +- tools/testing/selftests/timers/raw_skew.c | 154 ++++++++++ tools/testing/selftests/timers/set-2038.c | 147 ++++++++++ tools/testing/selftests/timers/set-tai.c | 79 +++++ tools/testing/selftests/timers/set-timer-lat.c | 210 ++++++++++++++ tools/testing/selftests/timers/skew_consistency.c | 89 ++++++ tools/testing/selftests/timers/threadtest.c | 202 +++++++++++++ tools/testing/selftests/timers/valid-adjtimex.c | 204 +++++++++++++ 19 files changed, 2734 insertions(+), 8 deletions(-) create mode 100644 tools/testing/selftests/timers/alarmtimer-suspend.c create mode 100644 tools/testing/selftests/timers/change_skew.c create mode 100644 tools/testing/selftests/timers/clocksource-switch.c create mode 100644 tools/testing/selftests/timers/inconsistency-check.c create mode 100644 tools/testing/selftests/timers/leap-a-day.c create mode 100644 tools/testing/selftests/timers/leapcrash.c create mode 100644 tools/testing/selftests/timers/mqueue-lat.c create mode 100644 tools/testing/selftests/timers/nanosleep.c create mode 100644 tools/testing/selftests/timers/nsleep-lat.c create mode 100644 tools/testing/selftests/timers/raw_skew.c create mode 100644 tools/testing/selftests/timers/set-2038.c create mode 100644 tools/testing/selftests/timers/set-tai.c create mode 100644 tools/testing/selftests/timers/set-timer-lat.c create mode 100644 tools/testing/selftests/timers/skew_consistency.c create mode 100644 tools/testing/selftests/timers/threadtest.c create mode 100644 tools/testing/selftests/timers/valid-adjtimex.c
Signature · 1 line
1.9.1
PATCH v3 1/19 selftests/timers: Cleanup Makefile to make it easier to add future tests
Try to streamline the makefile so its easier to add timer/timekeeping tests.
Also adds support for the CROSS_COMPILE variable.
--- tools/testing/selftests/timers/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/testing/selftests/timers/Makefile +8 -3
@@ -1,8 +1,13 @@ -all: - gcc posix_timers.c -o posix_timers -lrt +CC = $(CROSS_COMPILE)gcc +BUILD_FLAGS = -DKTEST +CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) +LDFLAGS += -lrt -lpthread +bins = posix_timers + +all: ${bins} run_tests: all ./posix_timers clean: - rm -f ./posix_timers + rm -f ${bins}
Signature · 1 line
1.9.1
PATCH v3 2/19 selftests/timers: Quiet warning due to lack of return check on brk
In reply to John StultzThe posix_timers.c test has a loop that tries to keep it in kernel space, repeatedly calling brk(). However, it doesn't check the return value, which causes warnings.
This patch adds a err value which captures the return value and modifies the test so it will quit if a failure occurs.
--- tools/testing/selftests/timers/posix_timers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
tools/testing/selftests/timers/posix_timers.c +4 -5
@@ -35,10 +35,11 @@ static void user_loop(void)static void kernel_loop (void ) {void *addr =sbrk (0 ); +int err =0 ; -while (!done) { -brk (addr +4096 ); -brk (addr); +while (!done && !err) { + err =brk (addr +4096 ); + err |=brk (addr); } }
@@ -190,8 +191,6 @@ static int check_timer_create(int which)int main (int argc,char **argv) { -int err; -printf ("Testing posix timers. False negative may happen on CPU execution \n" );printf ("based timers if other threads run on the CPU...\n" );
Signature · 1 line
1.9.1
PATCH v3 3/19 selftests/timers: Add nanosleep test from timetest suite
In reply to John StultzAdd my basic nanosleep test from my timetest suite. This test validates that nanosleep doesn't return early against a number of clockids.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/nanosleep.c | 174 +++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/nanosleep.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -2,12 +2,13 @@ CC = $(CROSS_COMPILE)gcc BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread -bins = posix_timers +bins = posix_timers nanosleep all: ${bins} run_tests: all ./posix_timers + ./nanosleep clean: rm -f ${bins}
tools/testing/selftests/timers/nanosleep.c new file +174 -0
174 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 4/19 selftests/timers: Add inconsistency-check test from timetests
In reply to John StultzThis adds my inconsistency-test from my timetests suite, which checks for (single threaded) time inconsistencies across the various clockids.
--- tools/testing/selftests/timers/Makefile | 4 +- .../testing/selftests/timers/inconsistency-check.c | 207 +++++++++++++++++++++ 2 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/timers/inconsistency-check.c
tools/testing/selftests/timers/Makefile +2 -2
@@ -2,13 +2,13 @@ CC = $(CROSS_COMPILE)gcc BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread -bins = posix_timers nanosleep +bins = posix_timers nanosleep inconsistency-check all: ${bins} run_tests: all ./posix_timers ./nanosleep - + ./inconsistency-check clean: rm -f ${bins}
tools/testing/selftests/timers/inconsistency-check.c new file +207 -0
207 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 5/19 selftests/timers: Add nsleep-lat test from timetest suite
In reply to John StultzAdds my nanosleep latency test from the timetest suite. This checks to make sure we don't see "unreasonable" latencies (> 40ms) when calling nanosleep.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/nsleep-lat.c | 190 ++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/nsleep-lat.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -2,13 +2,14 @@ CC = $(CROSS_COMPILE)gcc BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread -bins = posix_timers nanosleep inconsistency-check +bins = posix_timers nanosleep inconsistency-check nsleep-lat all: ${bins} run_tests: all ./posix_timers ./nanosleep + ./nsleep-lat ./inconsistency-check clean: rm -f ${bins}
tools/testing/selftests/timers/nsleep-lat.c new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 6/19 selftests/timers: Add clock skew estimation test from timetest suite
In reply to John StultzThis adds my clock skew estimation test from the timetest suite. It measures the drift between CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW and compares it with the current frequency value from adjtimex.
It sometimes can trigger false failures when ntpd isn't in a steady state, but its a useful too when doing adjtimex testing.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/raw_skew.c | 154 ++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/raw_skew.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -2,7 +2,7 @@ CC = $(CROSS_COMPILE)gcc BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread -bins = posix_timers nanosleep inconsistency-check nsleep-lat +bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew all: ${bins}
@@ -11,5 +11,6 @@ run_tests: all ./nanosleep ./nsleep-lat ./inconsistency-check + ./raw_skew clean: rm -f ${bins}
tools/testing/selftests/timers/raw_skew.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 7/19 selftests/timers: Add set-timer-lat test from timetest suite
In reply to John StultzAdd my set-timer-lat test from the timetest suite. This test checks the latency from set_timer and reports if any are unreasonable (>40ms).
--- tools/testing/selftests/timers/Makefile | 5 +- tools/testing/selftests/timers/set-timer-lat.c | 210 +++++++++++++++++++++++++ 2 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/set-timer-lat.c
tools/testing/selftests/timers/Makefile +4 -1
@@ -2,7 +2,8 @@ CC = $(CROSS_COMPILE)gcc BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread -bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew +bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ + set-timer-lat all: ${bins}
@@ -10,7 +11,9 @@ run_tests: all ./posix_timers ./nanosleep ./nsleep-lat + ./set-timer-lat ./inconsistency-check ./raw_skew + clean: rm -f ${bins}
tools/testing/selftests/timers/set-timer-lat.c new file +210 -0
210 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 8/19 selftests/timers: Add threaded time inconsistency test from timetest suite
In reply to John StultzAdd the threaded time inconsistency test from the timetest suite. This checks for time inconsistencies between cpus, usually associated with clock skew as sometimes found w/ TSCs.
--- tools/testing/selftests/timers/Makefile | 4 +- tools/testing/selftests/timers/threadtest.c | 202 ++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/timers/threadtest.c
tools/testing/selftests/timers/Makefile +2 -2
@@ -3,7 +3,7 @@ BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ - set-timer-lat + set-timer-lat threadtest all: ${bins}
@@ -14,6 +14,6 @@ run_tests: all ./set-timer-lat ./inconsistency-check ./raw_skew - + ./threadtest -t 30 -n 8 clean: rm -f ${bins}
tools/testing/selftests/timers/threadtest.c new file +202 -0
202 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 9/19 selftests/timers: Add mqueue latency test from the timetest suite
In reply to John StultzAdd test to validate mqueue timeout latency from the timetest suite
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/mqueue-lat.c | 124 ++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/mqueue-lat.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -3,7 +3,7 @@ BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ - set-timer-lat threadtest + set-timer-lat threadtest mqueue-lat all: ${bins}
@@ -12,6 +12,7 @@ run_tests: all ./nanosleep ./nsleep-lat ./set-timer-lat + ./mqueue-lat ./inconsistency-check ./raw_skew ./threadtest -t 30 -n 8
tools/testing/selftests/timers/mqueue-lat.c new file +124 -0
124 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 10/19 selftests/timers: Add adjtimex validation test from timetest suite
In reply to John StultzThis adds a adjtimex validation test which checks the behavior for a set of valida and invalid inputs. So far this only tests ADJ_FREQUENCY, but hopefully will grow.
--- tools/testing/selftests/timers/Makefile | 11 +- tools/testing/selftests/timers/valid-adjtimex.c | 204 ++++++++++++++++++++++++ 2 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/valid-adjtimex.c
tools/testing/selftests/timers/Makefile +10 -1
@@ -3,10 +3,12 @@ BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ - set-timer-lat threadtest mqueue-lat + set-timer-lat threadtest mqueue-lat valid-adjtimex all: ${bins} +# these are all "safe" tests that don't modify +# system time or require escalated privledges run_tests: all ./posix_timers ./nanosleep
@@ -16,5 +18,12 @@ run_tests: all ./inconsistency-check ./raw_skew ./threadtest -t 30 -n 8 + +# these tests require escalated privledges +# and may modify the system time or trigger +# other behavior like suspend +run_destructive_tests: all + ./valid-adjtimex + clean: rm -f ${bins}
tools/testing/selftests/timers/valid-adjtimex.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 11/19 selftests/timers: Add alarmtimer-suspend test from timetests suite
In reply to John StultzThis adds the alarmtimer-suspend test from the timetests suite, which tests that the alarmtimers wake the system up from suspend shortly after the time they were set to fire.
--- tools/testing/selftests/timers/Makefile | 6 +- .../testing/selftests/timers/alarmtimer-suspend.c | 186 +++++++++++++++++++++ 2 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/timers/alarmtimer-suspend.c
tools/testing/selftests/timers/Makefile +4 -2
@@ -3,7 +3,8 @@ BUILD_FLAGS = -DKTEST CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ - set-timer-lat threadtest mqueue-lat valid-adjtimex + set-timer-lat threadtest mqueue-lat valid-adjtimex \ + alarmtimer-suspend all: ${bins}
@@ -22,7 +23,8 @@ run_tests: all # these tests require escalated privledges # and may modify the system time or trigger # other behavior like suspend -run_destructive_tests: all +run_destructive_tests: run_tests + ./alarmtimer-suspend ./valid-adjtimex clean:
tools/testing/selftests/timers/alarmtimer-suspend.c new file +186 -0
186 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 12/19 selftests/timers: Add change_skew test from timetest suite
In reply to John StultzThis patch adds the change_skew test which validates the adjtimex freq can be set to various values and then using the inconsistency-check, raw_skew, and nanosleep tests ensures time behaves properly.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/change_skew.c | 107 +++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/change_skew.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -4,7 +4,7 @@ CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ set-timer-lat threadtest mqueue-lat valid-adjtimex \ - alarmtimer-suspend + alarmtimer-suspend change_skew all: ${bins}
@@ -26,6 +26,7 @@ run_tests: all run_destructive_tests: run_tests ./alarmtimer-suspend ./valid-adjtimex + ./change_skew clean: rm -f ${bins}
tools/testing/selftests/timers/change_skew.c new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 13/19 selftests/timers: Add skew_consistency test from the timetests suite
In reply to John StultzThis change adds the skew_consistency test, which twists the ADJ_FREQUENCY knob back and forth and watches for timekeeping inconsistencies.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/skew_consistency.c | 89 +++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/skew_consistency.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -4,7 +4,7 @@ CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ set-timer-lat threadtest mqueue-lat valid-adjtimex \ - alarmtimer-suspend change_skew + alarmtimer-suspend change_skew skew_consistency all: ${bins}
@@ -27,6 +27,7 @@ run_destructive_tests: run_tests ./alarmtimer-suspend ./valid-adjtimex ./change_skew + ./skew_consistency clean: rm -f ${bins}
tools/testing/selftests/timers/skew_consistency.c new file +89 -0
89 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 14/19 selftests/timers: Add clocksource-switch test from timetest suite
In reply to John StultzAdds the clocksource-switch tests which continually switches the current clocksource between all the available ones, watching for any timekeeping inconsistencies.
--- tools/testing/selftests/timers/Makefile | 3 +- .../testing/selftests/timers/clocksource-switch.c | 179 +++++++++++++++++++++ 2 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/clocksource-switch.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -4,7 +4,7 @@ CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS) LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ set-timer-lat threadtest mqueue-lat valid-adjtimex \ - alarmtimer-suspend change_skew skew_consistency + alarmtimer-suspend change_skew skew_consistency clocksource-switch \ all: ${bins}
@@ -28,6 +28,7 @@ run_destructive_tests: run_tests ./valid-adjtimex ./change_skew ./skew_consistency + ./clocksource-switch clean: rm -f ${bins}
tools/testing/selftests/timers/clocksource-switch.c new file +179 -0
179 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 15/19 selftests/timers: Add leap-a-day test from timetest suite
In reply to John StultzThis change adds the leap-a-day test which sets STA_INS and STA_DEL each day to trigger leapseconds each day. It also has a mode to jump the time to right before the end of the day each iteration.
--- tools/testing/selftests/timers/Makefile | 2 + tools/testing/selftests/timers/leap-a-day.c | 323 ++++++++++++++++++++++++++++ 2 files changed, 325 insertions(+) create mode 100644 tools/testing/selftests/timers/leap-a-day.c
tools/testing/selftests/timers/Makefile +2 -0
@@ -5,6 +5,7 @@ LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ set-timer-lat threadtest mqueue-lat valid-adjtimex \ alarmtimer-suspend change_skew skew_consistency clocksource-switch \ + leap-a-day all: ${bins}
@@ -29,6 +30,7 @@ run_destructive_tests: run_tests ./change_skew ./skew_consistency ./clocksource-switch + ./leap-a-day -s -i 10 clean: rm -f ${bins}
tools/testing/selftests/timers/leap-a-day.c new file +323 -0
323 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 16/19 selftests/timers: Add leapcrash test from the timetest suite
In reply to John StultzThis change adds the leapcrash test which tests to see if a leapsecond deadlock which was observed from 2.6.26 to 3.3 is present on this system.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/leapcrash.c | 120 +++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/leapcrash.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -5,7 +5,7 @@ LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ set-timer-lat threadtest mqueue-lat valid-adjtimex \ alarmtimer-suspend change_skew skew_consistency clocksource-switch \ - leap-a-day + leap-a-day leapcrash all: ${bins}
@@ -31,6 +31,7 @@ run_destructive_tests: run_tests ./skew_consistency ./clocksource-switch ./leap-a-day -s -i 10 + ./leapcrash clean: rm -f ${bins}
tools/testing/selftests/timers/leapcrash.c new file +120 -0
120 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 17/19 selftests/timers: Add set-tai from the timetest suite
In reply to John StultzThis patch adds the set-tai test which ensures the tai offset can be set properly from adjtimex.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/set-tai.c | 79 ++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/set-tai.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -5,7 +5,7 @@ LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ set-timer-lat threadtest mqueue-lat valid-adjtimex \ alarmtimer-suspend change_skew skew_consistency clocksource-switch \ - leap-a-day leapcrash + leap-a-day leapcrash set-tai all: ${bins}
@@ -32,6 +32,7 @@ run_destructive_tests: run_tests ./clocksource-switch ./leap-a-day -s -i 10 ./leapcrash + ./set-tai clean: rm -f ${bins}
tools/testing/selftests/timers/set-tai.c new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 18/19 selftests/timers: Add set-2038 test from timetest suite
In reply to John StultzAdds the set-2038 test which sets the time to near-edge cases like the start and end of the 32 bit epoch and checks that time behaves properly. There is also a dangerous mode, which lets the clock roll over past 2038 on 32bit systems, which on some older kernels will cause system hangs.
--- tools/testing/selftests/timers/Makefile | 3 +- tools/testing/selftests/timers/set-2038.c | 147 ++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/timers/set-2038.c
tools/testing/selftests/timers/Makefile +2 -1
@@ -5,7 +5,7 @@ LDFLAGS += -lrt -lpthread bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \ set-timer-lat threadtest mqueue-lat valid-adjtimex \ alarmtimer-suspend change_skew skew_consistency clocksource-switch \ - leap-a-day leapcrash set-tai + leap-a-day leapcrash set-tai set-2038 all: ${bins}
@@ -33,6 +33,7 @@ run_destructive_tests: run_tests ./leap-a-day -s -i 10 ./leapcrash ./set-tai + ./set-2038 clean: rm -f ${bins}
tools/testing/selftests/timers/set-2038.c new file +147 -0
147 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 19/19 MAINTAINERS: Add selftests/timers to the timekeeping maintainance list
In reply to John StultzSince I'm adding a bunch of tests to selftests/timers, put me on the hook in the maintainers file.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -8535,6 +8535,7 @@ F: include/uapi/linux/timex.h F: kernel/time/clocksource.c F: kernel/time/time*.c F: kernel/time/ntp.c +F: tools/testing/selftests/timers/ SC1200 WDT DRIVER M: Zwane Mwaikambo <[email protected]>
Signature · 1 line
1.9.1
Quoted 9 lines · John Stultz
I've hosted my timekeeping tests on github for the last few years:
https://github.com/johnstultz-work/timetestsbut I suspect not too many folks have actually used them.
I've been meaning to get them reworked and submitted into the selftest infrastructure, but haven't had much time until recently.
Quoted 6 lines
I've added both the non-desctructive and destructive tests (which set the time, possibly to strange values, or tries to trigger historical issues that could crash the machine). The destructive tests are run (as root, or with proper privledge) via:
# make run_destructive_tests
I ran these across several systems including s390, powerpc, and x86 (64 bit only). I didn't see anything weird and AFAICT the tests work.
P.
Quoted 77 lines
Changes in v3:
* Lots of -Wall build warning fixups
* Handle theCROSS_COMPILERbuild variable properly (Thanks to LinusW for pointing that out)
* Integrate w/ ksft_exit_* infrastructureLet me know if there is any further comments or feedback!
thanks
-johnCc Shuah Khan <[email protected]>Cc Prarit Bhargava <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Richard Cochran <[email protected]>John Stultz (19):
selftests/timers: CleanupMakefileto make it easier to add future
tests
selftests/timers: Quiet warning due to lack of return check on brk selftests/timers: Add nanosleep test from timetest suite selftests/timers: Add inconsistency-check test from timetests selftests/timers: Add nsleep-lat test from timetest suite selftests/timers: Add clock skew estimation test from timetest suite selftests/timers: Add set-timer-lat test from timetest suite selftests/timers: Add threaded time inconsistency test from timetest
suite
selftests/timers: Add mqueue latency test from the timetest suite selftests/timers: Add adjtimex validation test from timetest suite selftests/timers: Add alarmtimer-suspend test from timetests suite selftests/timers: Addchange_skewtest from timetest suite selftests/timers: Addskew_consistencytest from the timetests suite selftests/timers: Add clocksource-switch test from timetest suite selftests/timers: Add leap-a-day test from timetest suite selftests/timers: Add leapcrash test from the timetest suite selftests/timers: Add set-tai from the timetest suite selftests/timers: Add set-2038 test from timetest suite
MAINTAINERS: Add selftests/timers to the timekeeping maintainance listMAINTAINERS | 1 + tools/testing/selftests/timers/Makefile | 37 ++- .../testing/selftests/timers/alarmtimer-suspend.c | 186 ++++++++++++ tools/testing/selftests/timers/change_skew.c | 107 +++++++ .../testing/selftests/timers/clocksource-switch.c | 179 ++++++++++++ .../testing/selftests/timers/inconsistency-check.c | 207 +++++++++++++ tools/testing/selftests/timers/leap-a-day.c | 323 +++++++++++++++++++++ tools/testing/selftests/timers/leapcrash.c | 120 ++++++++ tools/testing/selftests/timers/mqueue-lat.c | 124 ++++++++ tools/testing/selftests/timers/nanosleep.c | 174 +++++++++++ tools/testing/selftests/timers/nsleep-lat.c | 190 ++++++++++++ tools/testing/selftests/timers/posix_timers.c | 9 +- tools/testing/selftests/timers/raw_skew.c | 154 ++++++++++ tools/testing/selftests/timers/set-2038.c | 147 ++++++++++ tools/testing/selftests/timers/set-tai.c | 79 +++++ tools/testing/selftests/timers/set-timer-lat.c | 210 ++++++++++++++ tools/testing/selftests/timers/skew_consistency.c | 89 ++++++ tools/testing/selftests/timers/threadtest.c | 202 +++++++++++++ tools/testing/selftests/timers/valid-adjtimex.c | 204 +++++++++++++ 19 files changed, 2734 insertions(+), 8 deletions(-) create mode 100644 tools/testing/selftests/timers/alarmtimer-suspend.c create mode 100644 tools/testing/selftests/timers/change_skew.c create mode 100644 tools/testing/selftests/timers/clocksource-switch.c create mode 100644 tools/testing/selftests/timers/inconsistency-check.c create mode 100644 tools/testing/selftests/timers/leap-a-day.c create mode 100644 tools/testing/selftests/timers/leapcrash.c create mode 100644 tools/testing/selftests/timers/mqueue-lat.c create mode 100644 tools/testing/selftests/timers/nanosleep.c create mode 100644 tools/testing/selftests/timers/nsleep-lat.c create mode 100644 tools/testing/selftests/timers/raw_skew.c create mode 100644 tools/testing/selftests/timers/set-2038.c create mode 100644 tools/testing/selftests/timers/set-tai.c create mode 100644 tools/testing/selftests/timers/set-timer-lat.c create mode 100644 tools/testing/selftests/timers/skew_consistency.c create mode 100644 tools/testing/selftests/timers/threadtest.c create mode 100644 tools/testing/selftests/timers/valid-adjtimex.c
Quoted 16 lines · John Stultz
I've hosted my timekeeping tests on github for the last few years:
https://github.com/johnstultz-work/timetestsbut I suspect not too many folks have actually used them.
I've been meaning to get them reworked and submitted into the selftest infrastructure, but haven't had much time until recently.
I've added both the non-desctructive and destructive tests (which set the time, possibly to strange values, or tries to trigger historical issues that could crash the machine). The destructive tests are run (as root, or with proper privledge) via:
# make run_destructive_tests
Quoted 8 lines
Changes in v3:
* Lots of -Wall build warning fixups
* Handle theCROSS_COMPILERbuild variable properly (Thanks to LinusW for pointing that out)
* Integrate w/ ksft_exit_* infrastructureLet me know if there is any further comments or feedback!
Ran into several checkpatch warnings when I tried to queue these up for 4.1. Could you please fix them and resend.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 23 lines · Shuah Khan
Quoted 22 lines · John Stultz
I've hosted my timekeeping tests on github for the last few years:
https://github.com/johnstultz-work/timetestsbut I suspect not too many folks have actually used them.
I've been meaning to get them reworked and submitted into the selftest infrastructure, but haven't had much time until recently.
I've added both the non-desctructive and destructive tests (which set the time, possibly to strange values, or tries to trigger historical issues that could crash the machine). The destructive tests are run (as root, or with proper privledge) via:
# make run_destructive_testsChanges in v3:
* Lots of -Wall build warning fixups
* Handle theCROSS_COMPILERbuild variable properly (Thanks to LinusW for pointing that out)
* Integrate w/ ksft_exit_* infrastructure
Quoted 5 lines
Quoted 2 lines
Let me know if there is any further comments or feedback!
Ran into several checkpatch warnings when I tried to queue these up for 4.1. Could you please fix them and resend.
So the only few items I saw were:
1) Lines over 80 col, usually do to long string output
2) String output split over multiple lines (result of trying to fix #1 in a few spots)
- And here I did try to split the string sanely so I didn't break
up the messages, so they're still grepable
3) The extern char *optarg, warning. This one I can probably kill since I'm including unistd.h.
I'll take a look at #3, but #1 and #2 are basically contrary at a certain point. Or do you have other ideas for resolving those warnings?
thanks
-john
Quoted 39 lines · John Stultz
Quoted 23 lines · Shuah Khan
Quoted 22 lines · John Stultz
I've hosted my timekeeping tests on github for the last few years:
https://github.com/johnstultz-work/timetestsbut I suspect not too many folks have actually used them.
I've been meaning to get them reworked and submitted into the selftest infrastructure, but haven't had much time until recently.
I've added both the non-desctructive and destructive tests (which set the time, possibly to strange values, or tries to trigger historical issues that could crash the machine). The destructive tests are run (as root, or with proper privledge) via:
# make run_destructive_testsChanges in v3:
* Lots of -Wall build warning fixups
* Handle theCROSS_COMPILERbuild variable properly (Thanks to LinusW for pointing that out)
* Integrate w/ ksft_exit_* infrastructureQuoted 5 lines
Quoted 2 lines
Let me know if there is any further comments or feedback!
Ran into several checkpatch warnings when I tried to queue these up for 4.1. Could you please fix them and resend.
So the only few items I saw were:
1) Lines over 80 col, usually do to long string output
2) String output split over multiple lines (result of trying to fix #1 in a few spots)
- And here I did try to split the string sanely so I didn't break
up the messages, so they're still grepable
3) The extern char *optarg, warning. This one I can probably kill since I'm includingunistd.h.
Quoted 3 lines
I'll take a look at #3, but #1 and #2 are basically contrary at a certain point. Or do you have other ideas for resolving those warnings?
Here are the errors git am flagged:
Patch07:
Applying: selftests/timers: Add set-timer-lat test from timetest suite /lkml/linux_4.0/.git/rebase-apply/patch:246: new blank line at EOF. +
warning: 1 line adds whitespace errors.
Patch11
Applying: selftests/timers: Add alarmtimer-suspend test from timetests suite /lkml/linux_4.0/.git/rebase-apply/patch:222: new blank line at EOF. +
warning: 1 line adds whitespace errors.
Patch18
Applying: selftests/timers: Add set-2038 test from timetest suite /lkml/linux_4.0/.git/rebase-apply/patch:180: new blank line at EOF. +
warning: 1 line adds whitespace errors.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 58 lines · Shuah Khan
Quoted 39 lines · John Stultz
Quoted 23 lines · Shuah Khan
Quoted 22 lines · John Stultz
I've hosted my timekeeping tests on github for the last few years:
https://github.com/johnstultz-work/timetestsbut I suspect not too many folks have actually used them.
I've been meaning to get them reworked and submitted into the selftest infrastructure, but haven't had much time until recently.
I've added both the non-desctructive and destructive tests (which set the time, possibly to strange values, or tries to trigger historical issues that could crash the machine). The destructive tests are run (as root, or with proper privledge) via:
# make run_destructive_testsChanges in v3:
* Lots of -Wall build warning fixups
* Handle theCROSS_COMPILERbuild variable properly (Thanks to LinusW for pointing that out)
* Integrate w/ ksft_exit_* infrastructureQuoted 5 lines
Quoted 2 lines
Let me know if there is any further comments or feedback!
Ran into several checkpatch warnings when I tried to queue these up for 4.1. Could you please fix them and resend.
So the only few items I saw were:
1) Lines over 80 col, usually do to long string output
2) String output split over multiple lines (result of trying to fix #1 in a few spots)
- And here I did try to split the string sanely so I didn't break
up the messages, so they're still grepable
3) The extern char *optarg, warning. This one I can probably kill since I'm includingunistd.h.Quoted 3 lines
I'll take a look at #3, but #1 and #2 are basically contrary at a certain point. Or do you have other ideas for resolving those warnings?
Here are the errors git am flagged:
Patch07:
Applying: selftests/timers: Add set-timer-lat test from timetest suite /lkml/linux_4.0/.git/rebase-apply/patch:246: new blank line at EOF. +
warning: 1 line adds whitespace errors.Patch11
Applying: selftests/timers: Add alarmtimer-suspend test from timetests suite /lkml/linux_4.0/.git/rebase-apply/patch:222: new blank line at EOF. +
warning: 1 line adds whitespace errors.
Quoted 6 lines
Patch18
Applying: selftests/timers: Add set-2038 test from timetest suite /lkml/linux_4.0/.git/rebase-apply/patch:180: new blank line at EOF. +
warning: 1 line adds whitespace errors.
Hrm.. Not sure why I didn't see those earlier. My apologies, I will definitely fix those up. Thanks for letting me know!
thanks
-john