[PATCH v3] updates #3889, Added test for timer_create() using CLOCK_MONOTONIC

Joel Sherrill joel at rtems.org
Sat Jun 6 20:44:20 UTC 2020


Thanks for the patch.  Sorry this slipped through for so long without
such simple feedback.

First, there is a ticket for this: https://devel.rtems.org/ticket/3889 which
should be referenced.

Second, although the ticket just mentions timer_create, the capabilities
(e.g. user use case)
not exercised is that the created timer works correctly and is actually
based on
CLOCK_MONOTONIC. There are existing tests for CLOCK_REALTIME which should be
a good basis for what positive functionality is expected of a timer based
on
CLOCK_MONOTONIC.

--joel

On Sun, Apr 19, 2020 at 1:30 PM Eshan dhawan <eshandhawan51 at gmail.com>
wrote:

> >I will create a timer using timer_create() function,
> and passing CLOCK_MONOTONIC in clock_id argument.
>
> >The test will fail as there is no support for
> CLOCK_MONOTONIC in cpukit/posix/src/psxtimercreate.c.
>
> >The added code compiles successfully without any errors.
>
> Signed-off-by: Eshan dhawan <eshandhawan51 at gmail.com>
> ---
>  testsuites/psxtests/psxtimer02/psxtimer.c     | 8 ++++++--
>  testsuites/psxtests/psxtimer02/psxtimer02.scn | 3 ++-
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c
> b/testsuites/psxtests/psxtimer02/psxtimer.c
> index 9f79d33c42..e071f98857 100644
> --- a/testsuites/psxtests/psxtimer02/psxtimer.c
> +++ b/testsuites/psxtests/psxtimer02/psxtimer.c
> @@ -62,9 +62,9 @@ void *POSIX_Init (
>    status = timer_create( CLOCK_REALTIME, &event, NULL );
>    fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
>
> -  puts( "timer_create - OK" );
> +  puts( "timer_create (CLOCK_REALTIME) - OK" );
>    status = timer_create( CLOCK_REALTIME, NULL, &timer );
> -  posix_service_failed( status, "timer_create OK" );
> +  posix_service_failed( status, "timer_create (CLOCK_REALTIME)" );
>
>    puts( "timer_create - too many - EAGAIN" );
>    status = timer_create( CLOCK_REALTIME, NULL, &timer1 );
> @@ -127,6 +127,10 @@ void *POSIX_Init (
>    status = timer_delete( timer );
>    fatal_posix_service_status_errno( status, EINVAL, "bad id" );
>
> +  puts( "timer_create (CLOCK_MONOTONIC) - OK" );
> +  status = timer_create( CLOCK_MONOTONIC, NULL, &timer );
> +  posix_service_failed( status, "timer_create (CLOCK_MONOTONIC)" );
> +
>    TEST_END();
>    rtems_test_exit (0);
>  }
> diff --git a/testsuites/psxtests/psxtimer02/psxtimer02.scn
> b/testsuites/psxtests/psxtimer02/psxtimer02.scn
> index e78425a32e..7429bcf291 100644
> --- a/testsuites/psxtests/psxtimer02/psxtimer02.scn
> +++ b/testsuites/psxtests/psxtimer02/psxtimer02.scn
> @@ -1,7 +1,7 @@
>  *** POSIX Timers Test 02 ***
>  timer_create - bad clock id - EINVAL
>  timer_create - bad timer id pointer - EINVAL
> -timer_create - OK
> +timer_create (CLOCK_REALTIME) - OK
>  timer_create - too many - EAGAIN
>  timer_delete - bad id - EINVAL
>  timer_getoverrun - bad id - EINVAL
> @@ -13,4 +13,5 @@ timer_settime - bad itimer value - negative nanosecond -
> EINVAL
>  timer_settime - bad clock value - EINVAL
>  timer_delete - OK
>  timer_delete - bad id - EINVAL
> +timer_create (CLOCK_MONOTONIC) - OK
>  *** END OF POSIX Timers Test 02 ***
> --
> 2.17.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200606/b4feecba/attachment-0001.html>


More information about the devel mailing list