source: rtems-central/spec/rtems/task/val/task.yml @ bd9519d

Last change on this file since bd9519d was bd9519d, checked in by Sebastian Huber <sebastian.huber@…>, on 11/18/21 at 07:50:19

spec: Specify RTEMS_MINIMUM_STACK_SIZE

  • Property mode set to 100644
File size: 5.1 KB
Line 
1SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
2copyrights:
3- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
4enabled-by: true
5links: []
6test-actions:
7- action-brief: |
8    Call ${../if/self:/name} check the returned value.
9  action-code: |
10    rtems_id id;
11
12    id = rtems_task_self();
13  checks:
14  - brief: |
15      Check that the returned value is equal to the object identifier of the
16      calling task.
17    code: |
18      T_step_eq_u32( ${step}, id, 0x0a010001 );
19    links: []
20  links:
21  - role: validation
22    uid: ../req/self
23- action-brief: |
24    Call ${../if/iterate:/name} with a visitor which always returns
25    ${/c/if/false:/name}.
26  action-code: |
27    TaskIterateContext ctx;
28    uint32_t           task_count;
29
30    task_count = rtems_scheduler_get_processor_maximum();
31
32    if ( task_count > 4 ) {
33      task_count = 4;
34    }
35
36    ++task_count;
37
38    memset( &ctx, 0, sizeof( ctx ) );
39    ctx.owner_before = _RTEMS_Allocator_is_owner();
40    rtems_task_iterate( TaskVisitor, &ctx );
41    ctx.owner_after = _RTEMS_Allocator_is_owner();
42  checks:
43  - brief: |
44      Check that the all counter is equal to the count of tasks.  Check that
45      the calling task was visited exacly once.  Firstly, this shows that
46      ${../if/iterate:/name} used the parameters specified by
47      ${../if/iterate:/params[0]/name} and ${../if/iterate:/params[1]/name}.
48      Secondly, this shows that the iteration was done over all tasks.
49    code: |
50      T_step_eq_u32( ${step}, ctx.counter_all, task_count );
51      T_step_eq_u32( ${step}, ctx.counter_self, 1 );
52    links:
53    - role: validation
54      uid: ../req/iterate-visit
55    - role: validation
56      uid: ../req/iterate-done
57  - brief: |
58      Check that the object alloctor mutex was not owned before and after the
59      call.  Check that the object alloctor mutex was owned during the
60      iteration.
61    code: |
62      T_step_false( ${step}, ctx.owner_before );
63      T_step_true( ${step}, ctx.owner_in_visitor );
64      T_step_false( ${step}, ctx.owner_after );
65    links:
66    - role: validation
67      uid: ../req/iterate-start
68    - role: validation
69      uid: ../req/iterate-done
70  links:
71  - role: validation
72    uid: ../req/iterate-start
73- action-brief: |
74    Call ${../if/iterate:/name} with a visitor which returns
75    ${/c/if/true:/name}.
76  action-code: |
77    TaskIterateContext ctx;
78
79    memset( &ctx, 0, sizeof( ctx ) );
80    ctx.done = true;
81    rtems_task_iterate( TaskVisitor, &ctx );
82  checks:
83  - brief: |
84      Check that the all counter is equal to one.  This shows that the
85      iteration stops when the visitor returns ${/c/if/true:/name}.
86    code: |
87      T_step_eq_u32( ${step}, ctx.counter_all, 1 );
88    links:
89    - role: validation
90      uid: ../req/iterate-stop
91  links: []
92- action-brief: |
93    Assert that ${../if/storage-alignment:/name} is a constant expression which
94    evaluates to the expected value.
95  action-code: |
96    RTEMS_STATIC_ASSERT(
97      RTEMS_TASK_STORAGE_ALIGNMENT == CPU_STACK_ALIGNMENT,
98      STORAGE_ALIGNMENT
99    );
100  checks: []
101  links:
102  - role: validation
103    uid: ../req/storage-alignment
104- action-brief: |
105    Assert that ${../if/no-priority:/name} is a constant expression which
106    evaluates to the expected value.
107  action-code: |
108    RTEMS_STATIC_ASSERT(
109      RTEMS_NO_PRIORITY == RTEMS_CURRENT_PRIORITY,
110      NO_PRIORITY
111    );
112  checks: []
113  links:
114  - role: validation
115    uid: ../req/no-priority
116- action-brief: |
117    Assert that ${../if/minimum-stack-size:/name} is a constant expression which
118    evaluates to the expected value.
119  action-code: |
120    RTEMS_STATIC_ASSERT(
121      RTEMS_MINIMUM_STACK_SIZE == STACK_MINIMUM_SIZE,
122      MINIMUM_STACK_SIZE
123    );
124  checks: []
125  links:
126  - role: validation
127    uid: ../req/minimum-stack-size
128- action-brief: |
129    Validate ${../if/self-define:/name} using a sample directive call.
130  action-code: |
131    rtems_status_code sc;
132  checks:
133  - brief: |
134      Check that ${../if/is-suspended:/name} returns the expected status if
135      called with a task identifier parameter of ${../if/self-define:/name}.
136    code: |
137      sc = rtems_task_is_suspended( RTEMS_SELF );
138      T_step_rsc_success( ${step}, sc );
139    links:
140    - role: validation
141      uid: ../req/self-define
142  links: []
143test-brief: |
144  This test case collection provides validation test cases for requirements of
145  the ${../if/group:/name}.
146test-context: []
147test-context-support: null
148test-description: null
149test-header: null
150test-includes:
151- rtems.h
152- string.h
153- rtems/score/apimutex.h
154test-local-includes: []
155test-setup: null
156test-stop: null
157test-support: |
158  typedef struct {
159    bool     owner_before;
160    bool     owner_in_visitor;
161    bool     owner_after;
162    uint32_t counter_all;
163    uint32_t counter_self;
164    bool     done;
165  } TaskIterateContext;
166
167  static bool TaskVisitor( rtems_tcb *tcb, void *arg )
168  {
169    TaskIterateContext *ctx;
170
171    ctx = arg;
172    ++ctx->counter_all;
173
174    if ( rtems_task_self() == tcb->Object.id ) {
175      ++ctx->counter_self;
176    }
177
178    ctx->owner_in_visitor = _RTEMS_Allocator_is_owner();
179
180    return ctx->done;
181  }
182test-target: testsuites/validation/tc-task.c
183test-teardown: null
184type: test-case
Note: See TracBrowser for help on using the repository browser.