Add timekeeping tests to kernel selftests
Subsystems (3)
v4 cover Add timekeeping tests to kernel selftests
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 v4:
* Cleaned up extern optarg checkpatch warnings (since we include unistd.h now)
* Fixed up some trailing empty lines Shuah pointed out.
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 | 185 ++++++++++++ tools/testing/selftests/timers/change_skew.c | 107 +++++++ .../testing/selftests/timers/clocksource-switch.c | 179 ++++++++++++ .../testing/selftests/timers/inconsistency-check.c | 204 +++++++++++++ tools/testing/selftests/timers/leap-a-day.c | 319 +++++++++++++++++++++ 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 | 144 ++++++++++ tools/testing/selftests/timers/set-tai.c | 79 +++++ tools/testing/selftests/timers/set-timer-lat.c | 209 ++++++++++++++ tools/testing/selftests/timers/skew_consistency.c | 89 ++++++ tools/testing/selftests/timers/threadtest.c | 200 +++++++++++++ tools/testing/selftests/timers/valid-adjtimex.c | 202 +++++++++++++ 19 files changed, 2718 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 v4 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 v4 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 v4 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 v4 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 | 204 +++++++++++++++++++++ 2 files changed, 206 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 +204 -0
204 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 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 v4 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 v4 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 | 209 +++++++++++++++++++++++++ 2 files changed, 213 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 +209 -0
209 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 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 | 200 ++++++++++++++++++++++++++++ 2 files changed, 202 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 +200 -0
200 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 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 v4 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 | 202 ++++++++++++++++++++++++ 2 files changed, 212 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 +202 -0
202 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 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 | 185 +++++++++++++++++++++ 2 files changed, 189 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 +185 -0
185 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 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 v4 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 v4 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 v4 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 | 319 ++++++++++++++++++++++++++++ 2 files changed, 321 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 +319 -0
319 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 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 v4 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 v4 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 | 144 ++++++++++++++++++++++++++++++ 2 files changed, 146 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 +144 -0
144 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 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
@@ -8542,6 +8542,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 14 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:
Quoted 9 lines
# make run_destructive_testsChanges in v4:
* Cleaned up extern optarg checkpatch warnings (since we includeunistd.hnow)
* Fixed up some trailing empty lines Shuah pointed out.Let me know if there is any further comments or feedback!
Thanks for adding these tests. Queued up for 4.1 in kernel/git/shuah/linux-kselftest.git next
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