summaryrefslogtreecommitdiffstats
path: root/spec/rtems/scheduler/req/remove-processor.yml
blob: f04e72be3e972a342c0e690fc4f5ff05db782d15 (plain) (blame)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
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
functional-type: action
links:
- role: interface-function
  uid: ../if/remove-processor
post-conditions:
- name: Status
  states:
  - name: Ok
    test-code: |
      T_rsc_success( ctx->status );
    text: |
      The return status of ${../if/remove-processor:/name} shall be
      ${../../status/if/successful:/name}.
  - name: InvId
    test-code: |
      T_rsc( ctx->status, RTEMS_INVALID_ID );
    text: |
      The return status of ${../if/remove-processor:/name} shall be
      ${../../status/if/invalid-id:/name}.
  - name: InvNum
    test-code: |
      T_rsc( ctx->status, RTEMS_INVALID_NUMBER );
    text: |
      The return status of ${../if/remove-processor:/name} shall be
      ${../../status/if/invalid-number:/name}.
  - name: InUse
    test-code: |
      T_rsc( ctx->status, RTEMS_RESOURCE_IN_USE );
    text: |
      The return status of ${../if/remove-processor:/name} shall be
      ${../../status/if/resource-in-use:/name}.
  test-epilogue: null
  test-prologue: null
- name: Removed
  states:
  - name: 'Yes'
    test-code: |
      T_eq_sz( ctx->scheduler_log.header.recorded, 1 );
      T_eq_int(
        ctx->scheduler_log.events[ 0 ].operation,
        T_SCHEDULER_REMOVE_PROCESSOR
      );
    text: |
      The processor specified by the ${../if/remove-processor:/params[1]/name}
      parameter shall be removed from the scheduler specified by the
      ${../if/remove-processor:/params[0]/name} by the
      ${../if/remove-processor:/name} call.
  - name: Nop
    test-code: |
      T_eq_sz( ctx->scheduler_log.header.recorded, 0 );
    text: |
      No processor shall be removed from a scheduler by the
      ${../if/remove-processor:/name} call.
  test-epilogue: null
  test-prologue: null
pre-conditions:
- name: CPUState
  states:
  - name: Idle
    test-code: |
      ctx->scheduler_id = ctx->scheduler_b_id;
      ctx->cpu_to_remove = 1;
    text: |
      While the processor associated with the
      ${../if/remove-processor:/params[1]/name} parameter is owned by the
      scheduler specified by the ${../if/remove-processor:/params[0]/name}
      parameter, while no task exists which uses the scheduler as its
      ${/glossary/scheduler-home:/term} and the affinity set of this task would
      require the processor specified by the
      ${../if/remove-processor:/params[1]/name} parameter.
  - name: InUse
    test-code: |
      /* Set by prologue */
    text: |
      While the processor associated with the
      ${../if/remove-processor:/params[1]/name} parameter is owned by the
      scheduler specified by the ${../if/remove-processor:/params[0]/name}
      parameter, while the scheduler is used by at least one task as its
      ${/glossary/scheduler-home:/term} and the affinity set of this task
      requires the processor specified by the
      ${../if/remove-processor:/params[1]/name} parameter.
  - name: NotOwned
    test-code: |
      ctx->scheduler_id = ctx->scheduler_a_id;
      ctx->cpu_to_remove = 1;
    text: |
      While the processor associated with the
      ${../if/remove-processor:/params[1]/name} parameter is not owned by the
      scheduler specified by the ${../if/remove-processor:/params[0]/name}
      parameter.
  test-epilogue: null
  test-prologue: |
    ctx->scheduler_id = ctx->scheduler_a_id;
    ctx->cpu_to_remove = 0;
- name: Id
  states:
  - name: Invalid
    test-code: |
      ctx->id = INVALID_ID;
    text: |
      While the ${../if/remove-processor:/params[0]/name} parameter is not
      associated with a scheduler.
  - name: Scheduler
    test-code: |
      ctx->id = ctx->scheduler_id;
    text: |
      While the ${../if/remove-processor:/params[0]/name} parameter is
      associated with a scheduler.
  test-epilogue: null
  test-prologue: null
- name: CPUIndex
  states:
  - name: Valid
    test-code: |
      ctx->cpu_index = ctx->cpu_to_remove;
    text: |
      While the ${../if/remove-processor:/params[1]/name} parameter is less than
      the configured processor maximum.
  - name: Invalid
    test-code: |
      ctx->cpu_index = rtems_configuration_get_maximum_processors();
    text: |
      While the ${../if/remove-processor:/params[1]/name} parameter is greater
      than or equal to the configured processor maximum.
  test-epilogue: null
  test-prologue: null
