Skip to content

Commit

Permalink
kselftests: timers: Fix inconsistency-check to not ignore first times…
Browse files Browse the repository at this point in the history
…tamp

When the first timestamp in the list of clock readings was later than
the second timestamp and all other timestamps were in order, the
inconsistency was not reported because the index of the out-of-order
timestamp was equal to the default value.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Stephen Boyd <stephen.boyd@linaro.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
  • Loading branch information
Miroslav Lichvar authored and John Stultz committed Jun 21, 2017
1 parent 369adf0 commit 7a5de55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/timers/inconsistency-check.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int consistency_test(int clock_type, unsigned long seconds)
start_str = ctime(&t);

while (seconds == -1 || now - then < seconds) {
inconsistent = 0;
inconsistent = -1;

/* Fill list */
for (i = 0; i < CALLS_PER_LOOP; i++)
Expand All @@ -130,7 +130,7 @@ int consistency_test(int clock_type, unsigned long seconds)
inconsistent = i;

/* display inconsistency */
if (inconsistent) {
if (inconsistent >= 0) {
unsigned long long delta;

printf("\%s\n", start_str);
Expand Down

0 comments on commit 7a5de55

Please sign in to comment.