diff options
Diffstat (limited to 'testsuites/validation/tc-intr-entry-remove.c')
-rw-r--r-- | testsuites/validation/tc-intr-entry-remove.c | 185 |
1 files changed, 123 insertions, 62 deletions
diff --git a/testsuites/validation/tc-intr-entry-remove.c b/testsuites/validation/tc-intr-entry-remove.c index 65cbbb28d3..01a72410e1 100644 --- a/testsuites/validation/tc-intr-entry-remove.c +++ b/testsuites/validation/tc-intr-entry-remove.c @@ -3,11 +3,11 @@ /** * @file * - * @ingroup RTEMSTestCaseRtemsIntrReqEntryRemove + * @ingroup RtemsIntrReqEntryRemove */ /* - * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 2021 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -60,10 +60,9 @@ #include <rtems/test.h> /** - * @defgroup RTEMSTestCaseRtemsIntrReqEntryRemove \ - * spec:/rtems/intr/req/entry-remove + * @defgroup RtemsIntrReqEntryRemove spec:/rtems/intr/req/entry-remove * - * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * @ingroup TestsuitesValidationIntr * * @{ */ @@ -182,7 +181,7 @@ typedef struct { /** * @brief This member provides a counter incremented by EntryRoutine(). */ - uint32_t entry_counter;; + uint32_t entry_counter; /** * @brief This member provides another rtems_interrupt_entry object. @@ -234,6 +233,12 @@ typedef struct { rtems_vector_number test_vector; /** + * @brief If this member is true, then the testable interrupt vector was + * enabled at the test case begin. + */ + bool test_vector_was_enabled; + + /** * @brief This member provides the attributes of the testable interrupt * vector. */ @@ -280,7 +285,7 @@ typedef struct { /** * @brief This member specifies if the ``entry`` parameter value. */ - rtems_interrupt_entry *entry;; + rtems_interrupt_entry *entry; /** * @brief This member contains the return value of the @@ -290,6 +295,12 @@ typedef struct { struct { /** + * @brief This member defines the pre-condition indices for the next + * action. + */ + size_t pci[ 9 ]; + + /** * @brief This member defines the pre-condition states for the next action. */ size_t pcs[ 9 ]; @@ -467,14 +478,14 @@ static void Action( void *arg ) T_rsc_success( sc ); bsp_interrupt_set_handler_unique( - BSP_INTERRUPT_HANDLER_TABLE_SIZE, + BSP_INTERRUPT_DISPATCH_TABLE_SIZE, ctx->initialized ); ctx->status = rtems_interrupt_entry_remove( ctx->vector, ctx->entry ); bsp_interrupt_set_handler_unique( - BSP_INTERRUPT_HANDLER_TABLE_SIZE, + BSP_INTERRUPT_DISPATCH_TABLE_SIZE, ctx->initialized_during_setup ); @@ -1023,13 +1034,13 @@ static void RtemsIntrReqEntryRemove_Post_Installed_Check( if ( expected_entries > 0 ) { ctx->entry_counter = 0; - bsp_interrupt_handler_dispatch( ctx->test_vector ); + bsp_interrupt_handler_dispatch_unchecked( ctx->test_vector ); T_eq_u32( ctx->entry_counter, 0 ); } else { rtems_interrupt_entry *first; - first = bsp_interrupt_handler_table[ - bsp_interrupt_handler_index( ctx->test_vector ) + first = bsp_interrupt_dispatch_table[ + bsp_interrupt_dispatch_index( ctx->test_vector ) ]; T_null( first ); } @@ -1063,7 +1074,7 @@ static void RtemsIntrReqEntryRemove_Post_Installed_Check( if ( ctx->installed ) { ctx->entry_counter = 0; - bsp_interrupt_handler_dispatch( ctx->test_vector ); + bsp_interrupt_handler_dispatch_unchecked( ctx->test_vector ); T_eq_u32( ctx->entry_counter, 1 ); } break; @@ -1081,7 +1092,12 @@ static void RtemsIntrReqEntryRemove_Setup( rtems_status_code sc; ctx->initialized_during_setup = bsp_interrupt_is_initialized(); - ctx->test_vector = GetTestableInterruptVector(); + ctx->test_vector = GetTestableInterruptVector( NULL ); + ctx->test_vector_was_enabled = false; + (void) rtems_interrupt_vector_is_enabled( + ctx->test_vector, + &ctx->test_vector_was_enabled + ); sc = rtems_interrupt_get_attributes( ctx->test_vector, &ctx->attributes ); T_rsc_success( sc ); } @@ -1095,6 +1111,24 @@ static void RtemsIntrReqEntryRemove_Setup_Wrap( void *arg ) RtemsIntrReqEntryRemove_Setup( ctx ); } +static void RtemsIntrReqEntryRemove_Teardown( + RtemsIntrReqEntryRemove_Context *ctx +) +{ + if ( ctx->test_vector_was_enabled ) { + (void) rtems_interrupt_vector_enable( ctx->test_vector ); + } +} + +static void RtemsIntrReqEntryRemove_Teardown_Wrap( void *arg ) +{ + RtemsIntrReqEntryRemove_Context *ctx; + + ctx = arg; + ctx->Map.in_action_loop = false; + RtemsIntrReqEntryRemove_Teardown( ctx ); +} + static void RtemsIntrReqEntryRemove_Prepare( RtemsIntrReqEntryRemove_Context *ctx ) @@ -1286,7 +1320,7 @@ static size_t RtemsIntrReqEntryRemove_Scope( void *arg, char *buf, size_t n ) static T_fixture RtemsIntrReqEntryRemove_Fixture = { .setup = RtemsIntrReqEntryRemove_Setup_Wrap, .stop = NULL, - .teardown = NULL, + .teardown = RtemsIntrReqEntryRemove_Teardown_Wrap, .scope = RtemsIntrReqEntryRemove_Scope, .initial_context = &RtemsIntrReqEntryRemove_Instance }; @@ -1304,34 +1338,60 @@ static inline RtemsIntrReqEntryRemove_Entry RtemsIntrReqEntryRemove_PopEntry( ]; } +static void RtemsIntrReqEntryRemove_SetPreConditionStates( + RtemsIntrReqEntryRemove_Context *ctx +) +{ + ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ]; + ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ]; + + if ( ctx->Map.entry.Pre_Routine_NA ) { + ctx->Map.pcs[ 2 ] = RtemsIntrReqEntryRemove_Pre_Routine_NA; + } else { + ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ]; + } + + if ( ctx->Map.entry.Pre_EntryObj_NA ) { + ctx->Map.pcs[ 3 ] = RtemsIntrReqEntryRemove_Pre_EntryObj_NA; + } else { + ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ]; + } + + ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ]; + ctx->Map.pcs[ 5 ] = ctx->Map.pci[ 5 ]; + + if ( ctx->Map.entry.Pre_CanDisable_NA ) { + ctx->Map.pcs[ 6 ] = RtemsIntrReqEntryRemove_Pre_CanDisable_NA; + } else { + ctx->Map.pcs[ 6 ] = ctx->Map.pci[ 6 ]; + } + + if ( ctx->Map.entry.Pre_First_NA ) { + ctx->Map.pcs[ 7 ] = RtemsIntrReqEntryRemove_Pre_First_NA; + } else { + ctx->Map.pcs[ 7 ] = ctx->Map.pci[ 7 ]; + } + + if ( ctx->Map.entry.Pre_Last_NA ) { + ctx->Map.pcs[ 8 ] = RtemsIntrReqEntryRemove_Pre_Last_NA; + } else { + ctx->Map.pcs[ 8 ] = ctx->Map.pci[ 8 ]; + } +} + static void RtemsIntrReqEntryRemove_TestVariant( RtemsIntrReqEntryRemove_Context *ctx ) { RtemsIntrReqEntryRemove_Pre_Vector_Prepare( ctx, ctx->Map.pcs[ 0 ] ); RtemsIntrReqEntryRemove_Pre_Entry_Prepare( ctx, ctx->Map.pcs[ 1 ] ); - RtemsIntrReqEntryRemove_Pre_Routine_Prepare( - ctx, - ctx->Map.entry.Pre_Routine_NA ? RtemsIntrReqEntryRemove_Pre_Routine_NA : ctx->Map.pcs[ 2 ] - ); - RtemsIntrReqEntryRemove_Pre_EntryObj_Prepare( - ctx, - ctx->Map.entry.Pre_EntryObj_NA ? RtemsIntrReqEntryRemove_Pre_EntryObj_NA : ctx->Map.pcs[ 3 ] - ); + RtemsIntrReqEntryRemove_Pre_Routine_Prepare( ctx, ctx->Map.pcs[ 2 ] ); + RtemsIntrReqEntryRemove_Pre_EntryObj_Prepare( ctx, ctx->Map.pcs[ 3 ] ); RtemsIntrReqEntryRemove_Pre_Init_Prepare( ctx, ctx->Map.pcs[ 4 ] ); RtemsIntrReqEntryRemove_Pre_ISR_Prepare( ctx, ctx->Map.pcs[ 5 ] ); - RtemsIntrReqEntryRemove_Pre_CanDisable_Prepare( - ctx, - ctx->Map.entry.Pre_CanDisable_NA ? RtemsIntrReqEntryRemove_Pre_CanDisable_NA : ctx->Map.pcs[ 6 ] - ); - RtemsIntrReqEntryRemove_Pre_First_Prepare( - ctx, - ctx->Map.entry.Pre_First_NA ? RtemsIntrReqEntryRemove_Pre_First_NA : ctx->Map.pcs[ 7 ] - ); - RtemsIntrReqEntryRemove_Pre_Last_Prepare( - ctx, - ctx->Map.entry.Pre_Last_NA ? RtemsIntrReqEntryRemove_Pre_Last_NA : ctx->Map.pcs[ 8 ] - ); + RtemsIntrReqEntryRemove_Pre_CanDisable_Prepare( ctx, ctx->Map.pcs[ 6 ] ); + RtemsIntrReqEntryRemove_Pre_First_Prepare( ctx, ctx->Map.pcs[ 7 ] ); + RtemsIntrReqEntryRemove_Pre_Last_Prepare( ctx, ctx->Map.pcs[ 8 ] ); RtemsIntrReqEntryRemove_Action( ctx ); RtemsIntrReqEntryRemove_Post_Status_Check( ctx, ctx->Map.entry.Post_Status ); RtemsIntrReqEntryRemove_Post_Disabled_Check( @@ -1359,51 +1419,52 @@ T_TEST_CASE_FIXTURE( ctx->Map.index = 0; for ( - ctx->Map.pcs[ 0 ] = RtemsIntrReqEntryRemove_Pre_Vector_Valid; - ctx->Map.pcs[ 0 ] < RtemsIntrReqEntryRemove_Pre_Vector_NA; - ++ctx->Map.pcs[ 0 ] + ctx->Map.pci[ 0 ] = RtemsIntrReqEntryRemove_Pre_Vector_Valid; + ctx->Map.pci[ 0 ] < RtemsIntrReqEntryRemove_Pre_Vector_NA; + ++ctx->Map.pci[ 0 ] ) { for ( - ctx->Map.pcs[ 1 ] = RtemsIntrReqEntryRemove_Pre_Entry_Obj; - ctx->Map.pcs[ 1 ] < RtemsIntrReqEntryRemove_Pre_Entry_NA; - ++ctx->Map.pcs[ 1 ] + ctx->Map.pci[ 1 ] = RtemsIntrReqEntryRemove_Pre_Entry_Obj; + ctx->Map.pci[ 1 ] < RtemsIntrReqEntryRemove_Pre_Entry_NA; + ++ctx->Map.pci[ 1 ] ) { for ( - ctx->Map.pcs[ 2 ] = RtemsIntrReqEntryRemove_Pre_Routine_Valid; - ctx->Map.pcs[ 2 ] < RtemsIntrReqEntryRemove_Pre_Routine_NA; - ++ctx->Map.pcs[ 2 ] + ctx->Map.pci[ 2 ] = RtemsIntrReqEntryRemove_Pre_Routine_Valid; + ctx->Map.pci[ 2 ] < RtemsIntrReqEntryRemove_Pre_Routine_NA; + ++ctx->Map.pci[ 2 ] ) { for ( - ctx->Map.pcs[ 3 ] = RtemsIntrReqEntryRemove_Pre_EntryObj_Installed; - ctx->Map.pcs[ 3 ] < RtemsIntrReqEntryRemove_Pre_EntryObj_NA; - ++ctx->Map.pcs[ 3 ] + ctx->Map.pci[ 3 ] = RtemsIntrReqEntryRemove_Pre_EntryObj_Installed; + ctx->Map.pci[ 3 ] < RtemsIntrReqEntryRemove_Pre_EntryObj_NA; + ++ctx->Map.pci[ 3 ] ) { for ( - ctx->Map.pcs[ 4 ] = RtemsIntrReqEntryRemove_Pre_Init_Yes; - ctx->Map.pcs[ 4 ] < RtemsIntrReqEntryRemove_Pre_Init_NA; - ++ctx->Map.pcs[ 4 ] + ctx->Map.pci[ 4 ] = RtemsIntrReqEntryRemove_Pre_Init_Yes; + ctx->Map.pci[ 4 ] < RtemsIntrReqEntryRemove_Pre_Init_NA; + ++ctx->Map.pci[ 4 ] ) { for ( - ctx->Map.pcs[ 5 ] = RtemsIntrReqEntryRemove_Pre_ISR_Yes; - ctx->Map.pcs[ 5 ] < RtemsIntrReqEntryRemove_Pre_ISR_NA; - ++ctx->Map.pcs[ 5 ] + ctx->Map.pci[ 5 ] = RtemsIntrReqEntryRemove_Pre_ISR_Yes; + ctx->Map.pci[ 5 ] < RtemsIntrReqEntryRemove_Pre_ISR_NA; + ++ctx->Map.pci[ 5 ] ) { for ( - ctx->Map.pcs[ 6 ] = RtemsIntrReqEntryRemove_Pre_CanDisable_Yes; - ctx->Map.pcs[ 6 ] < RtemsIntrReqEntryRemove_Pre_CanDisable_NA; - ++ctx->Map.pcs[ 6 ] + ctx->Map.pci[ 6 ] = RtemsIntrReqEntryRemove_Pre_CanDisable_Yes; + ctx->Map.pci[ 6 ] < RtemsIntrReqEntryRemove_Pre_CanDisable_NA; + ++ctx->Map.pci[ 6 ] ) { for ( - ctx->Map.pcs[ 7 ] = RtemsIntrReqEntryRemove_Pre_First_Yes; - ctx->Map.pcs[ 7 ] < RtemsIntrReqEntryRemove_Pre_First_NA; - ++ctx->Map.pcs[ 7 ] + ctx->Map.pci[ 7 ] = RtemsIntrReqEntryRemove_Pre_First_Yes; + ctx->Map.pci[ 7 ] < RtemsIntrReqEntryRemove_Pre_First_NA; + ++ctx->Map.pci[ 7 ] ) { for ( - ctx->Map.pcs[ 8 ] = RtemsIntrReqEntryRemove_Pre_Last_Yes; - ctx->Map.pcs[ 8 ] < RtemsIntrReqEntryRemove_Pre_Last_NA; - ++ctx->Map.pcs[ 8 ] + ctx->Map.pci[ 8 ] = RtemsIntrReqEntryRemove_Pre_Last_Yes; + ctx->Map.pci[ 8 ] < RtemsIntrReqEntryRemove_Pre_Last_NA; + ++ctx->Map.pci[ 8 ] ) { ctx->Map.entry = RtemsIntrReqEntryRemove_PopEntry( ctx ); + RtemsIntrReqEntryRemove_SetPreConditionStates( ctx ); RtemsIntrReqEntryRemove_Prepare( ctx ); RtemsIntrReqEntryRemove_TestVariant( ctx ); RtemsIntrReqEntryRemove_Cleanup( ctx ); |