diff options
author | John Stultz <john.stultz@linaro.org> | 2015-04-01 20:43:39 -0700 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2015-04-02 10:32:33 -0600 |
commit | 48fd77d1444a387435c3bbc773fa4e7ab6b6aca3 (patch) | |
tree | ad3b0afd5e44ad7202eb2a4b6ad5607eddd4996c /tools/testing/selftests/timers | |
parent | 072264fee89633b676f656613efff7dd5cdbf88a (diff) | |
download | lwn-48fd77d1444a387435c3bbc773fa4e7ab6b6aca3.tar.gz lwn-48fd77d1444a387435c3bbc773fa4e7ab6b6aca3.zip |
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>
Diffstat (limited to 'tools/testing/selftests/timers')
-rw-r--r-- | tools/testing/selftests/timers/set-timer-lat.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/selftests/timers/set-timer-lat.c index 2ed326750ffe..4fc98c5b0899 100644 --- a/tools/testing/selftests/timers/set-timer-lat.c +++ b/tools/testing/selftests/timers/set-timer-lat.c @@ -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; } |