summaryrefslogtreecommitdiffstats
path: root/testsuites/validation/tc-intr-vector-is-enabled.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/validation/tc-intr-vector-is-enabled.c')
-rw-r--r--testsuites/validation/tc-intr-vector-is-enabled.c170
1 files changed, 102 insertions, 68 deletions
diff --git a/testsuites/validation/tc-intr-vector-is-enabled.c b/testsuites/validation/tc-intr-vector-is-enabled.c
index 15f13a132b..d24ad3f602 100644
--- a/testsuites/validation/tc-intr-vector-is-enabled.c
+++ b/testsuites/validation/tc-intr-vector-is-enabled.c
@@ -3,11 +3,11 @@
/**
* @file
*
- * @ingroup RTEMSTestCaseRtemsIntrReqVectorIsEnabled
+ * @ingroup RtemsIntrReqVectorIsEnabled
*/
/*
- * 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
@@ -61,10 +61,9 @@
#include <rtems/test.h>
/**
- * @defgroup RTEMSTestCaseRtemsIntrReqVectorIsEnabled \
- * spec:/rtems/intr/req/vector-is-enabled
+ * @defgroup RtemsIntrReqVectorIsEnabled spec:/rtems/intr/req/vector-is-enabled
*
- * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ * @ingroup TestsuitesValidationIntr
*
* @{
*/
@@ -101,6 +100,15 @@ typedef enum {
RtemsIntrReqVectorIsEnabled_Post_IsEnabled_NA
} RtemsIntrReqVectorIsEnabled_Post_IsEnabled;
+typedef struct {
+ uint8_t Skip : 1;
+ uint8_t Pre_Vector_NA : 1;
+ uint8_t Pre_Enabled_NA : 1;
+ uint8_t Pre_IsEnabled_NA : 1;
+ uint8_t Post_Status : 2;
+ uint8_t Post_IsEnabled : 2;
+} RtemsIntrReqVectorIsEnabled_Entry;
+
/**
* @brief Test context for spec:/rtems/intr/req/vector-is-enabled test case.
*/
@@ -135,7 +143,7 @@ typedef struct {
/**
* @brief This member specifies if the ``enabled`` parameter value.
*/
- bool *enabled;;
+ bool *enabled;
/**
* @brief This member contains the return value of the
@@ -143,16 +151,39 @@ typedef struct {
*/
rtems_status_code status;
- /**
- * @brief This member defines the pre-condition states for the next action.
- */
- size_t pcs[ 3 ];
-
- /**
- * @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[ 3 ];
+
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 3 ];
+
+ /**
+ * @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.
+ */
+ RtemsIntrReqVectorIsEnabled_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
} RtemsIntrReqVectorIsEnabled_Context;
static RtemsIntrReqVectorIsEnabled_Context
@@ -495,15 +526,6 @@ static void RtemsIntrReqVectorIsEnabled_Action(
}
}
-typedef struct {
- uint8_t Skip : 1;
- uint8_t Pre_Vector_NA : 1;
- uint8_t Pre_Enabled_NA : 1;
- uint8_t Pre_IsEnabled_NA : 1;
- uint8_t Post_Status : 2;
- uint8_t Post_IsEnabled : 2;
-} RtemsIntrReqVectorIsEnabled_Entry;
-
static const RtemsIntrReqVectorIsEnabled_Entry
RtemsIntrReqVectorIsEnabled_Entries[] = {
{ 0, 0, 0, 0, RtemsIntrReqVectorIsEnabled_Post_Status_InvAddr,
@@ -533,12 +555,12 @@ static size_t RtemsIntrReqVectorIsEnabled_Scope(
ctx = arg;
- if ( ctx->in_action_loop ) {
+ if ( ctx->Map.in_action_loop ) {
return T_get_scope(
RtemsIntrReqVectorIsEnabled_PreDesc,
buf,
n,
- ctx->pcs
+ ctx->Map.pcs
);
}
@@ -554,13 +576,51 @@ static T_fixture RtemsIntrReqVectorIsEnabled_Fixture = {
};
static inline RtemsIntrReqVectorIsEnabled_Entry
-RtemsIntrReqVectorIsEnabled_GetEntry( size_t index )
+RtemsIntrReqVectorIsEnabled_PopEntry(
+ RtemsIntrReqVectorIsEnabled_Context *ctx
+)
{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
return RtemsIntrReqVectorIsEnabled_Entries[
RtemsIntrReqVectorIsEnabled_Map[ index ]
];
}
+static void RtemsIntrReqVectorIsEnabled_SetPreConditionStates(
+ RtemsIntrReqVectorIsEnabled_Context *ctx
+)
+{
+ ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
+ ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
+
+ if ( ctx->Map.entry.Pre_IsEnabled_NA ) {
+ ctx->Map.pcs[ 2 ] = RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_NA;
+ } else {
+ ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
+ }
+}
+
+static void RtemsIntrReqVectorIsEnabled_TestVariant(
+ RtemsIntrReqVectorIsEnabled_Context *ctx
+)
+{
+ RtemsIntrReqVectorIsEnabled_Pre_Vector_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsIntrReqVectorIsEnabled_Pre_Enabled_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsIntrReqVectorIsEnabled_Action( ctx );
+ RtemsIntrReqVectorIsEnabled_Post_Status_Check(
+ ctx,
+ ctx->Map.entry.Post_Status
+ );
+ RtemsIntrReqVectorIsEnabled_Post_IsEnabled_Check(
+ ctx,
+ ctx->Map.entry.Post_IsEnabled
+ );
+}
+
/**
* @fn void T_case_body_RtemsIntrReqVectorIsEnabled( void )
*/
@@ -570,55 +630,29 @@ T_TEST_CASE_FIXTURE(
)
{
RtemsIntrReqVectorIsEnabled_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 ] = RtemsIntrReqVectorIsEnabled_Pre_Vector_Valid;
- ctx->pcs[ 0 ] < RtemsIntrReqVectorIsEnabled_Pre_Vector_NA;
- ++ctx->pcs[ 0 ]
+ ctx->Map.pci[ 0 ] = RtemsIntrReqVectorIsEnabled_Pre_Vector_Valid;
+ ctx->Map.pci[ 0 ] < RtemsIntrReqVectorIsEnabled_Pre_Vector_NA;
+ ++ctx->Map.pci[ 0 ]
) {
for (
- ctx->pcs[ 1 ] = RtemsIntrReqVectorIsEnabled_Pre_Enabled_Obj;
- ctx->pcs[ 1 ] < RtemsIntrReqVectorIsEnabled_Pre_Enabled_NA;
- ++ctx->pcs[ 1 ]
+ ctx->Map.pci[ 1 ] = RtemsIntrReqVectorIsEnabled_Pre_Enabled_Obj;
+ ctx->Map.pci[ 1 ] < RtemsIntrReqVectorIsEnabled_Pre_Enabled_NA;
+ ++ctx->Map.pci[ 1 ]
) {
for (
- ctx->pcs[ 2 ] = RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_Yes;
- ctx->pcs[ 2 ] < RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_NA;
- ++ctx->pcs[ 2 ]
+ ctx->Map.pci[ 2 ] = RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_Yes;
+ ctx->Map.pci[ 2 ] < RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_NA;
+ ++ctx->Map.pci[ 2 ]
) {
- RtemsIntrReqVectorIsEnabled_Entry entry;
- size_t pcs[ 3 ];
-
- entry = RtemsIntrReqVectorIsEnabled_GetEntry( index );
- ++index;
-
- memcpy( pcs, ctx->pcs, sizeof( pcs ) );
-
- if ( entry.Pre_IsEnabled_NA ) {
- ctx->pcs[ 2 ] = RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_NA;
- }
-
- RtemsIntrReqVectorIsEnabled_Pre_Vector_Prepare( ctx, ctx->pcs[ 0 ] );
- RtemsIntrReqVectorIsEnabled_Pre_Enabled_Prepare( ctx, ctx->pcs[ 1 ] );
- RtemsIntrReqVectorIsEnabled_Pre_IsEnabled_Prepare(
- ctx,
- ctx->pcs[ 2 ]
- );
- RtemsIntrReqVectorIsEnabled_Action( ctx );
- RtemsIntrReqVectorIsEnabled_Post_Status_Check(
- ctx,
- entry.Post_Status
- );
- RtemsIntrReqVectorIsEnabled_Post_IsEnabled_Check(
- ctx,
- entry.Post_IsEnabled
- );
- memcpy( ctx->pcs, pcs, sizeof( ctx->pcs ) );
+ ctx->Map.entry = RtemsIntrReqVectorIsEnabled_PopEntry( ctx );
+ RtemsIntrReqVectorIsEnabled_SetPreConditionStates( ctx );
+ RtemsIntrReqVectorIsEnabled_TestVariant( ctx );
}
}
}