aboutsummaryrefslogtreecommitdiffstats
path: root/test/nasa_osal/configuration.xml
blob: 4f89b0e1bda19d9c650e158c80eb346167cc4c23 (plain)
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
<?xml version="1.0" encoding="UTF-8"?>
<SPC5-Config version="1.0.0">
  <application name="Test Suite" version="1.0.0" standalone="true" locked="false">
    <description>Test specification for the NASA OSAL ChibiOS extension.</description>
    <component id="org.chibios.spc5.components.platform.generic">
      <component id="org.chibios.spc5.components.chibios_unitary_tests_engine" />
    </component>
    <instances>
      <instance locked="false" id="org.chibios.spc5.components.platform.generic" />
      <instance locked="false" id="org.chibios.spc5.components.chibios_unitary_tests_engine">
        <description>
          <introduction>
            <value>This document has been automatically generated.</value>
          </introduction>
        </description>
        <global_data_and_code>
          <global_definitions>
            <value><![CDATA[#define TEST_SUITE_NAME                     "NASA OSAL over ChibiOS/RT Test Suite"

#define TASKS_BASE_PRIORITY                 200
#define TASKS_STACK_SIZE                    256

extern THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE);
extern THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE);
extern THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE);
extern THD_WORKING_AREA(wa_test4, TASKS_STACK_SIZE);]]></value>
          </global_definitions>
          <global_code>
            <value><![CDATA[THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE);
THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE);
THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE);
THD_WORKING_AREA(wa_test4, TASKS_STACK_SIZE);]]></value>
          </global_code>
        </global_data_and_code>
        <sequences>
          <sequence>
            <type index="0">
              <value>Internal Tests</value>
            </type>
            <brief>
              <value>Threads Functionality</value>
            </brief>
            <description>
              <value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to threading.</value>
            </description>
            <shared_code>
              <value><![CDATA[#include "osapi.h"

static void test_thread1(void) {

  test_emit_token('A');
}

static void test_thread2(void) {

  test_emit_token('B');
}

static void test_thread3(void) {

  test_emit_token('C');
}

static void test_thread4(void) {

  test_emit_token('D');
}]]></value>
            </shared_code>
            <cases>
              <case>
                <brief>
                  <value>OS_TaskCreate() errors</value>
                </brief>
                <description>
                  <value>Parameters checking in OS_TaskCreate() is tested.</value>
                </description>
                <condition>
                  <value />
                </condition>
                <various_code>
                  <setup_code>
                    <value />
                  </setup_code>
                  <teardown_code>
                    <value />
                  </teardown_code>
                  <local_variables>
                    <value />
                  </local_variables>
                </various_code>
                <steps>
                  <step>
                    <description>
                      <value>OS_TaskCreate() is invoked with task_id set to NULL, an error is expected.</value>
                    </description>
                    <tags>
                      <value />
                    </tags>
                    <code>
                      <value><![CDATA[int32 err;

err = OS_TaskCreate(NULL,                   /* Error.*/
                    "failing thread",
                    test_thread1,
                    (uint32 *)wa_test1,
                    sizeof wa_test1,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_INVALID_POINTER, "NULL not detected");
test_assert_sequence("", "task executed");]]></value>
                    </code>
                  </step>
                  <step>
                    <description>
                      <value>OS_TaskCreate() is invoked with task_name set to NULL, an error is expected.</value>
                    </description>
                    <tags>
                      <value />
                    </tags>
                    <code>
                      <value><![CDATA[int32 err;
uint32 tid;

err = OS_TaskCreate(&tid,
                    NULL,                   /* Error.*/
                    test_thread1,
                    (uint32 *)wa_test1,
                    sizeof wa_test1,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_INVALID_POINTER, "NULL not detected");
test_assert_sequence("", "task executed");]]></value>
                    </code>
                  </step>
                  <step>
                    <description>
                      <value>OS_TaskCreate() is invoked with stack_pointer set to NULL, an error is expected.</value>
                    </description>
                    <tags>
                      <value />
                    </tags>
                    <code>
                      <value><![CDATA[int32 err;
uint32 tid;

err = OS_TaskCreate(&tid,
                    "failing thread",
                    test_thread1,
                    (uint32 *)NULL,         /* Error.*/
                    sizeof wa_test1,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_INVALID_POINTER, "NULL not detected");
test_assert_sequence("", "task executed");]]></value>
                    </code>
                  </step>
                  <step>
                    <description>
                      <value>OS_TaskCreate() is invoked with a very long task name, an error is expected.</value>
                    </description>
                    <tags>
                      <value />
                    </tags>
                    <code>
                      <value><![CDATA[int32 err;
uint32 tid;

err = OS_TaskCreate(&tid,
                    "this is a very very long task name", /* Error.*/
                    test_thread1,
                    (uint32 *)wa_test1,
                    sizeof wa_test1,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");
test_assert_sequence("", "task executed");]]></value>
                    </code>
                  </step>
                  <step>
                    <description>
                      <value>OS_TaskCreate() is invoked with priority below and above allowed range, an error is expected.</value>
                    </description>
                    <tags>
                      <value />
                    </tags>
                    <code>
                      <value><![CDATA[int32 err;
uint32 tid;

err = OS_TaskCreate(&tid,
                    "failing thread",
                    test_thread1,
                    (uint32 *)wa_test1,
                    sizeof wa_test1,
                    0,                      /* Error.*/
                    0);
test_assert(err == OS_ERR_INVALID_PRIORITY, "priority error not detected");
test_assert_sequence("", "task executed");

err = OS_TaskCreate(&tid,
                   "failing thread",
                   test_thread1,
                   (uint32 *)wa_test1,
                   sizeof wa_test1,
                   256,                     /* Error.*/
                   0);
test_assert(err == OS_ERR_INVALID_PRIORITY, "priority error not detected");
test_assert_sequence("", "task executed");]]></value>
                    </code>
                  </step>
                  <step>
                    <description>
                      <value>OS_TaskCreate() is invoked with a stack size below minimum, an error is expected.</value>
                    </description>
                    <tags>
                      <value />
                    </tags>
                    <code>
                      <value><![CDATA[int32 err;
uint32 tid;

err = OS_TaskCreate(&tid,
                    "failing thread",
                    test_thread1,
                    (uint32 *)wa_test1,
                    16,                     /* Error.*/
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_INVALID_INT_NUM, "stack insufficient size not detected");
test_assert_sequence("", "task executed");]]></value>
                    </code>
                  </step>
                  <step>
                    <description>
                      <value>OS_TaskCreate() is invoked twice with duplicated name and then duplicated stack, an error is expected in both cases.</value>
                    </description>
                    <tags>
                      <value />
                    </tags>
                    <code>
                      <value><![CDATA[int32 err;
uint32 tid;

err = OS_TaskCreate(&tid,
                    "running thread",
                    test_thread1,
                    (uint32 *)wa_test1,
                    sizeof wa_test1,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_SUCCESS, "task creation failed");

err = OS_TaskCreate(&tid,
                    "running thread",
                    test_thread2,
                    (uint32 *)wa_test2,
                    sizeof wa_test2,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");

err = OS_TaskCreate(&tid,
                    "another running thread",
                    test_thread1,
                    (uint32 *)wa_test1,
                    sizeof wa_test1,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_ERR_NO_FREE_IDS, "stack conflict not detected");

OS_TaskDelay(5);
test_assert_sequence("A", "task not executed");

err = OS_TaskCreate(&tid,
                    "running thread",
                    test_thread1,
                    (uint32 *)wa_test1,
                    sizeof wa_test1,
                    TASKS_BASE_PRIORITY,
                    0);
test_assert(err == OS_SUCCESS, "task creation failed");

OS_TaskDelay(5);
test_assert_sequence("A", "task not executed");]]></value>
                    </code>
                  </step>
                </steps>
              </case>
            </cases>
          </sequence>
        </sequences>
      </instance>
    </instances>
    <exportedFeatures />
  </application>
</SPC5-Config>