diff options
Diffstat (limited to 'testsuites/validation/tc-clock-set.c')
-rw-r--r-- | testsuites/validation/tc-clock-set.c | 751 |
1 files changed, 751 insertions, 0 deletions
diff --git a/testsuites/validation/tc-clock-set.c b/testsuites/validation/tc-clock-set.c new file mode 100644 index 0000000000..0fadbd2e49 --- /dev/null +++ b/testsuites/validation/tc-clock-set.c @@ -0,0 +1,751 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseRtemsClockReqSet + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems.h> + +#include "tc-clock-get-tod.h" + +#include <rtems/test.h> + +/** + * @defgroup RTEMSTestCaseRtemsClockReqSet spec:/rtems/clock/req/set + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @{ + */ + +typedef enum { + RtemsClockReqSet_Pre_ToD_Valid, + RtemsClockReqSet_Pre_ToD_ValidLeap4, + RtemsClockReqSet_Pre_ToD_ValidLeap100, + RtemsClockReqSet_Pre_ToD_ValidNoneLeap100, + RtemsClockReqSet_Pre_ToD_ValidLeap400, + RtemsClockReqSet_Pre_ToD_Youngest, + RtemsClockReqSet_Pre_ToD_Oldest, + RtemsClockReqSet_Pre_ToD_TooJung, + RtemsClockReqSet_Pre_ToD_TooOld, + RtemsClockReqSet_Pre_ToD_InvMonth0, + RtemsClockReqSet_Pre_ToD_InvMonth, + RtemsClockReqSet_Pre_ToD_InvDay0, + RtemsClockReqSet_Pre_ToD_InvDay, + RtemsClockReqSet_Pre_ToD_InvHour, + RtemsClockReqSet_Pre_ToD_InvMinute, + RtemsClockReqSet_Pre_ToD_InvSecond, + RtemsClockReqSet_Pre_ToD_InvTicks, + RtemsClockReqSet_Pre_ToD_InvLeap4, + RtemsClockReqSet_Pre_ToD_InvLeap100, + RtemsClockReqSet_Pre_ToD_InvLeap400, + RtemsClockReqSet_Pre_ToD_AtTimer, + RtemsClockReqSet_Pre_ToD_BeforeTimer, + RtemsClockReqSet_Pre_ToD_AfterTimer, + RtemsClockReqSet_Pre_ToD_Null, + RtemsClockReqSet_Pre_ToD_NA +} RtemsClockReqSet_Pre_ToD; + +typedef enum { + RtemsClockReqSet_Post_Status_Ok, + RtemsClockReqSet_Post_Status_InvAddr, + RtemsClockReqSet_Post_Status_InvClk, + RtemsClockReqSet_Post_Status_NA +} RtemsClockReqSet_Post_Status; + +typedef enum { + RtemsClockReqSet_Post_Clock_Set, + RtemsClockReqSet_Post_Clock_Unchanged, + RtemsClockReqSet_Post_Clock_NA +} RtemsClockReqSet_Post_Clock; + +typedef enum { + RtemsClockReqSet_Post_Timer_Triggered, + RtemsClockReqSet_Post_Timer_Uncalled, + RtemsClockReqSet_Post_Timer_NA +} RtemsClockReqSet_Post_Timer; + +/** + * @brief Test context for spec:/rtems/clock/req/set test case. + */ +typedef struct { + rtems_status_code status; + + rtems_time_of_day *target_tod; + + rtems_time_of_day target_tod_value; + + rtems_time_of_day tod_before; + + rtems_status_code get_tod_before_status; + + rtems_time_of_day tod_after; + + rtems_status_code get_tod_after_status; + + rtems_id timer_id; + + int timer_routine_counter; + + rtems_time_of_day timer_routine_tod; + + /** + * @brief Grace period in tick which may be passed between set and get ToD. + */ + uint32_t grace_ticks; + + /** + * @brief This member defines the pre-condition states for the next action. + */ + size_t pcs[ 1 ]; + + /** + * @brief This member indicates if the test action loop is currently + * executed. + */ + bool in_action_loop; +} RtemsClockReqSet_Context; + +static RtemsClockReqSet_Context + RtemsClockReqSet_Instance; + +static const char * const RtemsClockReqSet_PreDesc_ToD[] = { + "Valid", + "ValidLeap4", + "ValidLeap100", + "ValidNoneLeap100", + "ValidLeap400", + "Youngest", + "Oldest", + "TooJung", + "TooOld", + "InvMonth0", + "InvMonth", + "InvDay0", + "InvDay", + "InvHour", + "InvMinute", + "InvSecond", + "InvTicks", + "InvLeap4", + "InvLeap100", + "InvLeap400", + "AtTimer", + "BeforeTimer", + "AfterTimer", + "Null", + "NA" +}; + +static const char * const * const RtemsClockReqSet_PreDesc[] = { + RtemsClockReqSet_PreDesc_ToD, + NULL +}; + +/* + * How much time may pass between a call to rtems_clock_set() and + * a follow up call to rtems_clock_get_tod() in millisecond? + */ +#define GRACE_PERIOD 5 + +static rtems_timer_service_routine _TOD_timer_routine( + rtems_id timer_id, + void *user_data +) +{ + RtemsClockReqSet_Context *ctx = user_data; + rtems_status_code status; + ++ctx->timer_routine_counter; + status = rtems_clock_get_tod( &ctx->timer_routine_tod ); + T_rsc_success( status ); +} + +static void _TOD_prepare_timer( RtemsClockReqSet_Context *ctx ) +{ + rtems_status_code status; + rtems_time_of_day tod = { 1988, 1, 1, 0, 0, 0, 0 }; + + status = rtems_clock_set( &tod ); + T_rsc_success( status ); + + tod.year = 1989; + status = rtems_timer_fire_when( + ctx->timer_id, + &tod, + _TOD_timer_routine, + ctx + ); + T_rsc_success( status ); +} + +static void RtemsClockReqSet_Pre_ToD_Prepare( + RtemsClockReqSet_Context *ctx, + RtemsClockReqSet_Pre_ToD state +) +{ + switch ( state ) { + case RtemsClockReqSet_Pre_ToD_Valid: { + /* + * While the ``time_of_day`` parameter references an arbitrary valid date + * and time between 1988-01-01T00:00:00.000000000Z and + * 2105-12-31T23:59:59.999999999Z. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 3, 11, 11, 10, 59, + rtems_clock_get_ticks_per_second() / 2 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_ValidLeap4: { + /* + * While the ``time_of_day`` parameter references a date for a leap year + * with the value of 29th of February. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2104, 2, 29, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_ValidLeap100: { + /* + * While the ``time_of_day`` parameter references a date for a non-leap + * century year with the value of 28th of February. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2100, 2, 28, 23, 59, 59, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_ValidNoneLeap100: { + /* + * While the ``time_of_day`` parameter references a date for a non-leap + * century year with the value of 1st of March. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2100, 3, 1, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_ValidLeap400: { + /* + * While the ``time_of_day`` parameter references a date for a leap year + * with the value of 29th of February. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2000, 2, 29, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_Youngest: { + /* + * While the ``time_of_day`` parameter references the youngest date and + * time accepted (1988-01-01T00:00:00.000000000Z). + */ + ctx->target_tod_value = + (rtems_time_of_day) { 1988, 1, 1, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_Oldest: { + /* + * While the ``time_of_day`` parameter references the oldest date and + * time accepted (2105-12-31T23:59:59.999999999Z). + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2105, 12, 31, 23, 59, 59, + rtems_clock_get_ticks_per_second() - ctx->grace_ticks }; + break; + } + + case RtemsClockReqSet_Pre_ToD_TooJung: { + /* + * While the ``time_of_day`` parameter references a valid date and time + * younger than 1988-01-01T00:00:00.000000000Z. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 1987, 12, 31, 23, 59, 59, + rtems_clock_get_ticks_per_second() - 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_TooOld: { + /* + * While the ``time_of_day`` parameter references a valid date and time + * older than 2105-12-31T23:59:59.999999999Z. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2106, 1, 1, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvMonth0: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the month is 0. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 0, 11, 11, 10, 59, 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvMonth: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the month is larger than 12. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 13, 11, 11, 10, 59, 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvDay0: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the day is 0. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 3, 0, 11, 10, 59, 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvDay: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the day is larger than the days of the month. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 2, 29, 11, 10, 59, 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvHour: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the hour is larger than 23. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 3, 11, 24, 10, 59, 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvMinute: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the minute is larger than 59. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 3, 11, 11, 60, 59, 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvSecond: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the second is larger than 59. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 3, 11, 11, 10, 60, 1 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvTicks: { + /* + * While the ``time_of_day`` parameter is invalid because the value of + * the ticks are larger or equal to the ticks per second. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2021, 3, 11, 11, 10, 60, + rtems_clock_get_ticks_per_second() }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvLeap4: { + /* + * While the ``time_of_day`` parameter is invalid because the value 30th + * of February does not exist in a leap year. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2104, 2, 30, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvLeap100: { + /* + * While the ``time_of_day`` parameter is invalid because the value 29th + * of February does not exist in a non-leap year. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2100, 2, 29, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_InvLeap400: { + /* + * While the ``time_of_day`` parameter is invalid because the value 30th + * of February does not exist in a leap year. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 2000, 2, 30, 0, 0, 0, 0 }; + break; + } + + case RtemsClockReqSet_Pre_ToD_AtTimer: { + /* + * While the ``time_of_day`` parameter references the same point in time + * when a timer should fire. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 1989, 1, 1, 0, 0, 0, 0 }; + _TOD_prepare_timer( ctx ); + break; + } + + case RtemsClockReqSet_Pre_ToD_BeforeTimer: { + /* + * While the ``time_of_day`` parameter references a point in time before + * a timer should fire. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 1988, 12, 31, 23, 59, 59, 0 }; + _TOD_prepare_timer( ctx ); + break; + } + + case RtemsClockReqSet_Pre_ToD_AfterTimer: { + /* + * While the ``time_of_day`` parameter references a point in time after a + * timer should fire. + */ + ctx->target_tod_value = + (rtems_time_of_day) { 1989, 1, 1, 1, 0, 0, 0 }; + _TOD_prepare_timer( ctx ); + break; + } + + case RtemsClockReqSet_Pre_ToD_Null: { + /* + * WHile the ``time_of_day`` parameter is NULL. + */ + ctx->target_tod = NULL; + break; + } + + case RtemsClockReqSet_Pre_ToD_NA: + break; + } +} + +static void RtemsClockReqSet_Post_Status_Check( + RtemsClockReqSet_Context *ctx, + RtemsClockReqSet_Post_Status state +) +{ + switch ( state ) { + case RtemsClockReqSet_Post_Status_Ok: { + /* + * The return status of rtems_clock_set() shall be RTEMS_SUCCESSFUL + */ + T_rsc_success( ctx->status ); + break; + } + + case RtemsClockReqSet_Post_Status_InvAddr: { + /* + * The return status of rtems_clock_set() shall be RTEMS_INVALID_ADDRESS. + */ + T_rsc( ctx->status, RTEMS_INVALID_ADDRESS ); + break; + } + + case RtemsClockReqSet_Post_Status_InvClk: { + /* + * The return status of rtems_clock_set() shall be RTEMS_INVALID_CLOCK. + */ + T_rsc( ctx->status, RTEMS_INVALID_CLOCK ); + break; + } + + case RtemsClockReqSet_Post_Status_NA: + break; + } +} + +static void RtemsClockReqSet_Post_Clock_Check( + RtemsClockReqSet_Context *ctx, + RtemsClockReqSet_Post_Clock state +) +{ + switch ( state ) { + case RtemsClockReqSet_Post_Clock_Set: { + /* + * The CLOCK_REALTIME shall be set to the values of the object referenced + * by the ``time_of_day`` parameter during the rtems_clock_set() call. + */ + T_eq_ptr( ctx->target_tod, &ctx->target_tod_value ); + T_rsc_success( ctx->get_tod_after_status ); + T_eq_u32( ctx->tod_after.year, ctx->target_tod_value.year ); + T_eq_u32( ctx->tod_after.month, ctx->target_tod_value.month ); + T_eq_u32( ctx->tod_after.day, ctx->target_tod_value.day ); + T_eq_u32( ctx->tod_after.hour, ctx->target_tod_value.hour ); + T_eq_u32( ctx->tod_after.minute, ctx->target_tod_value.minute ); + T_eq_u32( ctx->tod_after.second, ctx->target_tod_value.second ); + T_ge_u32( ctx->tod_after.ticks, ctx->target_tod_value.ticks ); + T_lt_u32( ctx->tod_after.ticks, + ctx->target_tod_value.ticks + ctx->grace_ticks ); + break; + } + + case RtemsClockReqSet_Post_Clock_Unchanged: { + /* + * The state of the CLOCK_REALTIME shall not be changed by the + * rtems_clock_set() call. + */ + T_rsc_success( ctx->get_tod_before_status ); + T_eq_u32( ctx->tod_after.year, ctx->tod_before.year ); + T_eq_u32( ctx->tod_after.month, ctx->tod_before.month ); + T_eq_u32( ctx->tod_after.day, ctx->tod_before.day ); + T_eq_u32( ctx->tod_after.hour, ctx->tod_before.hour ); + T_eq_u32( ctx->tod_after.minute, ctx->tod_before.minute ); + T_eq_u32( ctx->tod_after.second, ctx->tod_before.second ); + T_ge_u32( ctx->tod_after.ticks, ctx->tod_before.ticks ); + T_lt_u32( ctx->tod_after.ticks, + ctx->tod_before.ticks + 2 * ctx->grace_ticks ); + break; + } + + case RtemsClockReqSet_Post_Clock_NA: + break; + } +} + +static void RtemsClockReqSet_Post_Timer_Check( + RtemsClockReqSet_Context *ctx, + RtemsClockReqSet_Post_Timer state +) +{ + switch ( state ) { + case RtemsClockReqSet_Post_Timer_Triggered: { + /* + * The timer routine shall be executed once after the CLOCK_REALTIME has + * been set and before the execution of the rtems_clock_set() call + * terminates. + */ + T_eq_int( ctx->timer_routine_counter, 1 ); + T_eq_u32( ctx->timer_routine_tod.year, 1989 ); + T_eq_u32( ctx->timer_routine_tod.month, 1 ); + T_eq_u32( ctx->timer_routine_tod.day, 1 ); + T_eq_u32( ctx->timer_routine_tod.minute, 0 ); + T_eq_u32( ctx->timer_routine_tod.second, 0 ); + T_ge_u32( ctx->timer_routine_tod.ticks, 0 ); + T_lt_u32( ctx->timer_routine_tod.ticks, 0 + ctx->grace_ticks ); + break; + } + + case RtemsClockReqSet_Post_Timer_Uncalled: { + /* + * The the timer routine shall not be invoked during the + * rtems_clock_set() call. + */ + T_eq_int( ctx->timer_routine_counter, 0 ); + break; + } + + case RtemsClockReqSet_Post_Timer_NA: + break; + } +} + +static void RtemsClockReqSet_Setup( RtemsClockReqSet_Context *ctx ) +{ + rtems_status_code status; + rtems_name timer_name = rtems_build_name( 'T', 'M', 'R', '0' ); + ctx->timer_id = RTEMS_ID_NONE; + + /* Call rtems_clock_get_tod() once before rtems_clock_set() gets called */ + get_tod_before_set_tod( NULL ); + + ctx->grace_ticks = rtems_clock_get_ticks_per_second() * GRACE_PERIOD / 1000; + ctx->target_tod = &ctx->target_tod_value; + + status = rtems_timer_create( timer_name, &ctx->timer_id ); + T_rsc_success( status ); +} + +static void RtemsClockReqSet_Setup_Wrap( void *arg ) +{ + RtemsClockReqSet_Context *ctx; + + ctx = arg; + ctx->in_action_loop = false; + RtemsClockReqSet_Setup( ctx ); +} + +static void RtemsClockReqSet_Teardown( RtemsClockReqSet_Context *ctx ) +{ + rtems_status_code status; + + if ( RTEMS_ID_NONE != ctx->timer_id ) { + status = rtems_timer_delete( ctx->timer_id ); + T_rsc_success( status ); + } +} + +static void RtemsClockReqSet_Teardown_Wrap( void *arg ) +{ + RtemsClockReqSet_Context *ctx; + + ctx = arg; + ctx->in_action_loop = false; + RtemsClockReqSet_Teardown( ctx ); +} + +static void RtemsClockReqSet_Prepare( RtemsClockReqSet_Context *ctx ) +{ + rtems_status_code status; + + status = rtems_timer_cancel( ctx->timer_id ); + T_rsc_success( status ); + ctx->timer_routine_counter = 0; + ctx->timer_routine_tod = (rtems_time_of_day) { 0, 0, 0, 0, 0, 0, 0 }; +} + +static void RtemsClockReqSet_Action( RtemsClockReqSet_Context *ctx ) +{ + ctx->get_tod_before_status = rtems_clock_get_tod( &ctx->tod_before ); + ctx->status = rtems_clock_set( ctx->target_tod ); + ctx->get_tod_after_status = rtems_clock_get_tod( &ctx->tod_after ); +} + +typedef struct { + uint8_t Skip : 1; + uint8_t Pre_ToD_NA : 1; + uint8_t Post_Status : 2; + uint8_t Post_Clock : 2; + uint8_t Post_Timer : 2; +} RtemsClockReqSet_Entry; + +static const RtemsClockReqSet_Entry +RtemsClockReqSet_Entries[] = { + { 0, 0, RtemsClockReqSet_Post_Status_InvClk, + RtemsClockReqSet_Post_Clock_Unchanged, RtemsClockReqSet_Post_Timer_Uncalled }, + { 0, 0, RtemsClockReqSet_Post_Status_Ok, RtemsClockReqSet_Post_Clock_Set, + RtemsClockReqSet_Post_Timer_Uncalled }, + { 0, 0, RtemsClockReqSet_Post_Status_Ok, RtemsClockReqSet_Post_Clock_Set, + RtemsClockReqSet_Post_Timer_Triggered }, + { 0, 0, RtemsClockReqSet_Post_Status_InvAddr, + RtemsClockReqSet_Post_Clock_Unchanged, RtemsClockReqSet_Post_Timer_Uncalled } +}; + +static const uint8_t +RtemsClockReqSet_Map[] = { + 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 3 +}; + +static size_t RtemsClockReqSet_Scope( void *arg, char *buf, size_t n ) +{ + RtemsClockReqSet_Context *ctx; + + ctx = arg; + + if ( ctx->in_action_loop ) { + return T_get_scope( RtemsClockReqSet_PreDesc, buf, n, ctx->pcs ); + } + + return 0; +} + +static T_fixture RtemsClockReqSet_Fixture = { + .setup = RtemsClockReqSet_Setup_Wrap, + .stop = NULL, + .teardown = RtemsClockReqSet_Teardown_Wrap, + .scope = RtemsClockReqSet_Scope, + .initial_context = &RtemsClockReqSet_Instance +}; + +static inline RtemsClockReqSet_Entry RtemsClockReqSet_GetEntry( size_t index ) +{ + return RtemsClockReqSet_Entries[ + RtemsClockReqSet_Map[ index ] + ]; +} + +/** + * @fn void T_case_body_RtemsClockReqSet( void ) + */ +T_TEST_CASE_FIXTURE( RtemsClockReqSet, &RtemsClockReqSet_Fixture ) +{ + RtemsClockReqSet_Context *ctx; + size_t index; + + ctx = T_fixture_context(); + ctx->in_action_loop = true; + index = 0; + + for ( + ctx->pcs[ 0 ] = RtemsClockReqSet_Pre_ToD_Valid; + ctx->pcs[ 0 ] < RtemsClockReqSet_Pre_ToD_NA; + ++ctx->pcs[ 0 ] + ) { + RtemsClockReqSet_Entry entry; + + entry = RtemsClockReqSet_GetEntry( index ); + ++index; + + RtemsClockReqSet_Prepare( ctx ); + RtemsClockReqSet_Pre_ToD_Prepare( ctx, ctx->pcs[ 0 ] ); + RtemsClockReqSet_Action( ctx ); + RtemsClockReqSet_Post_Status_Check( ctx, entry.Post_Status ); + RtemsClockReqSet_Post_Clock_Check( ctx, entry.Post_Clock ); + RtemsClockReqSet_Post_Timer_Check( ctx, entry.Post_Timer ); + } +} + +/** @} */ |