54 #include <rtems/test.h> 65 RtemsTaskReqIdent_Pre_Pre_Self,
66 RtemsTaskReqIdent_Pre_Pre_Generic,
67 RtemsTaskReqIdent_Pre_Pre_NA
68 } RtemsTaskReqIdent_Pre_Pre;
71 RtemsTaskReqIdent_Post_Post_OkAndSelfId,
72 RtemsTaskReqIdent_Post_Post_Generic,
73 RtemsTaskReqIdent_Post_Post_NA
74 } RtemsTaskReqIdent_Post_Post;
101 RtemsTaskReqIdent_Instance;
103 static const char *
const RtemsTaskReqIdent_PreDesc_Pre[] = {
109 static const char *
const *
const RtemsTaskReqIdent_PreDesc[] = {
110 RtemsTaskReqIdent_PreDesc_Pre,
123 #define TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES 125 #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT ) 128 static char ClassicTaskIdentStorage[
136 .
name = ClassicObjectIdentName,
137 .initial_priority = 1,
138 .storage_area = ClassicTaskIdentStorage,
139 .storage_size =
sizeof( ClassicTaskIdentStorage ),
140 .maximum_thread_local_storage_size = MAX_TLS_SIZE,
142 .attributes = TASK_ATTRIBUTES
145 static void RtemsTaskReqIdent_Pre_Pre_Prepare(
147 RtemsTaskReqIdent_Pre_Pre state
151 case RtemsTaskReqIdent_Pre_Pre_Self: {
152 ctx->id_value = 0xffffffff;
153 ctx->id = &ctx->id_value;
157 case RtemsTaskReqIdent_Pre_Pre_Generic: {
163 case RtemsTaskReqIdent_Pre_Pre_NA:
168 static void RtemsTaskReqIdent_Post_Post_Check(
170 RtemsTaskReqIdent_Post_Post state
174 case RtemsTaskReqIdent_Post_Post_OkAndSelfId: {
176 T_eq_ptr(ctx->id, &ctx->id_value);
181 case RtemsTaskReqIdent_Post_Post_Generic: {
186 case RtemsTaskReqIdent_Post_Post_NA:
196 &ClassicTaskIdentConfig,
197 &ctx->id_local_object
199 T_assert_rsc_success( sc );
202 static void RtemsTaskReqIdent_Setup_Wrap(
void *arg )
208 RtemsTaskReqIdent_Setup( ctx );
213 if ( ctx->id_local_object != 0 ) {
221 static void RtemsTaskReqIdent_Teardown_Wrap(
void *arg )
227 RtemsTaskReqIdent_Teardown( ctx );
230 static size_t RtemsTaskReqIdent_Scope(
void *arg,
char *buf,
size_t n )
237 return T_get_scope( RtemsTaskReqIdent_PreDesc, buf, n, ctx->
pcs );
243 static T_fixture RtemsTaskReqIdent_Fixture = {
244 .setup = RtemsTaskReqIdent_Setup_Wrap,
246 .teardown = RtemsTaskReqIdent_Teardown_Wrap,
247 .scope = RtemsTaskReqIdent_Scope,
248 .initial_context = &RtemsTaskReqIdent_Instance
251 static const uint8_t RtemsTaskReqIdent_TransitionMap[][ 1 ] = {
253 RtemsTaskReqIdent_Post_Post_OkAndSelfId
255 RtemsTaskReqIdent_Post_Post_Generic
259 static const struct {
261 uint8_t Pre_Pre_NA : 1;
262 } RtemsTaskReqIdent_TransitionInfo[] = {
272 if ( ctx->id != NULL ) {
276 ctx->id_local_object,
277 ClassicTaskIdentAction
285 T_TEST_CASE_FIXTURE( RtemsTaskReqIdent, &RtemsTaskReqIdent_Fixture )
290 ctx = T_fixture_context();
295 ctx->
pcs[ 0 ] = RtemsTaskReqIdent_Pre_Pre_Self;
296 ctx->
pcs[ 0 ] < RtemsTaskReqIdent_Pre_Pre_NA;
299 if ( RtemsTaskReqIdent_TransitionInfo[ index ].Pre_Pre_NA ) {
300 ctx->
pcs[ 0 ] = RtemsTaskReqIdent_Pre_Pre_NA;
301 index += ( RtemsTaskReqIdent_Pre_Pre_NA - 1 );
304 if ( RtemsTaskReqIdent_TransitionInfo[ index ].Skip ) {
309 RtemsTaskReqIdent_Pre_Pre_Prepare( ctx, ctx->
pcs[ 0 ] );
310 RtemsTaskReqIdent_Action( ctx );
311 RtemsTaskReqIdent_Post_Post_Check(
313 RtemsTaskReqIdent_TransitionMap[ index ][ 0 ]
uint32_t rtems_name
This type is used to represent a Classic API object name.
rtems_status_code rtems_task_ident(rtems_name name, uint32_t node, rtems_id *id)
Identifies a task object by the specified object name.
bool in_action_loop
This member indicates if the test action loop is currently executed.
rtems_name name
This member defines the name of the task.
rtems_status_code rtems_task_delete(rtems_id id)
%
This structure defines the configuration of a task constructed by rtems_task_construct().
rtems_id rtems_task_self(void)
%
size_t pcs[1]
This member defines the pre-condition states for the next action.
This status code indicates successful completion.
void RtemsReqIdent_Run(rtems_id id_local_object, rtems_status_code(*action)(rtems_name, uint32_t, rtems_id *))
Runs the parameterized test case.
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.
#define RTEMS_MINIMUM_STACK_SIZE
%
Test context for spec:/rtems/task/req/ident test case.
#define RTEMS_TASK_STORAGE_SIZE(_size, _attributes)
Returns the recommended task storage area size for the specified size and task attributes.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
#define RTEMS_DEFAULT_MODES
This task mode constant represents the default mode set.
rtems_status_code rtems_task_construct(const rtems_task_config *config, rtems_id *id)
Constructs a task from the specified the task configuration.
#define RTEMS_TASK_STORAGE_ALIGNMENT
This constant defines the recommended alignment of a task storage area in bytes.