Skip to content

Commit

Permalink
kselftests: timers: Make set-timer-lat fail more gracefully for !CAP_…
Browse files Browse the repository at this point in the history
…WAKE_ALARM

The set-timer-lat test fails when testing CLOCK_BOOTTIME_ALARM
or CLOCK_REALTIME_ALARM when the user isn't running as root or
with CAP_WAKE_ALARM.

So this patch improves the error checking so we report the
issue more clearly and continue rather then reporting a failure.

Cc: Shuah Khan <[email protected]>
Cc: Prarit Bhargava <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Richard Cochran <[email protected]>
Signed-off-by: John Stultz <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
  • Loading branch information
johnstultz-work authored and Shuah Khan committed Apr 2, 2015
1 parent 072264f commit 48fd77d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/testing/selftests/timers/set-timer-lat.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ int do_timer(int clock_id, int flags)

err = timer_create(clock_id, &se, &tm1);
if (err) {
if ((clock_id == CLOCK_REALTIME_ALARM) ||
(clock_id == CLOCK_BOOTTIME_ALARM)) {
printf("%-22s %s missing CAP_WAKE_ALARM? : [UNSUPPORTED]\n",
clockstring(clock_id),
flags ? "ABSTIME":"RELTIME");
return 0;
}
printf("%s - timer_create() failed\n", clockstring(clock_id));
return -1;
}
Expand Down

0 comments on commit 48fd77d

Please sign in to comment.