Skip to contentSkip to conversation

kselftests: timers: Make set-timer-lat fail more gracefully for !CAP_WAKE_ALARM

PATCH In review John Stultz 2 participants 3 messages Apr 2, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Richard Cochran <[email protected]>

---
v2: Fix a few checkpatch warnings.

 tools/testing/selftests/timers/set-timer-lat.c | 7 +++++++
 1 file changed, 7 insertions(+)
tools/testing/selftests/timers/set-timer-lat.c +7 -0
index 2ed3267..4fc98c5 100644
@@ -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;
 	}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · John Stultz

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.

Quoted 8 lines
Cc Shuah Khan <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Richard Cochran <[email protected]>

---
v2: Fix a few checkpatch warnings.

Thanks. I will get this into 4.1-rc2.

-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#2 lore raw
Quoted 17 lines · Shuah Khan
Quoted 7 lines · John Stultz

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.

Quoted 8 lines
Cc Shuah Khan <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Richard Cochran <[email protected]>

---
v2: Fix a few checkpatch warnings.

Quoted 2 lines

Thanks. I will get this into 4.1-rc2.

Applied to linux-kselftest next for 4.1

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978