1 /**
2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 #include "ohos_types.h"
18 #include <securec.h>
19 #include "hctest.h"
20 #include "los_config.h"
21 #include "cmsis_os2.h"
22 #include "kernel_test.h"
23
24 osThreadId_t g_priTaskID01;
25 osPriority_t g_setPriority;
26
27 /**
28 * @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency
29 * @param : subsystem name is utils
30 * @param : module name is utilsFile
31 * @param : test suit name is CmsisTaskPriFuncTestSuite
32 */
33 LITE_TEST_SUIT(Cmsis, Cmsistask, CmsisTaskPriFuncTestSuite);
34
35 /**
36 * @tc.setup : setup for all testcases
37 * @return : setup result, TRUE is success, FALSE is fail
38 */
CmsisTaskPriFuncTestSuiteSetUp(void)39 static BOOL CmsisTaskPriFuncTestSuiteSetUp(void)
40 {
41 return TRUE;
42 }
43
44 /**
45 * @tc.teardown : teardown for all testcases
46 * @return : teardown result, TRUE is success, FALSE is fail
47 */
CmsisTaskPriFuncTestSuiteTearDown(void)48 static BOOL CmsisTaskPriFuncTestSuiteTearDown(void)
49 {
50 printf("+-------------------------------------------+\n");
51 return TRUE;
52 }
53
CmsisThreadGetPriorityFunc001(void const * argument)54 static void CmsisThreadGetPriorityFunc001(void const *argument)
55 {
56 (void)argument;
57 osThreadAttr_t attr;
58 g_priTaskID01 = osThreadGetId();
59 attr.priority = osThreadGetPriority(g_priTaskID01);
60 TEST_ASSERT_EQUAL_INT(g_setPriority, attr.priority);
61 osThreadExit();
62 }
63
CmsisThreadSetPriorityFunc001(void const * argument)64 static void CmsisThreadSetPriorityFunc001(void const *argument)
65 {
66 (void)argument;
67 osThreadAttr_t attr;
68 UINT32 uwRet;
69 g_priTaskID01 = osThreadGetId();
70 uwRet = osThreadSetPriority(g_priTaskID01, g_setPriority);
71 TEST_ASSERT_EQUAL_INT(osOK, uwRet);
72 attr.priority = osThreadGetPriority(g_priTaskID01);
73 TEST_ASSERT_EQUAL_INT(g_setPriority, attr.priority);
74 osThreadExit();
75 }
76
CmsisThreadSetPriorityFunc002(void const * argument)77 static void CmsisThreadSetPriorityFunc002(void const *argument)
78 {
79 (void)argument;
80 UINT32 uwRet;
81 g_priTaskID01 = osThreadGetId();
82 uwRet = osThreadSetPriority(g_priTaskID01, g_setPriority);
83 TEST_ASSERT_EQUAL_INT(osErrorParameter, uwRet);
84 osThreadExit();
85 }
86
87 /**
88 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5120
89 * @tc.name : thread operation for get priority when Priority = osPriorityLow1
90 * @tc.desc : [C- SOFTWARE -0200]
91 */
92 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority001, Function | MediumTest | Level1)
93 {
94 osThreadId_t id;
95 osThreadAttr_t attr;
96 g_setPriority = osPriorityLow1;
97 attr.name = "test";
98 attr.attr_bits = 0U;
99 attr.cb_mem = NULL;
100 attr.cb_size = 0U;
101 attr.stack_mem = NULL;
102 attr.stack_size = TEST_TASK_STACK_SIZE;
103 attr.priority = g_setPriority;
104 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
105 osDelay(DELAY_TICKS_5);
106 TEST_ASSERT_NOT_NULL(id);
107 };
108
109 /**
110 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5160
111 * @tc.name : thread operation for get priority input exception
112 * @tc.desc : [C- SOFTWARE -0200]
113 */
114 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority002, Function | MediumTest | Level1)
115 {
116 UINT32 uwRet;
117 uwRet = osThreadGetPriority(NULL);
118 TEST_ASSERT_EQUAL_INT(osPriorityError, uwRet);
119 };
120
121 /**
122 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5200
123 * @tc.name : thread operation for get current priority
124 * @tc.desc : [C- SOFTWARE -0200]
125 */
126 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority003, Function | MediumTest | Level1)
127 {
128 UINT32 uwRet;
129 g_priTaskID01 = osThreadGetId();
130 uwRet = osThreadGetPriority(g_priTaskID01);
131 TEST_ASSERT_EQUAL_INT(osPriorityNormal, uwRet);
132 };
133
134 /**
135 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5240
136 * @tc.name : thread operation for get priority when Priority = osPriorityLow7
137 * @tc.desc : [C- SOFTWARE -0200]
138 */
139 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority004, Function | MediumTest | Level1)
140 {
141 osThreadId_t id;
142 osThreadAttr_t attr;
143 g_setPriority = osPriorityLow7;
144 attr.name = "test";
145 attr.attr_bits = 0U;
146 attr.cb_mem = NULL;
147 attr.cb_size = 0U;
148 attr.stack_mem = NULL;
149 attr.stack_size = TEST_TASK_STACK_SIZE;
150 attr.priority = g_setPriority;
151 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
152 osDelay(DELAY_TICKS_5);
153 TEST_ASSERT_NOT_NULL(id);
154 };
155
156 /**
157 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5280
158 * @tc.name : thread operation for get priority when Priority = osPriorityBelowNormal
159 * @tc.desc : [C- SOFTWARE -0200]
160 */
161 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority005, Function | MediumTest | Level1)
162 {
163 osThreadId_t id;
164 osThreadAttr_t attr;
165 g_setPriority = osPriorityBelowNormal;
166 attr.name = "test";
167 attr.attr_bits = 0U;
168 attr.cb_mem = NULL;
169 attr.cb_size = 0U;
170 attr.stack_mem = NULL;
171 attr.stack_size = TEST_TASK_STACK_SIZE;
172 attr.priority = g_setPriority;
173 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
174 osDelay(DELAY_TICKS_5);
175 TEST_ASSERT_NOT_NULL(id);
176 };
177
178 /**
179 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5320
180 * @tc.name : thread operation for get priority when Priority = osPriorityBelowNormal7
181 * @tc.desc : [C- SOFTWARE -0200]
182 */
183 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority006, Function | MediumTest | Level1)
184 {
185 osThreadId_t id;
186 osThreadAttr_t attr;
187 g_setPriority = osPriorityBelowNormal7;
188 attr.name = "test";
189 attr.attr_bits = 0U;
190 attr.cb_mem = NULL;
191 attr.cb_size = 0U;
192 attr.stack_mem = NULL;
193 attr.stack_size = TEST_TASK_STACK_SIZE;
194 attr.priority = g_setPriority;
195 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
196 osDelay(DELAY_TICKS_5);
197 TEST_ASSERT_NOT_NULL(id);
198 };
199
200 /**
201 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5360
202 * @tc.name : thread operation for get priority when Priority = osPriorityNormal
203 * @tc.desc : [C- SOFTWARE -0200]
204 */
205 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority007, Function | MediumTest | Level1)
206 {
207 osThreadId_t id;
208 osThreadAttr_t attr;
209 g_setPriority = osPriorityNormal;
210 attr.name = "test";
211 attr.attr_bits = 0U;
212 attr.cb_mem = NULL;
213 attr.cb_size = 0U;
214 attr.stack_mem = NULL;
215 attr.stack_size = TEST_TASK_STACK_SIZE;
216 attr.priority = g_setPriority;
217 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
218 osDelay(DELAY_TICKS_5);
219 TEST_ASSERT_NOT_NULL(id);
220 };
221
222 /**
223 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5400
224 * @tc.name : thread operation for get priority when Priority = osPriorityNormal7
225 * @tc.desc : [C- SOFTWARE -0200]
226 */
227 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority008, Function | MediumTest | Level1)
228 {
229 osThreadId_t id;
230 osThreadAttr_t attr;
231 g_setPriority = osPriorityNormal7;
232 attr.name = "test";
233 attr.attr_bits = 0U;
234 attr.cb_mem = NULL;
235 attr.cb_size = 0U;
236 attr.stack_mem = NULL;
237 attr.stack_size = TEST_TASK_STACK_SIZE;
238 attr.priority = g_setPriority;
239 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
240 TEST_ASSERT_NOT_NULL(id);
241 };
242
243 /**
244 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5440
245 * @tc.name : thread operation for get priority when Priority = osPriorityAboveNormal
246 * @tc.desc : [C- SOFTWARE -0200]
247 */
248 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority009, Function | MediumTest | Level1)
249 {
250 osThreadId_t id;
251 osThreadAttr_t attr;
252 g_setPriority = osPriorityAboveNormal;
253 attr.name = "test";
254 attr.attr_bits = 0U;
255 attr.cb_mem = NULL;
256 attr.cb_size = 0U;
257 attr.stack_mem = NULL;
258 attr.stack_size = TEST_TASK_STACK_SIZE;
259 attr.priority = g_setPriority;
260 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
261 TEST_ASSERT_NOT_NULL(id);
262 };
263
264 /**
265 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5480
266 * @tc.name : thread operation for get priority when Priority = osPriorityAboveNormal6
267 * @tc.desc : [C- SOFTWARE -0200]
268 */
269 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadGetPriority010, Function | MediumTest | Level1)
270 {
271 osThreadId_t id;
272 osThreadAttr_t attr;
273 g_setPriority = osPriorityAboveNormal6;
274 attr.name = "test";
275 attr.attr_bits = 0U;
276 attr.cb_mem = NULL;
277 attr.cb_size = 0U;
278 attr.stack_mem = NULL;
279 attr.stack_size = TEST_TASK_STACK_SIZE;
280 attr.priority = g_setPriority;
281 id = osThreadNew((osThreadFunc_t)CmsisThreadGetPriorityFunc001, NULL, &attr);
282 TEST_ASSERT_NOT_NULL(id);
283 };
284
285 /**
286 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5520
287 * @tc.name : thread operation for set priority input1 exception
288 * @tc.desc : [C- SOFTWARE -0200]
289 */
290 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority001, Function | MediumTest | Level1)
291 {
292 UINT32 uwRet;
293 uwRet = osThreadSetPriority(NULL, osPriorityNormal);
294 TEST_ASSERT_EQUAL_INT(osErrorParameter, uwRet);
295 };
296
297 /**
298 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5560
299 * @tc.name : thread operation for set priority input2 exception
300 * @tc.desc : [C- SOFTWARE -0200]
301 */
302 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority002, Function | MediumTest | Level1)
303 {
304 UINT32 uwRet;
305 g_priTaskID01 = osThreadGetId();
306 uwRet = osThreadSetPriority(g_priTaskID01, osPriorityNone);
307 TEST_ASSERT_EQUAL_INT(osErrorParameter, uwRet);
308 };
309
310 /**
311 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5600
312 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityNone
313 * @tc.desc : [C- SOFTWARE -0200]
314 */
315 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority003, Function | MediumTest | Level1)
316 {
317 osThreadId_t id;
318 osThreadAttr_t attr;
319 attr.name = "test";
320 attr.attr_bits = 0U;
321 attr.cb_mem = NULL;
322 attr.cb_size = 0U;
323 attr.stack_mem = NULL;
324 attr.stack_size = TEST_TASK_STACK_SIZE;
325 attr.priority = osPriorityLow1;
326 g_setPriority = osPriorityNone;
327 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
328 osDelay(DELAY_TICKS_5);
329 TEST_ASSERT_NOT_NULL(id);
330 };
331
332 /**
333 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5640
334 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityIdle
335 * @tc.desc : [C- SOFTWARE -0200]
336 */
337 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority004, Function | MediumTest | Level1)
338 {
339 osThreadId_t id;
340 osThreadAttr_t attr;
341 attr.name = "test";
342 attr.attr_bits = 0U;
343 attr.cb_mem = NULL;
344 attr.cb_size = 0U;
345 attr.stack_mem = NULL;
346 attr.stack_size = TEST_TASK_STACK_SIZE;
347 attr.priority = osPriorityLow1;
348 g_setPriority = osPriorityIdle;
349 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
350 osDelay(DELAY_TICKS_5);
351 TEST_ASSERT_NOT_NULL(id);
352 };
353
354 /**
355 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5680
356 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityLow
357 * @tc.desc : [C- SOFTWARE -0200]
358 */
359 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority005, Function | MediumTest | Level1)
360 {
361 osThreadId_t id;
362 osThreadAttr_t attr;
363 attr.name = "test";
364 attr.attr_bits = 0U;
365 attr.cb_mem = NULL;
366 attr.cb_size = 0U;
367 attr.stack_mem = NULL;
368 attr.stack_size = TEST_TASK_STACK_SIZE;
369 attr.priority = osPriorityLow1;
370 g_setPriority = osPriorityLow;
371 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
372 osDelay(DELAY_TICKS_5);
373 TEST_ASSERT_NOT_NULL(id);
374 };
375
376 /**
377 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5720
378 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityLow1
379 * @tc.desc : [C- SOFTWARE -0200]
380 */
381 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority006, Function | MediumTest | Level1)
382 {
383 osThreadId_t id;
384 osThreadAttr_t attr;
385 attr.name = "test";
386 attr.attr_bits = 0U;
387 attr.cb_mem = NULL;
388 attr.cb_size = 0U;
389 attr.stack_mem = NULL;
390 attr.stack_size = TEST_TASK_STACK_SIZE;
391 attr.priority = osPriorityLow1;
392 g_setPriority = osPriorityLow1;
393 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
394 osDelay(DELAY_TICKS_5);
395 TEST_ASSERT_NOT_NULL(id);
396 };
397
398 /**
399 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5760
400 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityLow7
401 * @tc.desc : [C- SOFTWARE -0200]
402 */
403 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority007, Function | MediumTest | Level1)
404 {
405 osThreadId_t id;
406 osThreadAttr_t attr;
407 attr.name = "test";
408 attr.attr_bits = 0U;
409 attr.cb_mem = NULL;
410 attr.cb_size = 0U;
411 attr.stack_mem = NULL;
412 attr.stack_size = TEST_TASK_STACK_SIZE;
413 attr.priority = osPriorityLow1;
414 g_setPriority = osPriorityLow7;
415 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
416 osDelay(DELAY_TICKS_5);
417 TEST_ASSERT_NOT_NULL(id);
418 };
419
420 /**
421 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5800
422 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityBelowNormal
423 * @tc.desc : [C- SOFTWARE -0200]
424 */
425 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority008, Function | MediumTest | Level1)
426 {
427 osThreadId_t id;
428 osThreadAttr_t attr;
429 attr.name = "test";
430 attr.attr_bits = 0U;
431 attr.cb_mem = NULL;
432 attr.cb_size = 0U;
433 attr.stack_mem = NULL;
434 attr.stack_size = TEST_TASK_STACK_SIZE;
435 attr.priority = osPriorityLow1;
436 g_setPriority = osPriorityBelowNormal;
437 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
438 osDelay(DELAY_TICKS_5);
439 TEST_ASSERT_NOT_NULL(id);
440 };
441
442 /**
443 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5840
444 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityBelowNormal7
445 * @tc.desc : [C- SOFTWARE -0200]
446 */
447 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority009, Function | MediumTest | Level1)
448 {
449 osThreadId_t id;
450 osThreadAttr_t attr;
451 attr.name = "test";
452 attr.attr_bits = 0U;
453 attr.cb_mem = NULL;
454 attr.cb_size = 0U;
455 attr.stack_mem = NULL;
456 attr.stack_size = TEST_TASK_STACK_SIZE;
457 attr.priority = osPriorityLow1;
458 g_setPriority = osPriorityBelowNormal7;
459 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
460 osDelay(DELAY_TICKS_5);
461 TEST_ASSERT_NOT_NULL(id);
462 };
463
464 /**
465 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5880
466 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityNormal
467 * @tc.desc : [C- SOFTWARE -0200]
468 */
469 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority010, Function | MediumTest | Level1)
470 {
471 osThreadId_t id;
472 osThreadAttr_t attr;
473 attr.name = "test";
474 attr.attr_bits = 0U;
475 attr.cb_mem = NULL;
476 attr.cb_size = 0U;
477 attr.stack_mem = NULL;
478 attr.stack_size = TEST_TASK_STACK_SIZE;
479 attr.priority = osPriorityLow1;
480 g_setPriority = osPriorityNormal;
481 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
482 osDelay(DELAY_TICKS_5);
483 TEST_ASSERT_NOT_NULL(id);
484 };
485
486 /**
487 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5920
488 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityNormal7
489 * @tc.desc : [C- SOFTWARE -0200]
490 */
491 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority011, Function | MediumTest | Level1)
492 {
493 osThreadId_t id;
494 osThreadAttr_t attr;
495 attr.name = "test";
496 attr.attr_bits = 0U;
497 attr.cb_mem = NULL;
498 attr.cb_size = 0U;
499 attr.stack_mem = NULL;
500 attr.stack_size = TEST_TASK_STACK_SIZE;
501 attr.priority = osPriorityLow1;
502 g_setPriority = osPriorityNormal7;
503 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
504 osDelay(DELAY_TICKS_5);
505 TEST_ASSERT_NOT_NULL(id);
506 };
507
508 /**
509 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_5960
510 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityAboveNormal
511 * @tc.desc : [C- SOFTWARE -0200]
512 */
513 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority012, Function | MediumTest | Level1)
514 {
515 osThreadId_t id;
516 osThreadAttr_t attr;
517 attr.name = "test";
518 attr.attr_bits = 0U;
519 attr.cb_mem = NULL;
520 attr.cb_size = 0U;
521 attr.stack_mem = NULL;
522 attr.stack_size = TEST_TASK_STACK_SIZE;
523 attr.priority = osPriorityLow1;
524 g_setPriority = osPriorityAboveNormal;
525 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
526 osDelay(DELAY_TICKS_5);
527 TEST_ASSERT_NOT_NULL(id);
528 };
529
530 /**
531 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6000
532 * @tc.name : set priority when curPriority = osPriorityLow1 and setPriority = osPriorityAboveNormal6
533 * @tc.desc : [C- SOFTWARE -0200]
534 */
535 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority013, Function | MediumTest | Level1)
536 {
537 osThreadId_t id;
538 osThreadAttr_t attr;
539 attr.name = "test";
540 attr.attr_bits = 0U;
541 attr.cb_mem = NULL;
542 attr.cb_size = 0U;
543 attr.stack_mem = NULL;
544 attr.stack_size = TEST_TASK_STACK_SIZE;
545 attr.priority = osPriorityLow1;
546 g_setPriority = osPriorityAboveNormal6;
547 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
548 osDelay(DELAY_TICKS_5);
549 TEST_ASSERT_NOT_NULL(id);
550 };
551
552 /**
553 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6040
554 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityAboveNormal7
555 * @tc.desc : [C- SOFTWARE -0200]
556 */
557 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority014, Function | MediumTest | Level1)
558 {
559 osThreadId_t id;
560 osThreadAttr_t attr;
561 attr.name = "test";
562 attr.attr_bits = 0U;
563 attr.cb_mem = NULL;
564 attr.cb_size = 0U;
565 attr.stack_mem = NULL;
566 attr.stack_size = TEST_TASK_STACK_SIZE;
567 attr.priority = osPriorityLow1;
568 g_setPriority = osPriorityAboveNormal7;
569 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
570 osDelay(DELAY_TICKS_5);
571 TEST_ASSERT_NOT_NULL(id);
572 };
573
574 /**
575 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6080
576 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityHigh
577 * @tc.desc : [C- SOFTWARE -0200]
578 */
579 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority015, Function | MediumTest | Level1)
580 {
581 osThreadId_t id;
582 osThreadAttr_t attr;
583 attr.name = "test";
584 attr.attr_bits = 0U;
585 attr.cb_mem = NULL;
586 attr.cb_size = 0U;
587 attr.stack_mem = NULL;
588 attr.stack_size = TEST_TASK_STACK_SIZE;
589 attr.priority = osPriorityLow1;
590 g_setPriority = osPriorityHigh;
591 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
592 osDelay(DELAY_TICKS_5);
593 TEST_ASSERT_NOT_NULL(id);
594 };
595
596 /**
597 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6120
598 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityHigh7
599 * @tc.desc : [C- SOFTWARE -0200]
600 */
601 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority016, Function | MediumTest | Level1)
602 {
603 osThreadId_t id;
604 osThreadAttr_t attr;
605 attr.name = "test";
606 attr.attr_bits = 0U;
607 attr.cb_mem = NULL;
608 attr.cb_size = 0U;
609 attr.stack_mem = NULL;
610 attr.stack_size = TEST_TASK_STACK_SIZE;
611 attr.priority = osPriorityLow1;
612 g_setPriority = osPriorityHigh7;
613 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
614 osDelay(DELAY_TICKS_5);
615 TEST_ASSERT_NOT_NULL(id);
616 };
617
618 /**
619 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6160
620 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityRealtime
621 * @tc.desc : [C- SOFTWARE -0200]
622 */
623 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority017, Function | MediumTest | Level1)
624 {
625 osThreadId_t id;
626 osThreadAttr_t attr;
627 attr.name = "test";
628 attr.attr_bits = 0U;
629 attr.cb_mem = NULL;
630 attr.cb_size = 0U;
631 attr.stack_mem = NULL;
632 attr.stack_size = TEST_TASK_STACK_SIZE;
633 attr.priority = osPriorityLow1;
634 g_setPriority = osPriorityRealtime;
635 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
636 osDelay(DELAY_TICKS_5);
637 TEST_ASSERT_NOT_NULL(id);
638 };
639
640 /**
641 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6200
642 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityRealtime7
643 * @tc.desc : [C- SOFTWARE -0200]
644 */
645 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority018, Function | MediumTest | Level1)
646 {
647 osThreadId_t id;
648 osThreadAttr_t attr;
649 attr.name = "test";
650 attr.attr_bits = 0U;
651 attr.cb_mem = NULL;
652 attr.cb_size = 0U;
653 attr.stack_mem = NULL;
654 attr.stack_size = TEST_TASK_STACK_SIZE;
655 attr.priority = osPriorityLow1;
656 g_setPriority = osPriorityRealtime7;
657 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
658 osDelay(DELAY_TICKS_5);
659 TEST_ASSERT_NOT_NULL(id);
660 };
661
662 /**
663 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6240
664 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityISR
665 * @tc.desc : [C- SOFTWARE -0200]
666 */
667 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority019, Function | MediumTest | Level1)
668 {
669 osThreadId_t id;
670 osThreadAttr_t attr;
671 attr.name = "test";
672 attr.attr_bits = 0U;
673 attr.cb_mem = NULL;
674 attr.cb_size = 0U;
675 attr.stack_mem = NULL;
676 attr.stack_size = TEST_TASK_STACK_SIZE;
677 attr.priority = osPriorityLow1;
678 g_setPriority = osPriorityISR;
679 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
680 osDelay(DELAY_TICKS_5);
681 TEST_ASSERT_NOT_NULL(id);
682 };
683
684 /**
685 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6280
686 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityError
687 * @tc.desc : [C- SOFTWARE -0200]
688 */
689 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority020, Function | MediumTest | Level1)
690 {
691 osThreadId_t id;
692 osThreadAttr_t attr;
693 attr.name = "test";
694 attr.attr_bits = 0U;
695 attr.cb_mem = NULL;
696 attr.cb_size = 0U;
697 attr.stack_mem = NULL;
698 attr.stack_size = TEST_TASK_STACK_SIZE;
699 attr.priority = osPriorityLow1;
700 g_setPriority = osPriorityError;
701 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
702 osDelay(DELAY_TICKS_5);
703 TEST_ASSERT_NOT_NULL(id);
704 };
705
706 /**
707 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6320
708 * @tc.name : set invalid priority when curPriority = osPriorityLow1 and setPriority = osPriorityReserved
709 * @tc.desc : [C- SOFTWARE -0200]
710 */
711 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority021, Function | MediumTest | Level1)
712 {
713 osThreadId_t id;
714 osThreadAttr_t attr;
715 attr.name = "test";
716 attr.attr_bits = 0U;
717 attr.cb_mem = NULL;
718 attr.cb_size = 0U;
719 attr.stack_mem = NULL;
720 attr.stack_size = TEST_TASK_STACK_SIZE;
721 attr.priority = osPriorityLow1;
722 g_setPriority = osPriorityReserved;
723 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
724 osDelay(DELAY_TICKS_5);
725 TEST_ASSERT_NOT_NULL(id);
726 };
727
728 /**
729 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6360
730 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityNone
731 * @tc.desc : [C- SOFTWARE -0200]
732 */
733 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority022, Function | MediumTest | Level1)
734 {
735 osThreadId_t id;
736 osThreadAttr_t attr;
737 attr.name = "test";
738 attr.attr_bits = 0U;
739 attr.cb_mem = NULL;
740 attr.cb_size = 0U;
741 attr.stack_mem = NULL;
742 attr.stack_size = TEST_TASK_STACK_SIZE;
743 attr.priority = osPriorityNormal;
744 g_setPriority = osPriorityNone;
745 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
746 osDelay(DELAY_TICKS_5);
747 TEST_ASSERT_NOT_NULL(id);
748 };
749
750 /**
751 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6400
752 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityIdle
753 * @tc.desc : [C- SOFTWARE -0200]
754 */
755 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority023, Function | MediumTest | Level1)
756 {
757 osThreadId_t id;
758 osThreadAttr_t attr;
759 attr.name = "test";
760 attr.attr_bits = 0U;
761 attr.cb_mem = NULL;
762 attr.cb_size = 0U;
763 attr.stack_mem = NULL;
764 attr.stack_size = TEST_TASK_STACK_SIZE;
765 attr.priority = osPriorityNormal;
766 g_setPriority = osPriorityIdle;
767 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
768 osDelay(DELAY_TICKS_5);
769 TEST_ASSERT_NOT_NULL(id);
770 };
771
772 /**
773 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6440
774 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityLow
775 * @tc.desc : [C- SOFTWARE -0200]
776 */
777 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority024, Function | MediumTest | Level1)
778 {
779 osThreadId_t id;
780 osThreadAttr_t attr;
781 attr.name = "test";
782 attr.attr_bits = 0U;
783 attr.cb_mem = NULL;
784 attr.cb_size = 0U;
785 attr.stack_mem = NULL;
786 attr.stack_size = TEST_TASK_STACK_SIZE;
787 attr.priority = osPriorityNormal;
788 g_setPriority = osPriorityLow;
789 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
790 osDelay(DELAY_TICKS_5);
791 TEST_ASSERT_NOT_NULL(id);
792 };
793
794 /**
795 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6480
796 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityLow1
797 * @tc.desc : [C- SOFTWARE -0200]
798 */
799 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority025, Function | MediumTest | Level1)
800 {
801 osThreadId_t id;
802 osThreadAttr_t attr;
803 attr.name = "test";
804 attr.attr_bits = 0U;
805 attr.cb_mem = NULL;
806 attr.cb_size = 0U;
807 attr.stack_mem = NULL;
808 attr.stack_size = TEST_TASK_STACK_SIZE;
809 attr.priority = osPriorityNormal;
810 g_setPriority = osPriorityLow1;
811 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
812 osDelay(DELAY_TICKS_5);
813 TEST_ASSERT_NOT_NULL(id);
814 };
815
816 /**
817 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6520
818 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityLow7
819 * @tc.desc : [C- SOFTWARE -0200]
820 */
821 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority026, Function | MediumTest | Level1)
822 {
823 osThreadId_t id;
824 osThreadAttr_t attr;
825 attr.name = "test";
826 attr.attr_bits = 0U;
827 attr.cb_mem = NULL;
828 attr.cb_size = 0U;
829 attr.stack_mem = NULL;
830 attr.stack_size = TEST_TASK_STACK_SIZE;
831 attr.priority = osPriorityNormal;
832 g_setPriority = osPriorityLow7;
833 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
834 osDelay(DELAY_TICKS_5);
835 TEST_ASSERT_NOT_NULL(id);
836 };
837
838 /**
839 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6560
840 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityBelowNormal
841 * @tc.desc : [C- SOFTWARE -0200]
842 */
843 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority027, Function | MediumTest | Level1)
844 {
845 osThreadId_t id;
846 osThreadAttr_t attr;
847 attr.name = "test";
848 attr.attr_bits = 0U;
849 attr.cb_mem = NULL;
850 attr.cb_size = 0U;
851 attr.stack_mem = NULL;
852 attr.stack_size = TEST_TASK_STACK_SIZE;
853 attr.priority = osPriorityNormal;
854 g_setPriority = osPriorityBelowNormal;
855 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
856 osDelay(DELAY_TICKS_5);
857 TEST_ASSERT_NOT_NULL(id);
858 };
859
860 /**
861 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6600
862 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityBelowNormal7
863 * @tc.desc : [C- SOFTWARE -0200]
864 */
865 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority028, Function | MediumTest | Level1)
866 {
867 osThreadId_t id;
868 osThreadAttr_t attr;
869 attr.name = "test";
870 attr.attr_bits = 0U;
871 attr.cb_mem = NULL;
872 attr.cb_size = 0U;
873 attr.stack_mem = NULL;
874 attr.stack_size = TEST_TASK_STACK_SIZE;
875 attr.priority = osPriorityNormal;
876 g_setPriority = osPriorityBelowNormal7;
877 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
878 osDelay(DELAY_TICKS_5);
879 TEST_ASSERT_NOT_NULL(id);
880 };
881
882 /**
883 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6640
884 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityNormal
885 * @tc.desc : [C- SOFTWARE -0200]
886 */
887 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority029, Function | MediumTest | Level1)
888 {
889 osThreadId_t id;
890 osThreadAttr_t attr;
891 attr.name = "test";
892 attr.attr_bits = 0U;
893 attr.cb_mem = NULL;
894 attr.cb_size = 0U;
895 attr.stack_mem = NULL;
896 attr.stack_size = TEST_TASK_STACK_SIZE;
897 attr.priority = osPriorityNormal;
898 g_setPriority = osPriorityNormal;
899 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
900 osDelay(DELAY_TICKS_5);
901 TEST_ASSERT_NOT_NULL(id);
902 };
903
904 /**
905 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6680
906 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityNormal7
907 * @tc.desc : [C- SOFTWARE -0200]
908 */
909 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority030, Function | MediumTest | Level1)
910 {
911 osThreadId_t id;
912 osThreadAttr_t attr;
913 attr.name = "test";
914 attr.attr_bits = 0U;
915 attr.cb_mem = NULL;
916 attr.cb_size = 0U;
917 attr.stack_mem = NULL;
918 attr.stack_size = TEST_TASK_STACK_SIZE;
919 attr.priority = osPriorityNormal;
920 g_setPriority = osPriorityNormal7;
921 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
922 osDelay(DELAY_TICKS_5);
923 TEST_ASSERT_NOT_NULL(id);
924 };
925
926 /**
927 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6720
928 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityAboveNormal
929 * @tc.desc : [C- SOFTWARE -0200]
930 */
931 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority031, Function | MediumTest | Level1)
932 {
933 osThreadId_t id;
934 osThreadAttr_t attr;
935 attr.name = "test";
936 attr.attr_bits = 0U;
937 attr.cb_mem = NULL;
938 attr.cb_size = 0U;
939 attr.stack_mem = NULL;
940 attr.stack_size = TEST_TASK_STACK_SIZE;
941 attr.priority = osPriorityNormal;
942 g_setPriority = osPriorityAboveNormal;
943 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
944 osDelay(DELAY_TICKS_5);
945 TEST_ASSERT_NOT_NULL(id);
946 };
947
948 /**
949 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6760
950 * @tc.name : set priority when curPriority = osPriorityNormal and setPriority = osPriorityAboveNormal6
951 * @tc.desc : [C- SOFTWARE -0200]
952 */
953 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority032, Function | MediumTest | Level1)
954 {
955 osThreadId_t id;
956 osThreadAttr_t attr;
957 attr.name = "test";
958 attr.attr_bits = 0U;
959 attr.cb_mem = NULL;
960 attr.cb_size = 0U;
961 attr.stack_mem = NULL;
962 attr.stack_size = TEST_TASK_STACK_SIZE;
963 attr.priority = osPriorityNormal;
964 g_setPriority = osPriorityAboveNormal6;
965 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
966 osDelay(DELAY_TICKS_5);
967 TEST_ASSERT_NOT_NULL(id);
968 };
969
970 /**
971 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6800
972 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityAboveNormal7
973 * @tc.desc : [C- SOFTWARE -0200]
974 */
975 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority033, Function | MediumTest | Level1)
976 {
977 osThreadId_t id;
978 osThreadAttr_t attr;
979 attr.name = "test";
980 attr.attr_bits = 0U;
981 attr.cb_mem = NULL;
982 attr.cb_size = 0U;
983 attr.stack_mem = NULL;
984 attr.stack_size = TEST_TASK_STACK_SIZE;
985 attr.priority = osPriorityNormal;
986 g_setPriority = osPriorityAboveNormal7;
987 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
988 osDelay(DELAY_TICKS_5);
989 TEST_ASSERT_NOT_NULL(id);
990 };
991
992 /**
993 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6840
994 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityHigh
995 * @tc.desc : [C- SOFTWARE -0200]
996 */
997 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority034, Function | MediumTest | Level1)
998 {
999 osThreadId_t id;
1000 osThreadAttr_t attr;
1001 attr.name = "test";
1002 attr.attr_bits = 0U;
1003 attr.cb_mem = NULL;
1004 attr.cb_size = 0U;
1005 attr.stack_mem = NULL;
1006 attr.stack_size = TEST_TASK_STACK_SIZE;
1007 attr.priority = osPriorityNormal;
1008 g_setPriority = osPriorityHigh;
1009 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1010 osDelay(DELAY_TICKS_5);
1011 TEST_ASSERT_NOT_NULL(id);
1012 };
1013
1014 /**
1015 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6880
1016 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityHigh7
1017 * @tc.desc : [C- SOFTWARE -0200]
1018 */
1019 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority035, Function | MediumTest | Level1)
1020 {
1021 osThreadId_t id;
1022 osThreadAttr_t attr;
1023 attr.name = "test";
1024 attr.attr_bits = 0U;
1025 attr.cb_mem = NULL;
1026 attr.cb_size = 0U;
1027 attr.stack_mem = NULL;
1028 attr.stack_size = TEST_TASK_STACK_SIZE;
1029 attr.priority = osPriorityNormal;
1030 g_setPriority = osPriorityHigh7;
1031 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1032 osDelay(DELAY_TICKS_5);
1033 TEST_ASSERT_NOT_NULL(id);
1034 };
1035
1036 /**
1037 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6920
1038 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityRealtime
1039 * @tc.desc : [C- SOFTWARE -0200]
1040 */
1041 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority036, Function | MediumTest | Level1)
1042 {
1043 osThreadId_t id;
1044 osThreadAttr_t attr;
1045 attr.name = "test";
1046 attr.attr_bits = 0U;
1047 attr.cb_mem = NULL;
1048 attr.cb_size = 0U;
1049 attr.stack_mem = NULL;
1050 attr.stack_size = TEST_TASK_STACK_SIZE;
1051 attr.priority = osPriorityNormal;
1052 g_setPriority = osPriorityRealtime;
1053 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1054 osDelay(DELAY_TICKS_5);
1055 TEST_ASSERT_NOT_NULL(id);
1056 };
1057
1058 /**
1059 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_6960
1060 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityRealtime7
1061 * @tc.desc : [C- SOFTWARE -0200]
1062 */
1063 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority037, Function | MediumTest | Level1)
1064 {
1065 osThreadId_t id;
1066 osThreadAttr_t attr;
1067 attr.name = "test";
1068 attr.attr_bits = 0U;
1069 attr.cb_mem = NULL;
1070 attr.cb_size = 0U;
1071 attr.stack_mem = NULL;
1072 attr.stack_size = TEST_TASK_STACK_SIZE;
1073 attr.priority = osPriorityNormal;
1074 g_setPriority = osPriorityRealtime7;
1075 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1076 osDelay(DELAY_TICKS_5);
1077 TEST_ASSERT_NOT_NULL(id);
1078 };
1079
1080 /**
1081 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7000
1082 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityISR
1083 * @tc.desc : [C- SOFTWARE -0200]
1084 */
1085 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority038, Function | MediumTest | Level1)
1086 {
1087 osThreadId_t id;
1088 osThreadAttr_t attr;
1089 attr.name = "test";
1090 attr.attr_bits = 0U;
1091 attr.cb_mem = NULL;
1092 attr.cb_size = 0U;
1093 attr.stack_mem = NULL;
1094 attr.stack_size = TEST_TASK_STACK_SIZE;
1095 attr.priority = osPriorityNormal;
1096 g_setPriority = osPriorityISR;
1097 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1098 osDelay(DELAY_TICKS_5);
1099 TEST_ASSERT_NOT_NULL(id);
1100 };
1101
1102 /**
1103 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7040
1104 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityError
1105 * @tc.desc : [C- SOFTWARE -0200]
1106 */
1107 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority039, Function | MediumTest | Level1)
1108 {
1109 osThreadId_t id;
1110 osThreadAttr_t attr;
1111 attr.name = "test";
1112 attr.attr_bits = 0U;
1113 attr.cb_mem = NULL;
1114 attr.cb_size = 0U;
1115 attr.stack_mem = NULL;
1116 attr.stack_size = TEST_TASK_STACK_SIZE;
1117 attr.priority = osPriorityNormal;
1118 g_setPriority = osPriorityError;
1119 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1120 osDelay(DELAY_TICKS_5);
1121 TEST_ASSERT_NOT_NULL(id);
1122 };
1123
1124 /**
1125 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7080
1126 * @tc.name : set invalid priority when curPriority = osPriorityNormal and setPriority = osPriorityReserved
1127 * @tc.desc : [C- SOFTWARE -0200]
1128 */
1129 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority040, Function | MediumTest | Level1)
1130 {
1131 osThreadId_t id;
1132 osThreadAttr_t attr;
1133 attr.name = "test";
1134 attr.attr_bits = 0U;
1135 attr.cb_mem = NULL;
1136 attr.cb_size = 0U;
1137 attr.stack_mem = NULL;
1138 attr.stack_size = TEST_TASK_STACK_SIZE;
1139 attr.priority = osPriorityNormal;
1140 g_setPriority = osPriorityReserved;
1141 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1142 osDelay(DELAY_TICKS_5);
1143 TEST_ASSERT_NOT_NULL(id);
1144 };
1145
1146 /**
1147 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7120
1148 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityNone
1149 * @tc.desc : [C- SOFTWARE -0200]
1150 */
1151 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority041, Function | MediumTest | Level1)
1152 {
1153 osThreadId_t id;
1154 osThreadAttr_t attr;
1155 attr.name = "test";
1156 attr.attr_bits = 0U;
1157 attr.cb_mem = NULL;
1158 attr.cb_size = 0U;
1159 attr.stack_mem = NULL;
1160 attr.stack_size = TEST_TASK_STACK_SIZE;
1161 attr.priority = osPriorityAboveNormal6;
1162 g_setPriority = osPriorityNone;
1163 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1164 osDelay(DELAY_TICKS_5);
1165 TEST_ASSERT_NOT_NULL(id);
1166 };
1167
1168 /**
1169 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7160
1170 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityIdle
1171 * @tc.desc : [C- SOFTWARE -0200]
1172 */
1173 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority042, Function | MediumTest | Level1)
1174 {
1175 osThreadId_t id;
1176 osThreadAttr_t attr;
1177 attr.name = "test";
1178 attr.attr_bits = 0U;
1179 attr.cb_mem = NULL;
1180 attr.cb_size = 0U;
1181 attr.stack_mem = NULL;
1182 attr.stack_size = TEST_TASK_STACK_SIZE;
1183 attr.priority = osPriorityAboveNormal6;
1184 g_setPriority = osPriorityIdle;
1185 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1186 osDelay(DELAY_TICKS_5);
1187 TEST_ASSERT_NOT_NULL(id);
1188 };
1189
1190 /**
1191 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7200
1192 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityLow
1193 * @tc.desc : [C- SOFTWARE -0200]
1194 */
1195 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority043, Function | MediumTest | Level1)
1196 {
1197 osThreadId_t id;
1198 osThreadAttr_t attr;
1199 attr.name = "test";
1200 attr.attr_bits = 0U;
1201 attr.cb_mem = NULL;
1202 attr.cb_size = 0U;
1203 attr.stack_mem = NULL;
1204 attr.stack_size = TEST_TASK_STACK_SIZE;
1205 attr.priority = osPriorityAboveNormal6;
1206 g_setPriority = osPriorityLow;
1207 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1208 osDelay(DELAY_TICKS_5);
1209 TEST_ASSERT_NOT_NULL(id);
1210 };
1211
1212 /**
1213 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7240
1214 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityLow1
1215 * @tc.desc : [C- SOFTWARE -0200]
1216 */
1217 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority044, Function | MediumTest | Level1)
1218 {
1219 osThreadId_t id;
1220 osThreadAttr_t attr;
1221 attr.name = "test";
1222 attr.attr_bits = 0U;
1223 attr.cb_mem = NULL;
1224 attr.cb_size = 0U;
1225 attr.stack_mem = NULL;
1226 attr.stack_size = TEST_TASK_STACK_SIZE;
1227 attr.priority = osPriorityAboveNormal6;
1228 g_setPriority = osPriorityLow1;
1229 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1230 osDelay(DELAY_TICKS_5);
1231 TEST_ASSERT_NOT_NULL(id);
1232 };
1233
1234 /**
1235 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7280
1236 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityLow7
1237 * @tc.desc : [C- SOFTWARE -0200]
1238 */
1239 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority045, Function | MediumTest | Level1)
1240 {
1241 osThreadId_t id;
1242 osThreadAttr_t attr;
1243 attr.name = "test";
1244 attr.attr_bits = 0U;
1245 attr.cb_mem = NULL;
1246 attr.cb_size = 0U;
1247 attr.stack_mem = NULL;
1248 attr.stack_size = TEST_TASK_STACK_SIZE;
1249 attr.priority = osPriorityAboveNormal6;
1250 g_setPriority = osPriorityLow7;
1251 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1252 osDelay(DELAY_TICKS_5);
1253 TEST_ASSERT_NOT_NULL(id);
1254 };
1255
1256 /**
1257 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7320
1258 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityBelowNormal
1259 * @tc.desc : [C- SOFTWARE -0200]
1260 */
1261 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority046, Function | MediumTest | Level1)
1262 {
1263 osThreadId_t id;
1264 osThreadAttr_t attr;
1265 attr.name = "test";
1266 attr.attr_bits = 0U;
1267 attr.cb_mem = NULL;
1268 attr.cb_size = 0U;
1269 attr.stack_mem = NULL;
1270 attr.stack_size = TEST_TASK_STACK_SIZE;
1271 attr.priority = osPriorityAboveNormal6;
1272 g_setPriority = osPriorityBelowNormal;
1273 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1274 osDelay(DELAY_TICKS_5);
1275 TEST_ASSERT_NOT_NULL(id);
1276 };
1277
1278 /**
1279 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7360
1280 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityBelowNormal7
1281 * @tc.desc : [C- SOFTWARE -0200]
1282 */
1283 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority047, Function | MediumTest | Level1)
1284 {
1285 osThreadId_t id;
1286 osThreadAttr_t attr;
1287 attr.name = "test";
1288 attr.attr_bits = 0U;
1289 attr.cb_mem = NULL;
1290 attr.cb_size = 0U;
1291 attr.stack_mem = NULL;
1292 attr.stack_size = TEST_TASK_STACK_SIZE;
1293 attr.priority = osPriorityAboveNormal6;
1294 g_setPriority = osPriorityBelowNormal7;
1295 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1296 osDelay(DELAY_TICKS_5);
1297 TEST_ASSERT_NOT_NULL(id);
1298 };
1299
1300 /**
1301 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7400
1302 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityNormal
1303 * @tc.desc : [C- SOFTWARE -0200]
1304 */
1305 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority048, Function | MediumTest | Level1)
1306 {
1307 osThreadId_t id;
1308 osThreadAttr_t attr;
1309 attr.name = "test";
1310 attr.attr_bits = 0U;
1311 attr.cb_mem = NULL;
1312 attr.cb_size = 0U;
1313 attr.stack_mem = NULL;
1314 attr.stack_size = TEST_TASK_STACK_SIZE;
1315 attr.priority = osPriorityAboveNormal6;
1316 g_setPriority = osPriorityNormal;
1317 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1318 osDelay(DELAY_TICKS_5);
1319 TEST_ASSERT_NOT_NULL(id);
1320 };
1321
1322 /**
1323 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7440
1324 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityNormal7
1325 * @tc.desc : [C- SOFTWARE -0200]
1326 */
1327 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority049, Function | MediumTest | Level1)
1328 {
1329 osThreadId_t id;
1330 osThreadAttr_t attr;
1331 attr.name = "test";
1332 attr.attr_bits = 0U;
1333 attr.cb_mem = NULL;
1334 attr.cb_size = 0U;
1335 attr.stack_mem = NULL;
1336 attr.stack_size = TEST_TASK_STACK_SIZE;
1337 attr.priority = osPriorityAboveNormal6;
1338 g_setPriority = osPriorityNormal7;
1339 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1340 osDelay(DELAY_TICKS_5);
1341 TEST_ASSERT_NOT_NULL(id);
1342 };
1343
1344 /**
1345 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7480
1346 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityAboveNormal
1347 * @tc.desc : [C- SOFTWARE -0200]
1348 */
1349 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority050, Function | MediumTest | Level1)
1350 {
1351 osThreadId_t id;
1352 osThreadAttr_t attr;
1353 attr.name = "test";
1354 attr.attr_bits = 0U;
1355 attr.cb_mem = NULL;
1356 attr.cb_size = 0U;
1357 attr.stack_mem = NULL;
1358 attr.stack_size = TEST_TASK_STACK_SIZE;
1359 attr.priority = osPriorityAboveNormal6;
1360 g_setPriority = osPriorityAboveNormal;
1361 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1362 osDelay(DELAY_TICKS_5);
1363 TEST_ASSERT_NOT_NULL(id);
1364 };
1365
1366 /**
1367 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7520
1368 * @tc.name : set priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityAboveNormal6
1369 * @tc.desc : [C- SOFTWARE -0200]
1370 */
1371 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority051, Function | MediumTest | Level1)
1372 {
1373 osThreadId_t id;
1374 osThreadAttr_t attr;
1375 attr.name = "test";
1376 attr.attr_bits = 0U;
1377 attr.cb_mem = NULL;
1378 attr.cb_size = 0U;
1379 attr.stack_mem = NULL;
1380 attr.stack_size = TEST_TASK_STACK_SIZE;
1381 attr.priority = osPriorityAboveNormal6;
1382 g_setPriority = osPriorityAboveNormal6;
1383 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc001, NULL, &attr);
1384 osDelay(DELAY_TICKS_5);
1385 TEST_ASSERT_NOT_NULL(id);
1386 };
1387
1388 /**
1389 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7560
1390 * @tc.name : set invalid priority when curPriority = PriorityAboveNormal6 and setPriority = PriorityAboveNormal7
1391 * @tc.desc : [C- SOFTWARE -0200]
1392 */
1393 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority052, Function | MediumTest | Level1)
1394 {
1395 osThreadId_t id;
1396 osThreadAttr_t attr;
1397 attr.name = "test";
1398 attr.attr_bits = 0U;
1399 attr.cb_mem = NULL;
1400 attr.cb_size = 0U;
1401 attr.stack_mem = NULL;
1402 attr.stack_size = TEST_TASK_STACK_SIZE;
1403 attr.priority = osPriorityAboveNormal6;
1404 g_setPriority = osPriorityAboveNormal7;
1405 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1406 osDelay(DELAY_TICKS_5);
1407 TEST_ASSERT_NOT_NULL(id);
1408 };
1409
1410 /**
1411 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7600
1412 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityHigh
1413 * @tc.desc : [C- SOFTWARE -0200]
1414 */
1415 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority053, Function | MediumTest | Level1)
1416 {
1417 osThreadId_t id;
1418 osThreadAttr_t attr;
1419 attr.name = "test";
1420 attr.attr_bits = 0U;
1421 attr.cb_mem = NULL;
1422 attr.cb_size = 0U;
1423 attr.stack_mem = NULL;
1424 attr.stack_size = TEST_TASK_STACK_SIZE;
1425 attr.priority = osPriorityAboveNormal6;
1426 g_setPriority = osPriorityHigh;
1427 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1428 osDelay(DELAY_TICKS_5);
1429 TEST_ASSERT_NOT_NULL(id);
1430 };
1431
1432 /**
1433 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7640
1434 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityHigh7
1435 * @tc.desc : [C- SOFTWARE -0200]
1436 */
1437 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority054, Function | MediumTest | Level1)
1438 {
1439 osThreadId_t id;
1440 osThreadAttr_t attr;
1441 attr.name = "test";
1442 attr.attr_bits = 0U;
1443 attr.cb_mem = NULL;
1444 attr.cb_size = 0U;
1445 attr.stack_mem = NULL;
1446 attr.stack_size = TEST_TASK_STACK_SIZE;
1447 attr.priority = osPriorityAboveNormal6;
1448 g_setPriority = osPriorityHigh7;
1449 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1450 osDelay(DELAY_TICKS_5);
1451 TEST_ASSERT_NOT_NULL(id);
1452 };
1453
1454 /**
1455 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7680
1456 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityRealtime
1457 * @tc.desc : [C- SOFTWARE -0200]
1458 */
1459 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority055, Function | MediumTest | Level1)
1460 {
1461 osThreadId_t id;
1462 osThreadAttr_t attr;
1463 attr.name = "test";
1464 attr.attr_bits = 0U;
1465 attr.cb_mem = NULL;
1466 attr.cb_size = 0U;
1467 attr.stack_mem = NULL;
1468 attr.stack_size = TEST_TASK_STACK_SIZE;
1469 attr.priority = osPriorityAboveNormal6;
1470 g_setPriority = osPriorityRealtime;
1471 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1472 osDelay(DELAY_TICKS_5);
1473 TEST_ASSERT_NOT_NULL(id);
1474 };
1475
1476 /**
1477 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7720
1478 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityRealtime7
1479 * @tc.desc : [C- SOFTWARE -0200]
1480 */
1481 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority056, Function | MediumTest | Level1)
1482 {
1483 osThreadId_t id;
1484 osThreadAttr_t attr;
1485 attr.name = "test";
1486 attr.attr_bits = 0U;
1487 attr.cb_mem = NULL;
1488 attr.cb_size = 0U;
1489 attr.stack_mem = NULL;
1490 attr.stack_size = TEST_TASK_STACK_SIZE;
1491 attr.priority = osPriorityAboveNormal6;
1492 g_setPriority = osPriorityRealtime7;
1493 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1494 osDelay(DELAY_TICKS_5);
1495 TEST_ASSERT_NOT_NULL(id);
1496 };
1497
1498 /**
1499 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7760
1500 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityISR
1501 * @tc.desc : [C- SOFTWARE -0200]
1502 */
1503 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority057, Function | MediumTest | Level1)
1504 {
1505 osThreadId_t id;
1506 osThreadAttr_t attr;
1507 attr.name = "test";
1508 attr.attr_bits = 0U;
1509 attr.cb_mem = NULL;
1510 attr.cb_size = 0U;
1511 attr.stack_mem = NULL;
1512 attr.stack_size = TEST_TASK_STACK_SIZE;
1513 attr.priority = osPriorityAboveNormal6;
1514 g_setPriority = osPriorityISR;
1515 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1516 osDelay(DELAY_TICKS_5);
1517 TEST_ASSERT_NOT_NULL(id);
1518 };
1519
1520 /**
1521 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7800
1522 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityError
1523 * @tc.desc : [C- SOFTWARE -0200]
1524 */
1525 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority058, Function | MediumTest | Level1)
1526 {
1527 osThreadId_t id;
1528 osThreadAttr_t attr;
1529 attr.name = "test";
1530 attr.attr_bits = 0U;
1531 attr.cb_mem = NULL;
1532 attr.cb_size = 0U;
1533 attr.stack_mem = NULL;
1534 attr.stack_size = TEST_TASK_STACK_SIZE;
1535 attr.priority = osPriorityAboveNormal6;
1536 g_setPriority = osPriorityError;
1537 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1538 osDelay(DELAY_TICKS_5);
1539 TEST_ASSERT_NOT_NULL(id);
1540 };
1541
1542 /**
1543 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7840
1544 * @tc.name : set invalid priority when curPriority = osPriorityAboveNormal6 and setPriority = osPriorityReserved
1545 * @tc.desc : [C- SOFTWARE -0200]
1546 */
1547 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsThreadSetPriority059, Function | MediumTest | Level1)
1548 {
1549 osThreadId_t id;
1550 osThreadAttr_t attr;
1551 attr.name = "test";
1552 attr.attr_bits = 0U;
1553 attr.cb_mem = NULL;
1554 attr.cb_size = 0U;
1555 attr.stack_mem = NULL;
1556 attr.stack_size = TEST_TASK_STACK_SIZE;
1557 attr.priority = osPriorityAboveNormal6;
1558 g_setPriority = osPriorityReserved;
1559 id = osThreadNew((osThreadFunc_t)CmsisThreadSetPriorityFunc002, NULL, &attr);
1560 osDelay(DELAY_TICKS_5);
1561 TEST_ASSERT_NOT_NULL(id);
1562 };
1563
1564 /**
1565 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7880
1566 * @tc.name : delay operation for 5 ticks
1567 * @tc.desc : [C- SOFTWARE -0200]
1568
1569 */
1570 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsDelay001, Function | MediumTest | Level1)
1571 {
1572 UINT32 uwRet;
1573 uwRet = osDelay(DELAY_TICKS_5);
1574 TEST_ASSERT_EQUAL_INT(osOK, uwRet);
1575 };
1576
1577 /**
1578 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7920
1579 * @tc.name : delay operation
1580 * @tc.desc : [C- SOFTWARE -0200]
1581
1582 */
1583 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsDelay002, Function | MediumTest | Level1)
1584 {
1585 UINT32 uwRet;
1586 uwRet = osDelay(0);
1587 TEST_ASSERT_EQUAL_INT(osOK, uwRet);
1588 };
1589
1590 /**
1591 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_7960
1592 * @tc.name : delay until operation
1593 * @tc.desc : [C- SOFTWARE -0200]
1594
1595 */
1596 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsDelayUntil001, Function | MediumTest | Level1)
1597 {
1598 UINT32 uwRet;
1599 UINT32 uwTickCnt;
1600 UINT32 uwUntilTickCnt;
1601 uwTickCnt = osKernelGetTickCount();
1602 uwUntilTickCnt = uwTickCnt + DELAY_TICKS_10;
1603 uwRet = osDelayUntil(uwUntilTickCnt);
1604 TEST_ASSERT_EQUAL_INT(osOK, uwRet);
1605 };
1606
1607 /**
1608 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_8000
1609 * @tc.name : delay until operation input exception for 1 tick
1610 * @tc.desc : [C- SOFTWARE -0200]
1611 */
1612 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsDelayUntil002, Function | MediumTest | Level1)
1613 {
1614 UINT32 uwRet;
1615 uwRet = osDelayUntil(DELAY_TICKS_1);
1616 TEST_ASSERT_EQUAL_INT(osError, uwRet);
1617 };
1618
1619 /**
1620 * @tc.number : SUB_KERNEL_CMSIS_TASK_OPERATION_8040
1621 * @tc.name : delay until operation input exception
1622 * @tc.desc : [C- SOFTWARE -0200]
1623 */
1624 LITE_TEST_CASE(CmsisTaskPriFuncTestSuite, testOsDelayUntil003, Function | MediumTest | Level1)
1625 {
1626 UINT32 uwRet;
1627 UINT32 uwTickCnt;
1628 UINT32 uwUntilTickCnt;
1629 uwTickCnt = osKernelGetTickCount();
1630 uwUntilTickCnt = uwTickCnt - DELAY_TICKS_10;
1631 uwRet = osDelayUntil(uwUntilTickCnt);
1632 TEST_ASSERT_EQUAL_INT(osError, uwRet);
1633 };
1634
1635 RUN_TEST_SUITE(CmsisTaskPriFuncTestSuite);
1636