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

Last change on this file since 2ec2fbb was 2ec2fbb, checked in by Sebastian Huber <sebastian.huber@…>, on 11/18/21 at 07:54:46

spec: Specify RTEMS_MINIMUM_PRIORITY

  • Property mode set to 100644
File size: 5.4 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    Assert that ${../if/minimum-priority:/name} is a constant expression which
130    evaluates to the expected value.
131  action-code: |
132    RTEMS_STATIC_ASSERT( RTEMS_MINIMUM_PRIORITY == 1, MINIMUM_PRIORITY );
133  checks: []
134  links:
135  - role: validation
136    uid: ../req/minimum-priority
137- action-brief: |
138    Validate ${../if/self-define:/name} using a sample directive call.
139  action-code: |
140    rtems_status_code sc;
141  checks:
142  - brief: |
143      Check that ${../if/is-suspended:/name} returns the expected status if
144      called with a task identifier parameter of ${../if/self-define:/name}.
145    code: |
146      sc = rtems_task_is_suspended( RTEMS_SELF );
147      T_step_rsc_success( ${step}, sc );
148    links:
149    - role: validation
150      uid: ../req/self-define
151  links: []
152test-brief: |
153  This test case collection provides validation test cases for requirements of
154  the ${../if/group:/name}.
155test-context: []
156test-context-support: null
157test-description: null
158test-header: null
159test-includes:
160- rtems.h
161- string.h
162- rtems/score/apimutex.h
163test-local-includes: []
164test-setup: null
165test-stop: null
166test-support: |
167  typedef struct {
168    bool     owner_before;
169    bool     owner_in_visitor;
170    bool     owner_after;
171    uint32_t counter_all;
172    uint32_t counter_self;
173    bool     done;
174  } TaskIterateContext;
175
176  static bool TaskVisitor( rtems_tcb *tcb, void *arg )
177  {
178    TaskIterateContext *ctx;
179
180    ctx = arg;
181    ++ctx->counter_all;
182
183    if ( rtems_task_self() == tcb->Object.id ) {
184      ++ctx->counter_self;
185    }
186
187    ctx->owner_in_visitor = _RTEMS_Allocator_is_owner();
188
189    return ctx->done;
190  }
191test-target: testsuites/validation/tc-task.c
192test-teardown: null
193type: test-case
Note: See TracBrowser for help on using the repository browser.