Skip to contentSkip to conversation

kselftests: timers: Fix inconsistency-check to not ignore first timestamp

PATCH In review Miroslav Lichvar 2 participants 2 messages Jun 13, 2017

Subsystems (3)
lore
Share & tools
lore

Miroslav Lichvar

author reviewer
#0 lore raw

PATCH 1/1 kselftests: timers: Fix inconsistency-check to not ignore first timestamp

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 John Stultz <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Richard Cochran <[email protected]>
---
 tools/testing/selftests/timers/inconsistency-check.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/timers/inconsistency-check.c +2 -2
index caf1bc9..74c60e8 100644
@@ -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++)
@@ -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);
Signature · 1 line
2.9.3
#1 lore raw
Quoted 9 lines · Miroslav Lichvar

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 John Stultz <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Richard Cochran <[email protected]>

Queued up in my tree for testing, targeting 4.13.

thanks
-john