rationale: null
references: []
requirement-type: functional
skip-reasons:
  OnlyOneCPU: |
    Where the system is build with SMP support disabled, the system has exactly
    one processor and there is no processor available to remove from a
    scheduler.
test-action: |
  T_scheduler_log *log;

  log = T_scheduler_record_2( &ctx->scheduler_log );
  T_null( log );

  ctx->status = rtems_scheduler_remove_processor( ctx->id, ctx->cpu_index );

  log = T_scheduler_record( NULL );
  T_eq_ptr( &log->header, &ctx->scheduler_log.header );
test-brief: null
test-cleanup: |
  #if defined(RTEMS_SMP)
  if ( ctx->status == RTEMS_SUCCESSFUL ) {
    rtems_status_code sc;

    sc = rtems_scheduler_add_processor(
      ctx->scheduler_id,
      ctx->cpu_to_remove
    );
    T_rsc_success( sc );
  }
  #endif
test-context:
- brief: |
    This member specifies the scheduler used to add the processor.
  description: null
  member: |
    rtems_id scheduler_id
- brief: |
    This member contains the identifier of scheduler A.
  description: null
  member: |
    rtems_id scheduler_a_id
- brief: |
    This member contains the identifier of scheduler B.
  description: null
  member: |
    rtems_id scheduler_b_id
- brief: |
    This member specifies the processor to remove.
  description: null
  member: |
    uint32_t cpu_to_remove
- brief: |
    This member provides the scheduler operation records.
  description: null
  member: |
    T_scheduler_log_2 scheduler_log;
- brief: |
    This member contains the return value of the
    ${../if/remove-processor:/name} call.
  description: null
  member: |
    rtems_status_code status
- brief: |
    This member specifies if the ${../if/remove-processor:/params[0]/name}
    parameter value.
  description: null
  member: |
    rtems_id id
- brief: |
    This member specifies if the ${../if/remove-processor:/params[1]/name}
    parameter value.
  description: null
  member: |
    uint32_t cpu_index
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems.h
- rtems/test-scheduler.h
test-local-includes:
- ts-config.h
- tx-support.h
test-prepare: null
test-setup:
  brief: null
  code: |
    rtems_status_code sc;

    sc = rtems_scheduler_ident(
      TEST_SCHEDULER_A_NAME,
      &ctx->scheduler_a_id
    );
    T_rsc_success( sc );

    #if defined(RTEMS_SMP)
    sc = rtems_scheduler_ident( TEST_SCHEDULER_B_NAME, &ctx->scheduler_b_id );
    T_rsc_success( sc );
    #else
    ctx->scheduler_b_id = INVALID_ID;
    #endif
  description: null
test-stop: null
test-support: |
  #define INVALID_ID 0xffffffff
test-target: testsuites/validation/tc-scheduler-remove-processor.c
test-teardown: null
text: ${.:text-template}
transition-map:
- enabled-by: true
  post-conditions:
    Status: InvId
    Removed: Nop
  pre-conditions:
    CPUState: N/A
    Id:
    - Invalid
    CPUIndex: all
- enabled-by: true
  post-conditions:
    Status: InvNum
    Removed: Nop
  pre-conditions:
    CPUState: N/A
    Id:
    - Scheduler
    CPUIndex:
    - Invalid
- enabled-by: true
  post-conditions:
    Status: InUse
    Removed: Nop
  pre-conditions:
    CPUState:
    - InUse
    Id:
    - Scheduler
    CPUIndex:
    - Valid
- enabled-by: true
  post-conditions: OnlyOneCPU
  pre-conditions:
    CPUState:
    - Idle
    - NotOwned
    Id:
    - Scheduler
    CPUIndex:
    - Valid
- enabled-by: RTEMS_SMP
  post-conditions:
    Status: Ok
    Removed: 'Yes'
  pre-conditions:
    CPUState:
    - Idle
    Id:
    - Scheduler
    CPUIndex:
    - Valid
- enabled-by: RTEMS_SMP
  post-conditions:
    Status: InvNum
    Removed: Nop
  pre-conditions:
    CPUState:
    - NotOwned
    Id:
    - Scheduler
    CPUIndex:
    - Valid
type: requirement