Skip to content

Commit

Permalink
kselftests: timers: Check _ALARM clockids are supported before suspen…
Browse files Browse the repository at this point in the history
…ding

It was reported that the alarmtimer-suspend test hangs on older
systems that don't support _ALARM clockids.

This is due to the fact that we don't check if the timer_create
fails, and thus when we suspend, the system will not programatically
resume.

Fix this by checking the timer_create call for errors.

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>
  • Loading branch information
John Stultz authored and Shuah Khan committed May 26, 2015
1 parent acd5705 commit 61171d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/testing/selftests/timers/alarmtimer-suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ int main(void)
alarm_clock_id++) {

alarmcount = 0;
timer_create(alarm_clock_id, &se, &tm1);
if (timer_create(alarm_clock_id, &se, &tm1) == -1) {
printf("timer_create failled, %s unspported?\n",
clockstring(alarm_clock_id));
break;
}

clock_gettime(alarm_clock_id, &start_time);
printf("Start time (%s): %ld:%ld\n", clockstring(alarm_clock_id),
Expand Down

0 comments on commit 61171d0

Please sign in to comment.