From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752078AbbCYXon (ORCPT ); Wed, 25 Mar 2015 19:44:43 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36754 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821AbbCYXom (ORCPT ); Wed, 25 Mar 2015 19:44:42 -0400 From: John Stultz To: lkml Cc: John Stultz , Shuah Khan , Prarit Bhargava , Thomas Gleixner , Richard Cochran Subject: [PATCH 1/2] kselftests: timers: Make set-timer-lat fail more gracefully for !CAP_WAKE_ALARM Date: Wed, 25 Mar 2015 16:44:32 -0700 Message-Id: <1427327073-19011-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: Richard Cochran Signed-off-by: John Stultz Signed-off-by: John Stultz --- tools/testing/selftests/timers/set-timer-lat.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/selftests/timers/set-timer-lat.c index 3ea2eff..dbc9537c 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; } -- 1.9.1