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