1 | SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause |
---|
2 | copyrights: |
---|
3 | - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) |
---|
4 | enabled-by: true |
---|
5 | functional-type: action |
---|
6 | links: |
---|
7 | - role: interface-function |
---|
8 | uid: /rtems/task/if/ident |
---|
9 | post-conditions: |
---|
10 | - name: Post |
---|
11 | states: |
---|
12 | - name: OkAndSelfId |
---|
13 | test-code: | |
---|
14 | T_rsc(ctx->status, RTEMS_SUCCESSFUL); |
---|
15 | T_eq_ptr(ctx->id, &ctx->id_value); |
---|
16 | T_eq_u32(ctx->id_value, rtems_task_self()); |
---|
17 | text: | |
---|
18 | The status shall be RTEMS_SUCCESSFUL. The value of the object identifier |
---|
19 | referenced by the id parameter shall be the identifier of the executing |
---|
20 | thread. |
---|
21 | - name: Generic |
---|
22 | test-code: | |
---|
23 | /* Checks performed by ${../../req/ident:/test-run}() */ |
---|
24 | text: | |
---|
25 | The post-condition status shall be specified by ${../../req/ident}. |
---|
26 | test-epilogue: null |
---|
27 | test-prologue: null |
---|
28 | pre-conditions: |
---|
29 | - name: Pre |
---|
30 | states: |
---|
31 | - name: Self |
---|
32 | test-code: | |
---|
33 | ctx->id_value = 0xffffffff; |
---|
34 | ctx->id = &ctx->id_value; |
---|
35 | text: | |
---|
36 | The name parameter shall be RTEMS_SELF. |
---|
37 | - name: Generic |
---|
38 | test-code: | |
---|
39 | ctx->id = NULL; |
---|
40 | /* Preparation performed by ${../../req/ident:/test-run}() */ |
---|
41 | text: | |
---|
42 | The pre-condition status shall be specified by ${../../req/ident}. |
---|
43 | test-epilogue: null |
---|
44 | test-prologue: null |
---|
45 | rationale: null |
---|
46 | references: [] |
---|
47 | requirement-type: functional |
---|
48 | skip-reasons: {} |
---|
49 | test-action: | |
---|
50 | if ( ctx->id != NULL ) { |
---|
51 | ctx->status = rtems_task_ident( RTEMS_SELF, 0xdeadbeef, ctx->id ); |
---|
52 | } else { |
---|
53 | ${../../req/ident:/test-run}( |
---|
54 | ctx->id_local_object, |
---|
55 | ClassicTaskIdentAction |
---|
56 | ); |
---|
57 | } |
---|
58 | test-brief: null |
---|
59 | test-cleanup: null |
---|
60 | test-context: |
---|
61 | - brief: null |
---|
62 | description: null |
---|
63 | member: rtems_status_code status |
---|
64 | - brief: null |
---|
65 | description: null |
---|
66 | member: rtems_id *id |
---|
67 | - brief: null |
---|
68 | description: null |
---|
69 | member: rtems_id id_value |
---|
70 | - brief: null |
---|
71 | description: null |
---|
72 | member: rtems_id id_local_object |
---|
73 | test-context-support: null |
---|
74 | test-description: null |
---|
75 | test-header: null |
---|
76 | test-includes: [] |
---|
77 | test-local-includes: |
---|
78 | - tr-object-ident.h |
---|
79 | test-prepare: null |
---|
80 | test-setup: |
---|
81 | brief: null |
---|
82 | code: | |
---|
83 | rtems_status_code sc; |
---|
84 | |
---|
85 | sc = rtems_task_construct( |
---|
86 | &ClassicTaskIdentConfig, |
---|
87 | &ctx->id_local_object |
---|
88 | ); |
---|
89 | T_assert_rsc_success( sc ); |
---|
90 | description: null |
---|
91 | test-stop: null |
---|
92 | test-support: | |
---|
93 | static rtems_status_code ClassicTaskIdentAction( |
---|
94 | rtems_name name, |
---|
95 | uint32_t node, |
---|
96 | rtems_id *id |
---|
97 | ) |
---|
98 | { |
---|
99 | return rtems_task_ident( name, node, id ); |
---|
100 | } |
---|
101 | |
---|
102 | #define TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES |
---|
103 | |
---|
104 | #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT ) |
---|
105 | |
---|
106 | RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) |
---|
107 | static char ClassicTaskIdentStorage[ |
---|
108 | RTEMS_TASK_STORAGE_SIZE( |
---|
109 | MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE, |
---|
110 | TASK_ATTRIBUTES |
---|
111 | ) |
---|
112 | ]; |
---|
113 | |
---|
114 | static const rtems_task_config ClassicTaskIdentConfig = { |
---|
115 | .name = ClassicObjectIdentName, |
---|
116 | .initial_priority = 1, |
---|
117 | .storage_area = ClassicTaskIdentStorage, |
---|
118 | .storage_size = sizeof( ClassicTaskIdentStorage ), |
---|
119 | .maximum_thread_local_storage_size = MAX_TLS_SIZE, |
---|
120 | .initial_modes = RTEMS_DEFAULT_MODES, |
---|
121 | .attributes = TASK_ATTRIBUTES |
---|
122 | }; |
---|
123 | test-target: testsuites/validation/tc-task-ident.c |
---|
124 | test-teardown: |
---|
125 | brief: null |
---|
126 | code: | |
---|
127 | if ( ctx->id_local_object != 0 ) { |
---|
128 | rtems_status_code sc; |
---|
129 | |
---|
130 | sc = rtems_task_delete( ctx->id_local_object ); |
---|
131 | T_rsc_success( sc ); |
---|
132 | } |
---|
133 | description: null |
---|
134 | text: ${.:text-template} |
---|
135 | transition-map: |
---|
136 | - enabled-by: true |
---|
137 | post-conditions: |
---|
138 | Post: OkAndSelfId |
---|
139 | pre-conditions: |
---|
140 | Pre: |
---|
141 | - Self |
---|
142 | - enabled-by: true |
---|
143 | post-conditions: |
---|
144 | Post: Generic |
---|
145 | pre-conditions: |
---|
146 | Pre: |
---|
147 | - Generic |
---|
148 | type: requirement |
---|