Skip to content

Commit 48fd77d

Browse files
johnstultz-workShuah Khan
authored andcommitted
kselftests: timers: Make set-timer-lat fail more gracefully for !CAP_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 <shuahkh@osg.samsung.com> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Richard Cochran <richardcochran@gmail.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
1 parent 072264f commit 48fd77d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎tools/testing/selftests/timers/set-timer-lat.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ int do_timer(int clock_id, int flags)
139139

140140
err = timer_create(clock_id, &se, &tm1);
141141
if (err) {
142+
if ((clock_id == CLOCK_REALTIME_ALARM) ||
143+
(clock_id == CLOCK_BOOTTIME_ALARM)) {
144+
printf("%-22s %s missing CAP_WAKE_ALARM? : [UNSUPPORTED]\n",
145+
clockstring(clock_id),
146+
flags ? "ABSTIME":"RELTIME");
147+
return 0;
148+
}
142149
printf("%s - timer_create() failed\n", clockstring(clock_id));
143150
return -1;
144151
}

0 commit comments

Comments
 (0)