summaryrefslogtreecommitdiffstats
path: root/spec/rtems/scheduler/val/smp-only.yml
blob: 36d8ee9e61ac289954e97a9aaf01cc483c2e9623 (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
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2021 embedded brains GmbH & Co. KG
enabled-by: RTEMS_SMP
links: []
test-actions:
- action-brief: |
    Call ${../if/get-processor:/name} on all online processors and check the
    returned value.
  action-code: |
    rtems_id            scheduler_id;
    rtems_task_priority priority;
    uint32_t            cpu_index;
    uint32_t            cpu_max;

    scheduler_id = GetSelfScheduler();
    priority = GetSelfPriority();
    cpu_max = rtems_scheduler_get_processor_maximum();
    T_step_ge_u32( ${.:/step}, cpu_max, 1 );

    for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) {
      rtems_status_code sc;
      rtems_id          id;

      sc = rtems_scheduler_ident_by_processor( cpu_index, &id );
      T_quiet_rsc_success( sc );

      SetSelfScheduler( id, priority );
      SetSelfAffinityOne( cpu_index );

      T_quiet_eq_u32( rtems_scheduler_get_processor(), cpu_index );

      SetSelfAffinityAll();
    }

    SetSelfScheduler( scheduler_id, priority );
  checks: []
  links:
  - role: validation
    uid: ../req/get-processor-smp-only
- action-brief: |
    Call ${../if/get-processor-maximum:/name} and check the returned value.
  action-code: |
    uint32_t cpu_max;

    cpu_max = rtems_scheduler_get_processor_maximum();
  checks:
  - brief: |
      Check that the returned value is greater than or equal to one.
    code: |
      T_step_ge_u32( ${.:/step}, cpu_max, 1 );
    links: []
  - brief: |
      Check that the returned value is less than or equal to
      ${../../config/if/get-maximum-processors:/name}.
    code: |
      T_step_le_u32(
        ${.:/step},
        cpu_max,
        rtems_configuration_get_maximum_processors()
      );
    links: []
  links:
  - role: validation
    uid: ../req/get-processor-maximum-smp-only
- action-brief: |
    Call ${../if/ident:/name} for each configured scheduler.
  action-code: |
    rtems_status_code   sc;
    rtems_id            id[ 4 ];
    rtems_id            id_by_cpu;
    rtems_task_priority priority;

    sc = rtems_scheduler_ident( TEST_SCHEDULER_A_NAME, &id[ 0 ]);
    T_step_rsc_success( ${.:/step}, sc );

    sc = rtems_scheduler_ident( TEST_SCHEDULER_B_NAME, &id[ 1 ]);
    T_step_rsc_success( ${.:/step}, sc );

    sc = rtems_scheduler_ident( TEST_SCHEDULER_C_NAME, &id[ 2 ]);
    T_step_rsc_success( ${.:/step}, sc );

    sc = rtems_scheduler_ident( TEST_SCHEDULER_D_NAME, &id[ 3 ]);
    T_step_rsc_success( ${.:/step}, sc );
  checks:
  - brief: |
      Check that the object index of scheduler A has the expected value.
    code: |
      T_step_eq_u16( ${.:/step}, rtems_object_id_get_index( id[ 0 ] ), 1 );
    links: []
  - brief: |
      Check that the object index of scheduler B has the expected value.
    code: |
      T_step_eq_u16( ${.:/step}, rtems_object_id_get_index( id[ 1 ] ), 2 );
    links: []
  - brief: |
      Check that the object index of scheduler C has the expected value.
    code: |
      T_step_eq_u16( ${.:/step}, rtems_object_id_get_index( id[ 2 ] ), 3 );
    links: []
  - brief: |
      Check that the object index of scheduler D has the expected value.
    code: |
      T_step_eq_u16( ${.:/step}, rtems_object_id_get_index( id[ 3 ] ), 4 );
    links: []
  - brief: |
      Check that processor 0 has scheduler A assigned.
    code: |
      sc = rtems_scheduler_ident_by_processor( 0, &id_by_cpu );
      T_step_rsc_success( ${.:/step}, sc );
      T_step_eq_u32( ${.:/step}, id[ 0 ], id_by_cpu );
    links:
    - role: validation
      uid: /acfg/req/scheduler-assign-scheduler
  - brief: |
      Check that processor 1 has scheduler B assigned.
    code: |
      sc = rtems_scheduler_ident_by_processor( 1, &id_by_cpu );
      T_step_rsc_success( ${.:/step}, sc );
      T_step_eq_u32( ${.:/step}, id[ 1 ], id_by_cpu );
    links:
    - role: validation
      uid: /acfg/req/scheduler-assign-scheduler
  - brief: |
      Check that scheduler B has the maximum priority of the EDF SMP scheduler.
    code: |
      sc = rtems_scheduler_get_maximum_priority( id_by_cpu, &priority );
      T_step_rsc_success( ${.:/step}, sc );
      T_step_eq_u32( ${.:/step}, priority, (uint32_t) INT_MAX );
    links:
    - role: validation
      uid: /acfg/req/scheduler-control-edf-smp
  - brief: |
      Check that processor 2 has scheduler C assigned if it is present.
    code: |
      sc = rtems_scheduler_ident_by_processor( 2, &id_by_cpu );
      T_step_true( ${.:/step}, sc == RTEMS_INVALID_NAME || id[ 2 ] == id_by_cpu );
    links:
    - role: validation
      uid: /acfg/req/scheduler-assign-scheduler
  - brief: |
      Check that processor 3 has scheduler C assigned if it is present.
    code: |
      sc = rtems_scheduler_ident_by_processor( 3, &id_by_cpu );
      T_step_true( ${.:/step}, sc == RTEMS_INVALID_NAME || id[ 2 ] == id_by_cpu );
    links:
    - role: validation
      uid: /acfg/req/scheduler-assign-scheduler
  links:
  - role: validation
    uid: /acfg/req/scheduler-table-entries
test-brief: |
  This test case collection provides validation test cases for SMP-only
  requirements of the ${../if/group:/name}.
test-context: []
test-context-support: null
test-description: null
test-header: null
test-includes:
- limits.h
- rtems.h
test-local-includes:
- ts-config.h
- tx-support.h
test-setup: null
test-stop: null
test-support: null
test-target: testsuites/validation/tc-scheduler-smp-only.c
test-teardown: null
type: test-case