summaryrefslogtreecommitdiffstats
path: root/testsuites/validation/tc-intr-get-attributes.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/validation/tc-intr-get-attributes.c')
-rw-r--r--testsuites/validation/tc-intr-get-attributes.c128
1 files changed, 79 insertions, 49 deletions
diff --git a/testsuites/validation/tc-intr-get-attributes.c b/testsuites/validation/tc-intr-get-attributes.c
index 16860a08cd..4594c78a2e 100644
--- a/testsuites/validation/tc-intr-get-attributes.c
+++ b/testsuites/validation/tc-intr-get-attributes.c
@@ -3,11 +3,11 @@
/**
* @file
*
- * @ingroup RTEMSTestCaseRtemsIntrReqGetAttributes
+ * @ingroup RtemsIntrReqGetAttributes
*/
/*
- * 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
@@ -59,10 +59,9 @@
#include <rtems/test.h>
/**
- * @defgroup RTEMSTestCaseRtemsIntrReqGetAttributes \
- * spec:/rtems/intr/req/get-attributes
+ * @defgroup RtemsIntrReqGetAttributes spec:/rtems/intr/req/get-attributes
*
- * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ * @ingroup TestsuitesValidationIntr
*
* @{
*/
@@ -93,6 +92,14 @@ typedef enum {
RtemsIntrReqGetAttributes_Post_Attributes_NA
} RtemsIntrReqGetAttributes_Post_Attributes;
+typedef struct {
+ uint8_t Skip : 1;
+ uint8_t Pre_Vector_NA : 1;
+ uint8_t Pre_Attributes_NA : 1;
+ uint8_t Post_Status : 2;
+ uint8_t Post_Attributes : 2;
+} RtemsIntrReqGetAttributes_Entry;
+
/**
* @brief Test context for spec:/rtems/intr/req/get-attributes test case.
*/
@@ -111,7 +118,7 @@ typedef struct {
/**
* @brief This member specifies if the ``attributes`` parameter value.
*/
- rtems_interrupt_attributes *attributes;;
+ rtems_interrupt_attributes *attributes;
/**
* @brief This member contains the return value of the
@@ -119,16 +126,33 @@ typedef struct {
*/
rtems_status_code status;
- /**
- * @brief This member defines the pre-condition states for the next action.
- */
- size_t pcs[ 2 ];
-
- /**
- * @brief This member indicates if the test action loop is currently
- * executed.
- */
- bool in_action_loop;
+ struct {
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 2 ];
+
+ /**
+ * @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.
+ */
+ RtemsIntrReqGetAttributes_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
} RtemsIntrReqGetAttributes_Context;
static RtemsIntrReqGetAttributes_Context
@@ -342,14 +366,6 @@ static void RtemsIntrReqGetAttributes_Action(
}
}
-typedef struct {
- uint8_t Skip : 1;
- uint8_t Pre_Vector_NA : 1;
- uint8_t Pre_Attributes_NA : 1;
- uint8_t Post_Status : 2;
- uint8_t Post_Attributes : 2;
-} RtemsIntrReqGetAttributes_Entry;
-
static const RtemsIntrReqGetAttributes_Entry
RtemsIntrReqGetAttributes_Entries[] = {
{ 0, 0, 0, RtemsIntrReqGetAttributes_Post_Status_InvAddr,
@@ -371,8 +387,13 @@ static size_t RtemsIntrReqGetAttributes_Scope( void *arg, char *buf, size_t n )
ctx = arg;
- if ( ctx->in_action_loop ) {
- return T_get_scope( RtemsIntrReqGetAttributes_PreDesc, buf, n, ctx->pcs );
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope(
+ RtemsIntrReqGetAttributes_PreDesc,
+ buf,
+ n,
+ ctx->Map.pcs
+ );
}
return 0;
@@ -387,13 +408,34 @@ static T_fixture RtemsIntrReqGetAttributes_Fixture = {
};
static inline RtemsIntrReqGetAttributes_Entry
-RtemsIntrReqGetAttributes_GetEntry( size_t index )
+RtemsIntrReqGetAttributes_PopEntry( RtemsIntrReqGetAttributes_Context *ctx )
{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
return RtemsIntrReqGetAttributes_Entries[
RtemsIntrReqGetAttributes_Map[ index ]
];
}
+static void RtemsIntrReqGetAttributes_TestVariant(
+ RtemsIntrReqGetAttributes_Context *ctx
+)
+{
+ RtemsIntrReqGetAttributes_Pre_Vector_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsIntrReqGetAttributes_Pre_Attributes_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsIntrReqGetAttributes_Action( ctx );
+ RtemsIntrReqGetAttributes_Post_Status_Check(
+ ctx,
+ ctx->Map.entry.Post_Status
+ );
+ RtemsIntrReqGetAttributes_Post_Attributes_Check(
+ ctx,
+ ctx->Map.entry.Post_Attributes
+ );
+}
+
/**
* @fn void T_case_body_RtemsIntrReqGetAttributes( void )
*/
@@ -403,36 +445,24 @@ T_TEST_CASE_FIXTURE(
)
{
RtemsIntrReqGetAttributes_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 ] = RtemsIntrReqGetAttributes_Pre_Vector_Valid;
- ctx->pcs[ 0 ] < RtemsIntrReqGetAttributes_Pre_Vector_NA;
- ++ctx->pcs[ 0 ]
+ ctx->Map.pcs[ 0 ] = RtemsIntrReqGetAttributes_Pre_Vector_Valid;
+ ctx->Map.pcs[ 0 ] < RtemsIntrReqGetAttributes_Pre_Vector_NA;
+ ++ctx->Map.pcs[ 0 ]
) {
for (
- ctx->pcs[ 1 ] = RtemsIntrReqGetAttributes_Pre_Attributes_Obj;
- ctx->pcs[ 1 ] < RtemsIntrReqGetAttributes_Pre_Attributes_NA;
- ++ctx->pcs[ 1 ]
+ ctx->Map.pcs[ 1 ] = RtemsIntrReqGetAttributes_Pre_Attributes_Obj;
+ ctx->Map.pcs[ 1 ] < RtemsIntrReqGetAttributes_Pre_Attributes_NA;
+ ++ctx->Map.pcs[ 1 ]
) {
- RtemsIntrReqGetAttributes_Entry entry;
-
- entry = RtemsIntrReqGetAttributes_GetEntry( index );
- ++index;
-
+ ctx->Map.entry = RtemsIntrReqGetAttributes_PopEntry( ctx );
RtemsIntrReqGetAttributes_Prepare( ctx );
- RtemsIntrReqGetAttributes_Pre_Vector_Prepare( ctx, ctx->pcs[ 0 ] );
- RtemsIntrReqGetAttributes_Pre_Attributes_Prepare( ctx, ctx->pcs[ 1 ] );
- RtemsIntrReqGetAttributes_Action( ctx );
- RtemsIntrReqGetAttributes_Post_Status_Check( ctx, entry.Post_Status );
- RtemsIntrReqGetAttributes_Post_Attributes_Check(
- ctx,
- entry.Post_Attributes
- );
+ RtemsIntrReqGetAttributes_TestVariant( ctx );
}
}
}