summaryrefslogtreecommitdiffstats
path: root/testsuites/validation/tc-intr-entry-remove.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/validation/tc-intr-entry-remove.c')
-rw-r--r--testsuites/validation/tc-intr-entry-remove.c358
1 files changed, 204 insertions, 154 deletions
diff --git a/testsuites/validation/tc-intr-entry-remove.c b/testsuites/validation/tc-intr-entry-remove.c
index 64f6e46de7..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
*
* @{
*/
@@ -148,6 +147,22 @@ typedef enum {
RtemsIntrReqEntryRemove_Post_Installed_NA
} RtemsIntrReqEntryRemove_Post_Installed;
+typedef struct {
+ uint32_t Skip : 1;
+ uint32_t Pre_Vector_NA : 1;
+ uint32_t Pre_Entry_NA : 1;
+ uint32_t Pre_Routine_NA : 1;
+ uint32_t Pre_EntryObj_NA : 1;
+ uint32_t Pre_Init_NA : 1;
+ uint32_t Pre_ISR_NA : 1;
+ uint32_t Pre_CanDisable_NA : 1;
+ uint32_t Pre_First_NA : 1;
+ uint32_t Pre_Last_NA : 1;
+ uint32_t Post_Status : 3;
+ uint32_t Post_Disabled : 3;
+ uint32_t Post_Installed : 2;
+} RtemsIntrReqEntryRemove_Entry;
+
/**
* @brief Test context for spec:/rtems/intr/req/entry-remove test case.
*/
@@ -166,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.
@@ -218,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.
*/
@@ -264,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
@@ -272,16 +293,39 @@ typedef struct {
*/
rtems_status_code status;
- /**
- * @brief This member defines the pre-condition states for the next action.
- */
- size_t pcs[ 9 ];
-
- /**
- * @brief This member indicates if the test action loop is currently
- * executed.
- */
- bool in_action_loop;
+ 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 ];
+
+ /**
+ * @brief If this member is true, then the test action loop is executed.
+ */
+ bool in_action_loop;
+
+ /**
+ * @brief This member contains the next transition map index.
+ */
+ size_t index;
+
+ /**
+ * @brief This member contains the current transition map entry.
+ */
+ RtemsIntrReqEntryRemove_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
} RtemsIntrReqEntryRemove_Context;
static RtemsIntrReqEntryRemove_Context
@@ -434,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
);
@@ -990,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 );
}
@@ -1030,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;
@@ -1048,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 );
}
@@ -1058,10 +1107,28 @@ static void RtemsIntrReqEntryRemove_Setup_Wrap( void *arg )
RtemsIntrReqEntryRemove_Context *ctx;
ctx = arg;
- ctx->in_action_loop = false;
+ ctx->Map.in_action_loop = false;
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
)
@@ -1135,22 +1202,6 @@ static void RtemsIntrReqEntryRemove_Cleanup(
}
}
-typedef struct {
- uint32_t Skip : 1;
- uint32_t Pre_Vector_NA : 1;
- uint32_t Pre_Entry_NA : 1;
- uint32_t Pre_Routine_NA : 1;
- uint32_t Pre_EntryObj_NA : 1;
- uint32_t Pre_Init_NA : 1;
- uint32_t Pre_ISR_NA : 1;
- uint32_t Pre_CanDisable_NA : 1;
- uint32_t Pre_First_NA : 1;
- uint32_t Pre_Last_NA : 1;
- uint32_t Post_Status : 3;
- uint32_t Post_Disabled : 3;
- uint32_t Post_Installed : 2;
-} RtemsIntrReqEntryRemove_Entry;
-
static const RtemsIntrReqEntryRemove_Entry
RtemsIntrReqEntryRemove_Entries[] = {
{ 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, RtemsIntrReqEntryRemove_Post_Status_InvAddr,
@@ -1254,8 +1305,13 @@ static size_t RtemsIntrReqEntryRemove_Scope( void *arg, char *buf, size_t n )
ctx = arg;
- if ( ctx->in_action_loop ) {
- return T_get_scope( RtemsIntrReqEntryRemove_PreDesc, buf, n, ctx->pcs );
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope(
+ RtemsIntrReqEntryRemove_PreDesc,
+ buf,
+ n,
+ ctx->Map.pcs
+ );
}
return 0;
@@ -1264,20 +1320,90 @@ 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
};
-static inline RtemsIntrReqEntryRemove_Entry RtemsIntrReqEntryRemove_GetEntry(
- size_t index
+static inline RtemsIntrReqEntryRemove_Entry RtemsIntrReqEntryRemove_PopEntry(
+ RtemsIntrReqEntryRemove_Context *ctx
)
{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
return RtemsIntrReqEntryRemove_Entries[
RtemsIntrReqEntryRemove_Map[ index ]
];
}
+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.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.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(
+ ctx,
+ ctx->Map.entry.Post_Disabled
+ );
+ RtemsIntrReqEntryRemove_Post_Installed_Check(
+ ctx,
+ ctx->Map.entry.Post_Installed
+ );
+}
+
/**
* @fn void T_case_body_RtemsIntrReqEntryRemove( void )
*/
@@ -1287,137 +1413,61 @@ T_TEST_CASE_FIXTURE(
)
{
RtemsIntrReqEntryRemove_Context *ctx;
- size_t index;
ctx = T_fixture_context();
- ctx->in_action_loop = true;
- index = 0;
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
for (
- ctx->pcs[ 0 ] = RtemsIntrReqEntryRemove_Pre_Vector_Valid;
- ctx->pcs[ 0 ] < RtemsIntrReqEntryRemove_Pre_Vector_NA;
- ++ctx->pcs[ 0 ]
+ ctx->Map.pci[ 0 ] = RtemsIntrReqEntryRemove_Pre_Vector_Valid;
+ ctx->Map.pci[ 0 ] < RtemsIntrReqEntryRemove_Pre_Vector_NA;
+ ++ctx->Map.pci[ 0 ]
) {
for (
- ctx->pcs[ 1 ] = RtemsIntrReqEntryRemove_Pre_Entry_Obj;
- ctx->pcs[ 1 ] < RtemsIntrReqEntryRemove_Pre_Entry_NA;
- ++ctx->pcs[ 1 ]
+ ctx->Map.pci[ 1 ] = RtemsIntrReqEntryRemove_Pre_Entry_Obj;
+ ctx->Map.pci[ 1 ] < RtemsIntrReqEntryRemove_Pre_Entry_NA;
+ ++ctx->Map.pci[ 1 ]
) {
for (
- ctx->pcs[ 2 ] = RtemsIntrReqEntryRemove_Pre_Routine_Valid;
- ctx->pcs[ 2 ] < RtemsIntrReqEntryRemove_Pre_Routine_NA;
- ++ctx->pcs[ 2 ]
+ ctx->Map.pci[ 2 ] = RtemsIntrReqEntryRemove_Pre_Routine_Valid;
+ ctx->Map.pci[ 2 ] < RtemsIntrReqEntryRemove_Pre_Routine_NA;
+ ++ctx->Map.pci[ 2 ]
) {
for (
- ctx->pcs[ 3 ] = RtemsIntrReqEntryRemove_Pre_EntryObj_Installed;
- ctx->pcs[ 3 ] < RtemsIntrReqEntryRemove_Pre_EntryObj_NA;
- ++ctx->pcs[ 3 ]
+ ctx->Map.pci[ 3 ] = RtemsIntrReqEntryRemove_Pre_EntryObj_Installed;
+ ctx->Map.pci[ 3 ] < RtemsIntrReqEntryRemove_Pre_EntryObj_NA;
+ ++ctx->Map.pci[ 3 ]
) {
for (
- ctx->pcs[ 4 ] = RtemsIntrReqEntryRemove_Pre_Init_Yes;
- ctx->pcs[ 4 ] < RtemsIntrReqEntryRemove_Pre_Init_NA;
- ++ctx->pcs[ 4 ]
+ ctx->Map.pci[ 4 ] = RtemsIntrReqEntryRemove_Pre_Init_Yes;
+ ctx->Map.pci[ 4 ] < RtemsIntrReqEntryRemove_Pre_Init_NA;
+ ++ctx->Map.pci[ 4 ]
) {
for (
- ctx->pcs[ 5 ] = RtemsIntrReqEntryRemove_Pre_ISR_Yes;
- ctx->pcs[ 5 ] < RtemsIntrReqEntryRemove_Pre_ISR_NA;
- ++ctx->pcs[ 5 ]
+ ctx->Map.pci[ 5 ] = RtemsIntrReqEntryRemove_Pre_ISR_Yes;
+ ctx->Map.pci[ 5 ] < RtemsIntrReqEntryRemove_Pre_ISR_NA;
+ ++ctx->Map.pci[ 5 ]
) {
for (
- ctx->pcs[ 6 ] = RtemsIntrReqEntryRemove_Pre_CanDisable_Yes;
- ctx->pcs[ 6 ] < RtemsIntrReqEntryRemove_Pre_CanDisable_NA;
- ++ctx->pcs[ 6 ]
+ ctx->Map.pci[ 6 ] = RtemsIntrReqEntryRemove_Pre_CanDisable_Yes;
+ ctx->Map.pci[ 6 ] < RtemsIntrReqEntryRemove_Pre_CanDisable_NA;
+ ++ctx->Map.pci[ 6 ]
) {
for (
- ctx->pcs[ 7 ] = RtemsIntrReqEntryRemove_Pre_First_Yes;
- ctx->pcs[ 7 ] < RtemsIntrReqEntryRemove_Pre_First_NA;
- ++ctx->pcs[ 7 ]
+ ctx->Map.pci[ 7 ] = RtemsIntrReqEntryRemove_Pre_First_Yes;
+ ctx->Map.pci[ 7 ] < RtemsIntrReqEntryRemove_Pre_First_NA;
+ ++ctx->Map.pci[ 7 ]
) {
for (
- ctx->pcs[ 8 ] = RtemsIntrReqEntryRemove_Pre_Last_Yes;
- ctx->pcs[ 8 ] < RtemsIntrReqEntryRemove_Pre_Last_NA;
- ++ctx->pcs[ 8 ]
+ ctx->Map.pci[ 8 ] = RtemsIntrReqEntryRemove_Pre_Last_Yes;
+ ctx->Map.pci[ 8 ] < RtemsIntrReqEntryRemove_Pre_Last_NA;
+ ++ctx->Map.pci[ 8 ]
) {
- RtemsIntrReqEntryRemove_Entry entry;
- size_t pcs[ 9 ];
-
- entry = RtemsIntrReqEntryRemove_GetEntry( index );
- ++index;
-
- memcpy( pcs, ctx->pcs, sizeof( pcs ) );
-
- if ( entry.Pre_Routine_NA ) {
- ctx->pcs[ 2 ] = RtemsIntrReqEntryRemove_Pre_Routine_NA;
- }
-
- if ( entry.Pre_EntryObj_NA ) {
- ctx->pcs[ 3 ] = RtemsIntrReqEntryRemove_Pre_EntryObj_NA;
- }
-
- if ( entry.Pre_CanDisable_NA ) {
- ctx->pcs[ 6 ] = RtemsIntrReqEntryRemove_Pre_CanDisable_NA;
- }
-
- if ( entry.Pre_First_NA ) {
- ctx->pcs[ 7 ] = RtemsIntrReqEntryRemove_Pre_First_NA;
- }
-
- if ( entry.Pre_Last_NA ) {
- ctx->pcs[ 8 ] = RtemsIntrReqEntryRemove_Pre_Last_NA;
- }
-
+ ctx->Map.entry = RtemsIntrReqEntryRemove_PopEntry( ctx );
+ RtemsIntrReqEntryRemove_SetPreConditionStates( ctx );
RtemsIntrReqEntryRemove_Prepare( ctx );
- RtemsIntrReqEntryRemove_Pre_Vector_Prepare(
- ctx,
- ctx->pcs[ 0 ]
- );
- RtemsIntrReqEntryRemove_Pre_Entry_Prepare(
- ctx,
- ctx->pcs[ 1 ]
- );
- RtemsIntrReqEntryRemove_Pre_Routine_Prepare(
- ctx,
- ctx->pcs[ 2 ]
- );
- RtemsIntrReqEntryRemove_Pre_EntryObj_Prepare(
- ctx,
- ctx->pcs[ 3 ]
- );
- RtemsIntrReqEntryRemove_Pre_Init_Prepare(
- ctx,
- ctx->pcs[ 4 ]
- );
- RtemsIntrReqEntryRemove_Pre_ISR_Prepare(
- ctx,
- ctx->pcs[ 5 ]
- );
- RtemsIntrReqEntryRemove_Pre_CanDisable_Prepare(
- ctx,
- ctx->pcs[ 6 ]
- );
- RtemsIntrReqEntryRemove_Pre_First_Prepare(
- ctx,
- ctx->pcs[ 7 ]
- );
- RtemsIntrReqEntryRemove_Pre_Last_Prepare(
- ctx,
- ctx->pcs[ 8 ]
- );
- RtemsIntrReqEntryRemove_Action( ctx );
- RtemsIntrReqEntryRemove_Post_Status_Check(
- ctx,
- entry.Post_Status
- );
- RtemsIntrReqEntryRemove_Post_Disabled_Check(
- ctx,
- entry.Post_Disabled
- );
- RtemsIntrReqEntryRemove_Post_Installed_Check(
- ctx,
- entry.Post_Installed
- );
+ RtemsIntrReqEntryRemove_TestVariant( ctx );
RtemsIntrReqEntryRemove_Cleanup( ctx );
- memcpy( ctx->pcs, pcs, sizeof( ctx->pcs ) );
}
}
}