diff mbox series

selftests: timers: improve timer_create failure message

Message ID 20240829153725.4437-1-gianf.trad@gmail.com (mailing list archive)
State Accepted
Headers show
Series selftests: timers: improve timer_create failure message | expand

Commit Message

Gianfranco Trad Aug. 29, 2024, 3:37 p.m. UTC
improve timer_create failure message with strerror() function
to give more information to the user.

Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
---
 tools/testing/selftests/timers/alarmtimer-suspend.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Shuah Khan Sept. 30, 2024, 6:49 p.m. UTC | #1
On 8/29/24 09:37, Gianfranco Trad wrote:
> improve timer_create failure message with strerror() function
> to give more information to the user.
> 
> Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
> ---
>   tools/testing/selftests/timers/alarmtimer-suspend.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c
> index ad52e608b88e..74acdb87d4f4 100644
> --- a/tools/testing/selftests/timers/alarmtimer-suspend.c
> +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c
> @@ -28,6 +28,7 @@
>   #include <signal.h>
>   #include <stdlib.h>
>   #include <pthread.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;
>   		}
>   

Jon, Does this look good to you? I can pick this up if you
okay with this change.

thanks,
-- Shuah
John Stultz Sept. 30, 2024, 7:19 p.m. UTC | #2
On Mon, Sep 30, 2024 at 11:49 AM Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> On 8/29/24 09:37, Gianfranco Trad wrote:
> > improve timer_create failure message with strerror() function
> > to give more information to the user.
> >
> > Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
> > ---
> >   tools/testing/selftests/timers/alarmtimer-suspend.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c
> > index ad52e608b88e..74acdb87d4f4 100644
> > --- a/tools/testing/selftests/timers/alarmtimer-suspend.c
> > +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c
> > @@ -28,6 +28,7 @@
> >   #include <signal.h>
> >   #include <stdlib.h>
> >   #include <pthread.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;
> >               }
> >
>
> Jon, Does this look good to you? I can pick this up if you
> okay with this change.

No objection from me, sorry this slipped by me.

Acked-by: John Stultz <jstultz@google.com>
Shuah Khan Sept. 30, 2024, 7:53 p.m. UTC | #3
On 9/30/24 13:19, John Stultz wrote:
> On Mon, Sep 30, 2024 at 11:49 AM Shuah Khan <skhan@linuxfoundation.org> wrote:
>>

>> Jon, Does this look good to you? I can pick this up if you
>> okay with this change.
> 
> No objection from me, sorry this slipped by me.
> 
> Acked-by: John Stultz <jstultz@google.com>

Thank you. Applied to linux-kselftest next for Linux 6.13-rc1

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c
index ad52e608b88e..74acdb87d4f4 100644
--- a/tools/testing/selftests/timers/alarmtimer-suspend.c
+++ b/tools/testing/selftests/timers/alarmtimer-suspend.c
@@ -28,6 +28,7 @@ 
 #include <signal.h>
 #include <stdlib.h>
 #include <pthread.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;
 		}