selftests: timers: improve timer_create failure message

improve timer_create failure message with strerror() function
to give more information to the user.

Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Gianfranco Trad 2024-08-29 17:37:25 +02:00 committed by Shuah Khan
parent 2ab8930ec1
commit 010b07d11e

View file

@ -29,6 +29,7 @@
#include <stdlib.h>
#include <pthread.h>
#include <include/vdso/time64.h>
#include <errno.h>
#include "../kselftest.h"
#define CLOCK_REALTIME 0
@ -142,8 +143,8 @@ int main(void)
alarmcount = 0;
if (timer_create(alarm_clock_id, &se, &tm1) == -1) {
printf("timer_create failed, %s unsupported?\n",
clockstring(alarm_clock_id));
printf("timer_create failed, %s unsupported?: %s\n",
clockstring(alarm_clock_id), strerror(errno));
break;
}