54 #include <rtems/test.h> 65 RtemsPartReqDelete_Pre_Id_Id,
66 RtemsPartReqDelete_Pre_Id_Invalid,
67 RtemsPartReqDelete_Pre_Id_NA
68 } RtemsPartReqDelete_Pre_Id;
71 RtemsPartReqDelete_Pre_InUse_True,
72 RtemsPartReqDelete_Pre_InUse_False,
73 RtemsPartReqDelete_Pre_InUse_NA
74 } RtemsPartReqDelete_Pre_InUse;
77 RtemsPartReqDelete_Post_Status_Ok,
78 RtemsPartReqDelete_Post_Status_InvId,
79 RtemsPartReqDelete_Post_Status_InUse,
80 RtemsPartReqDelete_Post_Status_NA
81 } RtemsPartReqDelete_Post_Status;
108 RtemsPartReqDelete_Instance;
110 static const char *
const RtemsPartReqDelete_PreDesc_Id[] = {
116 static const char *
const RtemsPartReqDelete_PreDesc_InUse[] = {
122 static const char *
const *
const RtemsPartReqDelete_PreDesc[] = {
123 RtemsPartReqDelete_PreDesc_Id,
124 RtemsPartReqDelete_PreDesc_InUse,
128 #define PART_NAME rtems_build_name( 'N', 'A', 'M', 'E' ) 130 #define BUFFER_COUNT 1 132 #define BUFFER_SIZE ( 2 * sizeof( void * ) ) 135 buffers[ BUFFER_COUNT ][ BUFFER_SIZE ];
137 static void RtemsPartReqDelete_Pre_Id_Prepare(
139 RtemsPartReqDelete_Pre_Id state
143 case RtemsPartReqDelete_Pre_Id_Id: {
144 ctx->id = ctx->id_value;
148 case RtemsPartReqDelete_Pre_Id_Invalid: {
153 case RtemsPartReqDelete_Pre_Id_NA:
158 static void RtemsPartReqDelete_Pre_InUse_Prepare(
160 RtemsPartReqDelete_Pre_InUse state
166 case RtemsPartReqDelete_Pre_InUse_True: {
170 T_not_null( ctx->buffer );
174 case RtemsPartReqDelete_Pre_InUse_False: {
179 case RtemsPartReqDelete_Pre_InUse_NA:
184 static void RtemsPartReqDelete_Post_Status_Check(
186 RtemsPartReqDelete_Post_Status state
193 case RtemsPartReqDelete_Post_Status_Ok: {
194 T_rsc_success( ctx->status );
195 ctx->id_value = 0xffffffff;
200 T_eq_u32(
id, 0xffffffff );
204 case RtemsPartReqDelete_Post_Status_InvId: {
210 T_eq_u32(
id, ctx->id_value );
214 case RtemsPartReqDelete_Post_Status_InUse: {
220 T_eq_u32(
id, ctx->id_value );
224 case RtemsPartReqDelete_Post_Status_NA:
229 static size_t RtemsPartReqDelete_Scope(
void *arg,
char *buf,
size_t n )
236 return T_get_scope( RtemsPartReqDelete_PreDesc, buf, n, ctx->
pcs );
242 static T_fixture RtemsPartReqDelete_Fixture = {
246 .scope = RtemsPartReqDelete_Scope,
247 .initial_context = &RtemsPartReqDelete_Instance
250 static const uint8_t RtemsPartReqDelete_TransitionMap[][ 1 ] = {
252 RtemsPartReqDelete_Post_Status_InUse
254 RtemsPartReqDelete_Post_Status_Ok
256 RtemsPartReqDelete_Post_Status_InvId
258 RtemsPartReqDelete_Post_Status_InvId
262 static const struct {
264 uint8_t Pre_Id_NA : 1;
265 uint8_t Pre_InUse_NA : 1;
266 } RtemsPartReqDelete_TransitionInfo[] = {
286 sizeof( buffers[ 0 ] ),
302 if ( ctx->buffer != NULL ) {
307 if ( ctx->id_value != 0xffffffff ) {
316 T_TEST_CASE_FIXTURE( RtemsPartReqDelete, &RtemsPartReqDelete_Fixture )
321 ctx = T_fixture_context();
326 ctx->
pcs[ 0 ] = RtemsPartReqDelete_Pre_Id_Id;
327 ctx->
pcs[ 0 ] < RtemsPartReqDelete_Pre_Id_NA;
330 if ( RtemsPartReqDelete_TransitionInfo[ index ].Pre_Id_NA ) {
331 ctx->
pcs[ 0 ] = RtemsPartReqDelete_Pre_Id_NA;
332 index += ( RtemsPartReqDelete_Pre_Id_NA - 1 )
333 * RtemsPartReqDelete_Pre_InUse_NA;
337 ctx->
pcs[ 1 ] = RtemsPartReqDelete_Pre_InUse_True;
338 ctx->
pcs[ 1 ] < RtemsPartReqDelete_Pre_InUse_NA;
341 if ( RtemsPartReqDelete_TransitionInfo[ index ].Pre_InUse_NA ) {
342 ctx->
pcs[ 1 ] = RtemsPartReqDelete_Pre_InUse_NA;
343 index += ( RtemsPartReqDelete_Pre_InUse_NA - 1 );
346 if ( RtemsPartReqDelete_TransitionInfo[ index ].Skip ) {
351 RtemsPartReqDelete_Prepare( ctx );
352 RtemsPartReqDelete_Pre_Id_Prepare( ctx, ctx->
pcs[ 0 ] );
353 RtemsPartReqDelete_Pre_InUse_Prepare( ctx, ctx->
pcs[ 1 ] );
354 RtemsPartReqDelete_Action( ctx );
355 RtemsPartReqDelete_Post_Status_Check(
357 RtemsPartReqDelete_TransitionMap[ index ][ 0 ]
359 RtemsPartReqDelete_Cleanup( ctx );
bool in_action_loop
This member indicates if the test action loop is currently executed.
rtems_status_code rtems_partition_get_buffer(rtems_id id, void **buffer)
Tries to get a buffer from the specified partition.
This status code indicates that the object still had resources in use.
#define RTEMS_DEFAULT_ATTRIBUTES
This is the default value for an attribute set.
rtems_status_code rtems_partition_create(rtems_name name, void *starting_address, uintptr_t length, size_t buffer_size, rtems_attribute attribute_set, rtems_id *id)
Creates a partition.
Test context for spec:/rtems/part/req/delete test case.
rtems_status_code rtems_partition_delete(rtems_id id)
Deletes the specified partition.
size_t pcs[2]
This member defines the pre-condition states for the next action.
rtems_status_code rtems_partition_return_buffer(rtems_id id, void *buffer)
Returns a buffer to the specified partition.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
#define RTEMS_ALIGNED(_alignment)
Instructs the compiler in a declaration or definition to enforce the specified alignment.
This header file defines the RTEMS Classic API.
This status code indicates that an object identifier was invalid.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
rtems_status_code rtems_partition_ident(rtems_name name, uint32_t node, rtems_id *id)
Identifies a partition object by the specified object name.
This status code indicates that an object name was invalid.
#define RTEMS_SEARCH_LOCAL_NODE
%
#define RTEMS_PARTITION_ALIGNMENT
This constant defines the minimum alignment of a partition buffer in bytes.