Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

John Stultz and committed by
Shuah Khan
48fd77d1 072264fe

+7
+7
tools/testing/selftests/timers/set-timer-lat.c
··· 139 139 140 140 err = timer_create(clock_id, &se, &tm1); 141 141 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 + } 142 149 printf("%s - timer_create() failed\n", clockstring(clock_id)); 143 150 return -1; 144 151 }