source: rtems-central/spec/rtems/timer/req/initiate-server.yml

Last change on this file was 940b7ea6, checked in by Sebastian Huber <sebastian.huber@…>, on 05/19/23 at 05:26:09

Update company name

The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.

  • Property mode set to 100644
File size: 10.4 KB
Line 
1SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
2copyrights:
3- Copyright (C) 2021 embedded brains GmbH & Co. KG
4enabled-by: true
5functional-type: action
6links:
7- role: interface-function
8  uid: ../if/initiate-server
9- role: interface-function
10  uid: ../if/server-default-priority
11post-conditions:
12- name: Status
13  states:
14  - name: Ok
15    test-code: |
16      T_rsc_success( ctx->status );
17    text: |
18      The return status of ${../if/initiate-server:/name} shall be
19      ${../../status/if/successful:/name}.
20  - name: IncStat
21    test-code: |
22      T_rsc( ctx->status, RTEMS_INCORRECT_STATE );
23    text: |
24      The return status of ${../if/initiate-server:/name} shall be
25      ${../../status/if/incorrect-state:/name}
26  - name: InvPrio
27    test-code: |
28      T_rsc( ctx->status, RTEMS_INVALID_PRIORITY );
29    text: |
30      The return status of ${../if/initiate-server:/name} shall be
31      ${../../status/if/invalid-priority:/name}.
32  - name: TooMany
33    test-code: |
34      T_rsc( ctx->status, RTEMS_TOO_MANY );
35    text: |
36      The return status of ${../if/initiate-server:/name} shall be
37      ${../../status/if/too-many:/name}.
38  - name: Unsat
39    test-code: |
40      T_rsc( ctx->status, RTEMS_UNSATISFIED  );
41    text: |
42      The return status of ${../if/initiate-server:/name} shall be
43      ${../../status/if/unsatisfied:/name}.
44  test-epilogue: null
45  test-prologue: null
46- name: Started
47  states:
48  - name: 'Yes'
49    test-code: |
50      T_true( ExistTimerServer() );
51    text: |
52      The Timer Server task shall be started after the
53      ${../if/initiate-server:/name} call.
54  - name: 'No'
55    test-code: |
56      T_false( ExistTimerServer() );
57    text: |
58      The Timer Server task shall not be started after the
59      ${../if/initiate-server:/name} call.
60  test-epilogue: null
61  test-prologue: null
62- name: TaskPrio
63  states:
64  - name: Set
65    test-code: |
66      if ( ctx->priority == RTEMS_TIMER_SERVER_DEFAULT_PRIORITY ) {
67        T_eq_u32( GetTimerServerPriority(), 0 );
68      } else {
69        T_eq_u32( GetTimerServerPriority(), ctx->priority );
70      }
71    text: |
72      The priority of the Timer Server task shall be equal to the priority
73      specified by the ${../if/initiate-server:/params[0]/name} parameter in
74      the ${../if/initiate-server:/name} call.
75  - name: Nop
76    test-code: |
77      T_eq_u32( GetTimerServerPriority(), ctx->before_priority );
78    text: |
79      The priority of the Timer Server task shall not be modified
80      by the ${../if/initiate-server:/name} call.
81  test-epilogue: null
82  test-prologue: null
83- name: TaskStack
84  states:
85  - name: Set
86    test-code: |
87      T_ge_sz( GetTimerServerStackSize(), ctx->stack_size );
88    text: |
89      The stack size of the Timer Server task shall be greater than or equal to
90      the stack size specified by the ${../if/initiate-server:/params[1]/name}
91      parameter in the ${../if/initiate-server:/name} call.
92  - name: Nop
93    test-code: |
94      T_ge_sz( GetTimerServerStackSize(), ctx->before_stack_size );
95    text: |
96      The stack size of the Timer Server task shall not be modified
97      by the ${../if/initiate-server:/name} call.
98  test-epilogue: null
99  test-prologue: null
100- name: TaskAttr
101  states:
102  - name: Set
103    test-code: |
104      T_true( HasTimerServerFloatingPoint() );
105    text: |
106      The task attributes of the Timer Server task shall be specified by the
107      ${../if/initiate-server:/params[2]/name} parameter in the
108      ${../if/initiate-server:/name} call.
109  - name: Nop
110    test-code: |
111      T_true( HasTimerServerFloatingPoint() == ctx->before_has_floating_point );
112    text: |
113      The task attributes of the Timer Server task shall not be modified by the
114      ${../if/initiate-server:/name} call.
115  test-epilogue: null
116  test-prologue: null
117pre-conditions:
118- name: Priority
119  states:
120  - name: Valid
121    test-code: |
122      ctx->priority = 13;
123    text: |
124      While the ${../if/initiate-server:/params[0]/name} parameter is valid.
125  - name: Default
126    test-code: |
127      ctx->priority = RTEMS_TIMER_SERVER_DEFAULT_PRIORITY;
128    text: |
129      While the ${../if/initiate-server:/params[0]/name} parameter is equal to
130      ${../if/server-default-priority:/name}.
131  - name: Invalid
132    test-code: |
133      ctx->priority = PRIO_INVALID;
134    text: |
135      While the ${../if/initiate-server:/params[0]/name} parameter is invalid.
136  test-epilogue: null
137  test-prologue: null
138- name: Stack
139  states:
140  - name: Allocatable
141    test-code: |
142      ctx->stack_size = RTEMS_MINIMUM_STACK_SIZE;
143    text: |
144      While the ${../if/initiate-server:/params[1]/name} parameter specifies a
145      task stack size which is allocatable by the system.
146  - name: TooLarge
147    test-code: |
148      ctx->stack_size = SIZE_MAX;
149    text: |
150      While the ${../if/initiate-server:/params[1]/name} parameter specifies a
151      task stack size which is not allocatable by the system.
152  test-epilogue: null
153  test-prologue: null
154- name: Started
155  states:
156  - name: 'Yes'
157    test-code: |
158      rtems_status_code status;
159
160      if ( !ExistTimerServer() ) {
161        status = rtems_timer_initiate_server(
162          RTEMS_TIMER_SERVER_DEFAULT_PRIORITY,
163          RTEMS_MINIMUM_STACK_SIZE,
164          RTEMS_DEFAULT_ATTRIBUTES
165        );
166        T_rsc_success( status );
167      }
168    text: |
169      While the Timer Server task is started.
170  - name: 'No'
171    test-code: |
172      DeleteTimerServer();
173    text: |
174      While the Timer Server task is not started.
175  test-epilogue: null
176  test-prologue: null
177- name: TaskObj
178  states:
179  - name: Available
180    test-code: |
181      /* The test clean up ensures that all tasks objects are free. */
182    text: |
183      While the system has at least one inactive task object available.
184  - name: Unavailable
185    test-code: |
186      ctx->task_objects = T_seize_objects(
187        AllocateTaskObject,
188        NULL
189      );
190    text: |
191      While the system has no inactive task object available.
192  test-epilogue: null
193  test-prologue: null
194rationale: null
195references: []
196requirement-type: functional
197skip-reasons: {}
198test-action: |
199  if ( ExistTimerServer() ) {
200    ctx->before_priority = GetTimerServerPriority();
201    ctx->before_stack_size = GetTimerServerStackSize();
202    ctx->before_has_floating_point = HasTimerServerFloatingPoint();
203  }
204
205  ctx->status = rtems_timer_initiate_server(
206    ctx->priority,
207    ctx->stack_size,
208    RTEMS_FLOATING_POINT
209  );
210test-brief: null
211test-cleanup: |
212  T_surrender_objects( &ctx->task_objects, rtems_task_delete );
213test-context:
214- brief: |
215    If the Timer Server task exists before the action,
216    its priority before the action.
217  description: null
218  member: |
219    rtems_task_priority before_priority
220- brief: |
221    If the Timer Server task exists before the action,
222    its stack size before the action.
223  description: null
224  member: |
225    size_t before_stack_size
226- brief: |
227    If the Timer Server task exists before the action,
228    whether the floating point attribute is set before the action.
229  description: null
230  member: |
231    bool before_has_floating_point
232- brief: |
233    The ${../if/initiate-server:/params[0]/name}
234    parameter for the action.
235  description: null
236  member: |
237    rtems_task_priority priority
238- brief: |
239    The ${../if/initiate-server:/params[1]/name}
240    parameter for the action.
241  description: null
242  member: |
243    size_t stack_size
244- brief: |
245    The status value returned by the action ${../if/initiate-server:/name}.
246  description: null
247  member: |
248    rtems_status_code status
249- brief: |
250    This member is used by the T_seize_objects() and T_surrender_objects()
251    support functions.
252  description: null
253  member: |
254    void *task_objects
255test-context-support: null
256test-description: null
257test-header: null
258test-includes:
259- rtems.h
260- rtems/rtems/timerimpl.h
261test-local-includes:
262- tx-support.h
263test-prepare: null
264test-setup:
265  brief: null
266  code: |
267    ctx->task_objects = NULL;
268  description: null
269test-stop: null
270test-support: |
271  static bool ExistTimerServer( void )
272  {
273    return GetTimerServerTaskId() != RTEMS_INVALID_ID;
274  }
275
276  static rtems_task_priority GetTimerServerPriority( void )
277  {
278    return GetPriority( GetTimerServerTaskId() );
279  }
280
281  static size_t GetTimerServerStackSize( void )
282  {
283    rtems_tcb *tcb;
284    rtems_id server_task_id;
285    server_task_id = GetTimerServerTaskId();
286    T_ne_u32( server_task_id, RTEMS_INVALID_ID );
287    tcb = GetThread( server_task_id );
288    T_not_null( tcb );
289    return tcb->Start.Initial_stack.size;
290  }
291
292  static bool HasTimerServerFloatingPoint( void )
293  {
294    rtems_tcb *tcb;
295    rtems_id server_task_id;
296    server_task_id = GetTimerServerTaskId();
297    T_ne_u32( server_task_id, RTEMS_INVALID_ID );
298    tcb = GetThread( server_task_id );
299    T_not_null( tcb );
300    return tcb->is_fp;
301  }
302
303  static rtems_status_code AllocateTaskObject( void *arg, rtems_id *task_id )
304  {
305    (void) arg;
306
307    return rtems_task_create(
308      rtems_build_name( 'T', 'A', ' ', 'N' ),
309      PRIO_LOW,
310      RTEMS_MINIMUM_STACK_SIZE,
311      RTEMS_DEFAULT_MODES,
312      RTEMS_DEFAULT_ATTRIBUTES,
313      task_id
314    );
315  }
316
317test-target: testsuites/validation/tc-timer-initiate-server.c
318test-teardown:
319  brief: Make sure the time server in not running after this test.
320  code: |
321    DeleteTimerServer();
322  description: null
323text: ${.:text-template}
324transition-map:
325- enabled-by: true
326  post-conditions:
327    Status: Ok
328    Started: 'Yes'
329    TaskPrio: Set
330    TaskStack: Set
331    TaskAttr: Set
332  pre-conditions:
333    Priority:
334      - Valid
335      - Default
336    Stack:
337      - Allocatable
338    Started:
339      - 'No'
340    TaskObj:
341      - Available
342- enabled-by: true
343  post-conditions:
344    Status: IncStat
345    Started: 'Yes'
346    TaskPrio: Nop
347    TaskStack: Nop
348    TaskAttr: Nop
349  pre-conditions:
350    Priority: all
351    Stack: all
352    Started:
353      - 'Yes'
354    TaskObj: all
355- enabled-by: true
356  post-conditions:
357    Status: InvPrio
358    Started: 'No'
359    TaskPrio: "N/A"
360    TaskStack: "N/A"
361    TaskAttr: "N/A"
362  pre-conditions:
363    Priority:
364      - Invalid
365    Stack: all
366    Started:
367      - 'No'
368    TaskObj: all
369- enabled-by: true
370  post-conditions:
371    Status: TooMany
372    Started: 'No'
373    TaskPrio: "N/A"
374    TaskStack: "N/A"
375    TaskAttr: "N/A"
376  pre-conditions:
377    Priority:
378      - Valid
379      - Default
380    Stack: all
381    Started:
382      - 'No'
383    TaskObj:
384      - Unavailable
385- enabled-by: true
386  post-conditions:
387    Status: Unsat
388    Started: 'No'
389    TaskPrio: "N/A"
390    TaskStack: "N/A"
391    TaskAttr: "N/A"
392  pre-conditions:
393    Priority:
394      - Valid
395      - Default
396    Stack:
397      - TooLarge
398    Started:
399      - 'No'
400    TaskObj:
401      - Available
402type: requirement
Note: See TracBrowser for help on using the repository browser.