• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 UINT32 g_threadCount;
25 UINT16 g_cmsisTestTaskCount;
26 UINT16 g_getStackSizeExit;
27 UINT16 g_threadCreateExit;
28 UINT16 g_getNameExit;
29 UINT16 g_getStackSpaceExit;
30 osThreadId_t g_puwTaskID01;
31 osThreadId_t g_puwTaskID02;
32 osPriority_t g_threadPriority;
33 
34 /**
35  * @tc.desc      : register a test suite, this suite is used to test basic flow and interface dependency
36  * @param        : subsystem name is utils
37  * @param        : module name is utilsFile
38  * @param        : test suit name is CmsisTaskFuncTestSuite
39  */
40 LITE_TEST_SUIT(Cmsis, Cmsistask, CmsisTaskFuncTestSuite);
41 
42 /**
43  * @tc.setup     : setup for all testcases
44  * @return       : setup result, TRUE is success, FALSE is fail
45  */
CmsisTaskFuncTestSuiteSetUp(void)46 static BOOL CmsisTaskFuncTestSuiteSetUp(void)
47 {
48     return TRUE;
49 }
50 
51 /**
52  * @tc.teardown  : teardown for all testcases
53  * @return       : teardown result, TRUE is success, FALSE is fail
54  */
CmsisTaskFuncTestSuiteTearDown(void)55 static BOOL CmsisTaskFuncTestSuiteTearDown(void)
56 {
57     printf("+-------------------------------------------+\n");
58     return TRUE;
59 }
60 
CmsisThreadCreatFunc(void const * argument)61 static void CmsisThreadCreatFunc(void const *argument)
62 {
63     (void)argument;
64     printf(">> in CmsisThreadCreatFunc\n");
65     g_threadCreateExit = TESTCOUNT_NUM_1;
66     osThreadExit();
67 }
68 
CmsisThreadCreat002Func001(void const * argument)69 static void CmsisThreadCreat002Func001(void const *argument)
70 {
71     (void)argument;
72     g_cmsisTestTaskCount++;
73     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
74     osThreadExit();
75 }
76 
CmsisThreadCreat002Func002(void const * argument)77 static void CmsisThreadCreat002Func002(void const *argument)
78 {
79     (void)argument;
80     g_cmsisTestTaskCount++;
81     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
82     osThreadExit();
83 }
84 
CmsisThreadCreat003Func001(void const * argument)85 static void CmsisThreadCreat003Func001(void const *argument)
86 {
87     (void)argument;
88     TEST_ASSERT_EQUAL_INT(0, g_cmsisTestTaskCount);
89     g_cmsisTestTaskCount++;
90     osDelay(DELAY_TICKS_5);
91     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
92     g_cmsisTestTaskCount++;
93     osThreadExit();
94 }
95 
CmsisThreadCreat003Func002(void const * argument)96 static void CmsisThreadCreat003Func002(void const *argument)
97 {
98     (void)argument;
99     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
100     g_cmsisTestTaskCount++;
101     osDelay(DELAY_TICKS_5);
102     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_4, g_cmsisTestTaskCount);
103     g_cmsisTestTaskCount++;
104     osThreadExit();
105 }
106 
CmsisThreadCreat004Func002(void const * argument)107 static void CmsisThreadCreat004Func002(void const *argument)
108 {
109     (void)argument;
110     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
111     g_cmsisTestTaskCount++;
112     osThreadExit();
113 }
114 
CmsisThreadCreat004Func001(void const * argument)115 static void CmsisThreadCreat004Func001(void const *argument)
116 {
117     (void)argument;
118     osThreadId_t id;
119     osThreadAttr_t attr;
120     attr.name = "test";
121     attr.attr_bits = 0U;
122     attr.cb_mem = NULL;
123     attr.cb_size = 0U;
124     attr.stack_mem = NULL;
125     attr.stack_size = TEST_TASK_STACK_SIZE;
126     attr.priority = osPriorityAboveNormal6;
127     TEST_ASSERT_EQUAL_INT(0, g_cmsisTestTaskCount);
128     g_cmsisTestTaskCount++;
129     id = osThreadNew((osThreadFunc_t)CmsisThreadCreat004Func002, NULL, &attr);
130     TEST_ASSERT_NOT_NULL(id);
131     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
132     g_cmsisTestTaskCount++;
133     osThreadExit();
134 }
135 
KeepRunByTick(UINT32 tick)136 static void KeepRunByTick(UINT32 tick)
137 {
138     UINT32 tickA = osKernelGetTickCount();
139     UINT32 ran = 0;
140     UINT32 loop = 0;
141     UINT32 tickB = 0;
142     while (ran < tick) {
143         loop++;
144         tickB = osKernelGetTickCount();
145         if (tickB >= tickA) {
146             ran = tickB - tickA;
147         } else {
148             ran = tickB + (MAX_UINT32 - tickA);
149         }
150         if (loop % ALIVE_INFO_DIS == 0) {
151             printf("ran:%u, tickB:%u, tickA:%u, loop:%u\t\n",
152                 ran, tickB, tickA, loop);
153         }
154     }
155     printf("return ran:%u, tickB:%u, tickA:%u\t\n",
156         ran, tickB, tickA);
157     return;
158 }
159 
WaitThreadExit(osThreadId_t id,UINT16 const * exitFlag)160 static void WaitThreadExit(osThreadId_t id, UINT16 const *exitFlag)
161 {
162     UINT32 uwRet = osThreadSetPriority(id, osPriorityAboveNormal6);
163     printf("WaitThreadExit id = %d, uwRet = %d\n", id, uwRet);
164     UINT32 loop = 0;
165     while (*exitFlag != TESTCOUNT_NUM_1) {
166         osDelay(DELAY_TICKS_10);
167         if (loop % ALIVE_INFO_DIS == 0) {
168             printf("WaitThreadExit id = %d, loop = %d\n", id, loop++);
169         }
170     }
171     printf("WaitThreadExit exit\n");
172 }
173 
CmsisThreadCreat005Func001(void const * argument)174 static void CmsisThreadCreat005Func001(void const *argument)
175 {
176     (void)argument;
177     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
178     while (g_cmsisTestTaskCount < TESTCOUNT_NUM_2) {
179         KeepRunByTick(DELAY_TICKS_10);
180     }
181     g_cmsisTestTaskCount++;
182     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
183     osThreadExit();
184 }
185 
CmsisThreadGetIDFunc001(void const * argument)186 static void CmsisThreadGetIDFunc001(void const *argument)
187 {
188     (void)argument;
189     g_puwTaskID01 = osThreadGetId();
190     TEST_ASSERT_NOT_NULL(g_puwTaskID01);
191     osThreadExit();
192 }
193 
CmsisThreadGetNameFunc001(void const * argument)194 static void CmsisThreadGetNameFunc001(void const *argument)
195 {
196     (void)argument;
197     osThreadAttr_t attr;
198     printf(">> in CmsisThreadGetNameFunc001\n");
199     g_puwTaskID01 = osThreadGetId();
200     attr.name = osThreadGetName(g_puwTaskID01);
201     TEST_ASSERT_EQUAL_STRING("testThreadGetName", attr.name);
202     g_getNameExit = TESTCOUNT_NUM_1;
203     osThreadExit();
204 }
205 
CmsisThreadGetStateFunc001(void const * argument)206 static void CmsisThreadGetStateFunc001(void const *argument)
207 {
208     (void)argument;
209     osThreadState_t state;
210     state = osThreadGetState(g_puwTaskID01);
211     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
212 
213     g_puwTaskID02 = osThreadGetId();
214     state = osThreadGetState(g_puwTaskID02);
215     TEST_ASSERT_EQUAL_INT(osThreadRunning, state);
216     osThreadExit();
217 }
218 
CmsisThreadGetStateFunc002(void const * argument)219 static void CmsisThreadGetStateFunc002(void const *argument)
220 {
221     (void)argument;
222     osThreadState_t state;
223     state = osThreadGetState(g_puwTaskID01);
224     TEST_ASSERT_EQUAL_INT(osThreadReady, state);
225 
226     g_puwTaskID02 = osThreadGetId();
227     state = osThreadGetState(g_puwTaskID02);
228     TEST_ASSERT_EQUAL_INT(osThreadRunning, state);
229     osThreadExit();
230 }
231 
CmsisThreadSuspendFunc001(void const * argument)232 static void CmsisThreadSuspendFunc001(void const *argument)
233 {
234     (void)argument;
235     osStatus_t uwRet;
236     g_puwTaskID01 = osThreadGetId();
237     uwRet = osThreadSuspend(g_puwTaskID01);
238     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
239     osThreadExit();
240 }
241 
CmsisThreadGetStackSizeFunc001(void const * argument)242 static void CmsisThreadGetStackSizeFunc001(void const *argument)
243 {
244     (void)argument;
245     osThreadAttr_t attr;
246     printf(">> in CmsisThreadGetStackSizeFunc001\n");
247     g_puwTaskID01 = osThreadGetId();
248     attr.stack_size = osThreadGetStackSize(g_puwTaskID01);
249     TEST_ASSERT_EQUAL_INT(TEST_TASK_STACK_SIZE, attr.stack_size);
250     g_getStackSizeExit = TESTCOUNT_NUM_1;
251     osThreadExit();
252 }
253 
CmsisThreadGetStackSpaceFunc001(void const * argument)254 static void CmsisThreadGetStackSpaceFunc001(void const *argument)
255 {
256     (void)argument;
257     UINT32 uwCount;
258     printf(">> in CmsisThreadGetStackSpaceFunc001\n");
259     g_puwTaskID01 =  osThreadGetId();
260     uwCount = osThreadGetStackSpace(g_puwTaskID01);
261     TEST_ASSERT_GREATER_THAN_INT32(0, uwCount);
262     g_getStackSpaceExit = TESTCOUNT_NUM_1;
263     osThreadExit();
264 }
265 
CmsisThreadYieldFunc002(void const * argument)266 static void CmsisThreadYieldFunc002(void const *argument)
267 {
268     (void)argument;
269     osThreadState_t state;
270     state = osThreadGetState(g_puwTaskID01);
271     TEST_ASSERT_EQUAL_INT(osThreadReady, state);
272     g_cmsisTestTaskCount++;
273     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
274     osThreadExit();
275 }
276 
CmsisThreadYieldFunc001(void const * argument)277 static void CmsisThreadYieldFunc001(void const *argument)
278 {
279     (void)argument;
280     osStatus_t uwRet;
281     osThreadId_t id;
282     osThreadState_t state;
283     osThreadAttr_t attr;
284     attr.name = "test";
285     attr.attr_bits = 0U;
286     attr.cb_mem = NULL;
287     attr.cb_size = 0U;
288     attr.stack_mem = NULL;
289     attr.stack_size = TEST_TASK_STACK_SIZE;
290     attr.priority = g_threadPriority;
291     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
292     g_puwTaskID01 =  osThreadGetId();
293     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc002, NULL, &attr);
294     TEST_ASSERT_NOT_NULL(id);
295     state = osThreadGetState(g_puwTaskID01);
296     TEST_ASSERT_EQUAL_INT(osThreadRunning, state);
297     uwRet = osThreadYield();
298     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
299     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
300     osThreadExit();
301 }
302 
CmsisThreadYieldFunc003(void const * argument)303 static void CmsisThreadYieldFunc003(void const *argument)
304 {
305     (void)argument;
306     osStatus_t uwRet;
307     osThreadId_t id;
308     osThreadState_t state;
309     osThreadAttr_t attr;
310     attr.name = "test";
311     attr.attr_bits = 0U;
312     attr.cb_mem = NULL;
313     attr.cb_size = 0U;
314     attr.stack_mem = NULL;
315     attr.stack_size = TEST_TASK_STACK_SIZE;
316     attr.priority = osPriorityNormal7;
317     g_puwTaskID01 =  osThreadGetId();
318     g_threadCreateExit = 0;
319     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
320     TEST_ASSERT_NOT_NULL(id);
321     state = osThreadGetState(g_puwTaskID01);
322     TEST_ASSERT_EQUAL_INT(osThreadRunning, state);
323     uwRet = osThreadYield();
324     WaitThreadExit(id, &g_threadCreateExit);
325     osThreadExit();
326 }
327 
CmsisThreadResumeFunc002(void const * argument)328 static void CmsisThreadResumeFunc002(void const *argument)
329 {
330     (void)argument;
331     osStatus_t uwRet;
332     g_cmsisTestTaskCount++;
333     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
334     uwRet = osThreadResume(g_puwTaskID01);
335     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
336     osDelay(DELAY_TICKS_5);
337     osThreadExit();
338 }
339 
CmsisThreadResumeFunc001(void const * argument)340 static void CmsisThreadResumeFunc001(void const *argument)
341 {
342     (void)argument;
343     osStatus_t uwRet;
344     osThreadId_t id;
345     osThreadAttr_t attr;
346     attr.name = "test";
347     attr.attr_bits = 0U;
348     attr.cb_mem = NULL;
349     attr.cb_size = 0U;
350     attr.stack_mem = NULL;
351     attr.stack_size = TEST_TASK_STACK_SIZE;
352     attr.priority = osPriorityAboveNormal;
353     g_puwTaskID01 = osThreadGetId();
354     id = osThreadNew((osThreadFunc_t)CmsisThreadResumeFunc002, NULL, &attr);
355     TEST_ASSERT_NOT_NULL(id);
356     uwRet = osThreadSuspend(g_puwTaskID01);
357     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
358     g_cmsisTestTaskCount++;
359     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
360     osThreadExit();
361 }
362 
CmsisThreadTerminateFunc001(void const * argument)363 static void CmsisThreadTerminateFunc001(void const *argument)
364 {
365     (void)argument;
366     osStatus_t uwRet;
367     g_puwTaskID01 = osThreadGetId();
368     uwRet = osThreadTerminate(g_puwTaskID01);
369     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
370     g_cmsisTestTaskCount++;
371     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
372     osThreadExit();
373 }
374 
CmsisThreadGetCountFunc002(void const * argument)375 static void CmsisThreadGetCountFunc002(void const *argument)
376 {
377     (void)argument;
378     UINT32 uwRet;
379     uwRet = osThreadGetCount();
380     TEST_ASSERT_GREATER_THAN_INT32(1, uwRet);
381     osThreadExit();
382 }
383 
CmsisThreadGetCountFunc001(void const * argument)384 static void CmsisThreadGetCountFunc001(void const *argument)
385 {
386     (void)argument;
387     osThreadId_t id;
388     osThreadAttr_t attr;
389     attr.name = "test";
390     attr.attr_bits = 0U;
391     attr.cb_mem = NULL;
392     attr.cb_size = 0U;
393     attr.stack_mem = NULL;
394     attr.stack_size = TEST_TASK_STACK_SIZE;
395     attr.priority = osPriorityAboveNormal;
396     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc002, NULL, &attr);
397     TEST_ASSERT_NOT_NULL(id);
398     osThreadExit();
399 }
400 
CmsisThreadGetCountFunc003(void const * argument)401 static void CmsisThreadGetCountFunc003(void const *argument)
402 {
403     (void)argument;
404     UINT32 uwRet;
405     uwRet = osThreadGetCount();
406     TEST_ASSERT_EQUAL_INT(g_threadCount + 1, uwRet);
407     osThreadExit();
408 }
409 
CmsisOSKernelLockFunc002(void const * argument)410 static void CmsisOSKernelLockFunc002(void const *argument)
411 {
412     (void)argument;
413     g_cmsisTestTaskCount++;
414     osThreadExit();
415 }
416 
417 /**
418  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0040
419  * @tc.name      : thread operation for creat fail with invalid parameter
420  * @tc.desc      : [C- SOFTWARE -0200]
421  */
422 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew001, Function | MediumTest | Level1)
423 {
424     osThreadId_t id;
425     osThreadAttr_t attr;
426 
427     attr.name = "test";
428     attr.attr_bits = 0U;
429     attr.cb_mem = NULL;
430     attr.cb_size = 0U;
431     attr.stack_mem = NULL;
432     attr.stack_size = TEST_TASK_STACK_SIZE;
433     attr.priority = osPriorityNormal;
434 
435     osDelay(DELAY_TICKS_5);
436     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, NULL);
437     TEST_ASSERT_NULL(id);
438     id = osThreadNew(NULL, NULL, NULL);
439     TEST_ASSERT_NULL(id);
440     id = osThreadNew(NULL, NULL, &attr);
441     TEST_ASSERT_NULL(id);
442     osDelay(DELAY_TICKS_5);
443 };
444 
445 /**
446  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0080
447  * @tc.name      : thread operation for creat success
448  * @tc.desc      : [C- SOFTWARE -0200]
449  */
450 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew002, Function | MediumTest | Level1)
451 {
452     osThreadId_t id;
453     osThreadAttr_t attr;
454 
455     attr.name = "test";
456     attr.attr_bits = 0U;
457     attr.cb_mem = NULL;
458     attr.cb_size = 0U;
459     attr.stack_mem = NULL;
460     attr.stack_size = TEST_TASK_STACK_SIZE;
461     attr.priority = osPriorityNormal;
462     g_cmsisTestTaskCount = 0;
463     id = osThreadNew((osThreadFunc_t)CmsisThreadCreat002Func001, NULL, &attr);
464     TEST_ASSERT_NOT_NULL(id);
465     TEST_ASSERT_EQUAL_INT(0, g_cmsisTestTaskCount);
466 
467     g_cmsisTestTaskCount++;
468     attr.priority = osPriorityAboveNormal;
469     id = osThreadNew((osThreadFunc_t)CmsisThreadCreat002Func002, NULL, &attr);
470     osDelay(DELAY_TICKS_5);
471     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
472     TEST_ASSERT_NOT_NULL(id);
473 };
474 
475 /**
476  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0120
477  * @tc.name      : thread operation for delay scheduler
478  * @tc.desc      : [C- SOFTWARE -0200]
479  */
480 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew003, Function | MediumTest | Level1)
481 {
482     osThreadId_t id;
483     osThreadAttr_t attr;
484     osThreadAttr_t attr1;
485     g_cmsisTestTaskCount = 0;
486     attr.name = "test";
487     attr.attr_bits = 0U;
488     attr.cb_mem = NULL;
489     attr.cb_size = 0U;
490     attr.stack_mem = NULL;
491     attr.stack_size = TEST_TASK_STACK_SIZE;
492     attr.priority = osPriorityAboveNormal;
493     id = osThreadNew ((osThreadFunc_t)CmsisThreadCreat003Func001, NULL, &attr);
494     TEST_ASSERT_NOT_NULL(id);
495     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
496     g_cmsisTestTaskCount++;
497     attr1.name = "test1";
498     attr1.attr_bits = 0U;
499     attr1.cb_mem = NULL;
500     attr1.cb_size = 0U;
501     attr1.stack_mem = NULL;
502     attr1.stack_size = TEST_TASK_STACK_SIZE;
503     attr1.priority = osPriorityAboveNormal;
504     id = osThreadNew ((osThreadFunc_t)CmsisThreadCreat003Func002, NULL, &attr1);
505     TEST_ASSERT_NOT_NULL(id);
506     osDelay(DELAY_TICKS_5);
507     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_5, g_cmsisTestTaskCount);
508 };
509 
510 /**
511  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0160
512  * @tc.name      : thread operation for nesting schedule
513  * @tc.desc      : [C- SOFTWARE -0200]
514  */
515 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew004, Function | MediumTest | Level1)
516 {
517     osThreadId_t id;
518     osThreadAttr_t attr;
519     attr.name = "test";
520     attr.attr_bits = 0U;
521     attr.cb_mem = NULL;
522     attr.cb_size = 0U;
523     attr.stack_mem = NULL;
524     attr.stack_size = TEST_TASK_STACK_SIZE;
525     g_cmsisTestTaskCount = 0;
526     attr.priority = osPriorityAboveNormal;
527     id = osThreadNew((osThreadFunc_t)CmsisThreadCreat004Func001, NULL, &attr);
528     TEST_ASSERT_NOT_NULL(id);
529     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
530     osDelay(DELAY_TICKS_5);
531 };
532 
533 /**
534  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0200
535  * @tc.name      : thread operation for cycle schedule
536  * @tc.desc      : [C- SOFTWARE -0200]
537  */
538 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew005, Function | MediumTest | Level1)
539 {
540     osThreadId_t id;
541     osThreadAttr_t attr;
542     attr.name = "test";
543     attr.attr_bits = 0U;
544     attr.cb_mem = NULL;
545     attr.cb_size = 0U;
546     attr.stack_mem = NULL;
547     attr.stack_size = TEST_TASK_STACK_SIZE;
548     attr.priority = osPriorityNormal;
549     g_cmsisTestTaskCount = 0;
550     g_cmsisTestTaskCount++;
551     id = osThreadNew((osThreadFunc_t)CmsisThreadCreat005Func001, NULL, &attr);
552     TEST_ASSERT_NOT_NULL(id);
553     osDelay(DELAY_TICKS_1);
554     g_cmsisTestTaskCount++;
555     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
556     osDelay(DELAY_TICKS_5);
557     while (g_cmsisTestTaskCount != TESTCOUNT_NUM_3) {
558         KeepRunByTick(DELAY_TICKS_10);
559     }
560 };
561 
562 /**
563  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0240
564  * @tc.name      : thread operation for creat fail when priority = osPriorityNone
565  * @tc.desc      : [C- SOFTWARE -0200]
566  */
567 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew006, Function | MediumTest | Level1)
568 {
569     osThreadId_t id;
570     osThreadAttr_t attr;
571 
572     attr.name = "test";
573     attr.attr_bits = 0U;
574     attr.cb_mem = NULL;
575     attr.cb_size = 0U;
576     attr.stack_mem = NULL;
577     attr.stack_size = TEST_TASK_STACK_SIZE;
578     attr.priority = osPriorityNone;
579     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
580     TEST_ASSERT_NULL(id);
581 };
582 
583 /**
584  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0280
585  * @tc.name      : thread operation for creat fail when priority = osPriorityIdle
586  * @tc.desc      : [C- SOFTWARE -0200]
587  */
588 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew007, Function | MediumTest | Level1)
589 {
590     osThreadId_t id;
591     osThreadAttr_t attr;
592 
593     attr.name = "test";
594     attr.attr_bits = 0U;
595     attr.cb_mem = NULL;
596     attr.cb_size = 0U;
597     attr.stack_mem = NULL;
598     attr.stack_size = TEST_TASK_STACK_SIZE;
599     attr.priority = osPriorityIdle;
600     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
601     TEST_ASSERT_NULL(id);
602 };
603 
604 /**
605  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0320
606  * @tc.name      : thread operation for creat fail when priority = osPriorityLow
607  * @tc.desc      : [C- SOFTWARE -0200]
608  */
609 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew008, Function | MediumTest | Level1)
610 {
611     osThreadId_t id;
612     osThreadAttr_t attr;
613 
614     attr.name = "test";
615     attr.attr_bits = 0U;
616     attr.cb_mem = NULL;
617     attr.cb_size = 0U;
618     attr.stack_mem = NULL;
619     attr.stack_size = TEST_TASK_STACK_SIZE;
620     attr.priority = osPriorityLow;
621     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
622     TEST_ASSERT_NULL(id);
623 };
624 
625 /**
626  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0360
627  * @tc.name      : thread operation for creat success when priority = osPriorityLow1
628  * @tc.desc      : [C- SOFTWARE -0200]
629  */
630 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew009, Function | MediumTest | Level1)
631 {
632     osThreadId_t id;
633     osThreadAttr_t attr;
634 
635     attr.name = "test";
636     attr.attr_bits = 0U;
637     attr.cb_mem = NULL;
638     attr.cb_size = 0U;
639     attr.stack_mem = NULL;
640     attr.stack_size = TEST_TASK_STACK_SIZE;
641     attr.priority = osPriorityLow1;
642     g_threadCreateExit = 0;
643     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
644     TEST_ASSERT_NOT_NULL(id);
645     WaitThreadExit(id, &g_threadCreateExit);
646 };
647 
648 /**
649  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0400
650  * @tc.name      : thread operation for creat success when priority = osPriorityLow7
651  * @tc.desc      : [C- SOFTWARE -0200]
652  */
653 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew010, Function | MediumTest | Level1)
654 {
655     osThreadId_t id;
656     osThreadAttr_t attr;
657 
658     attr.name = "test";
659     attr.attr_bits = 0U;
660     attr.cb_mem = NULL;
661     attr.cb_size = 0U;
662     attr.stack_mem = NULL;
663     attr.stack_size = TEST_TASK_STACK_SIZE;
664     attr.priority = osPriorityLow7;
665     g_threadCreateExit = 0;
666     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
667     TEST_ASSERT_NOT_NULL(id);
668     WaitThreadExit(id, &g_threadCreateExit);
669 };
670 
671 /**
672  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0440
673  * @tc.name      : thread operation for creat success when priority = osPriorityBelowNormal
674  * @tc.desc      : [C- SOFTWARE -0200]
675  */
676 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew011, Function | MediumTest | Level1)
677 {
678     osThreadId_t id;
679     osThreadAttr_t attr;
680 
681     attr.name = "test";
682     attr.attr_bits = 0U;
683     attr.cb_mem = NULL;
684     attr.cb_size = 0U;
685     attr.stack_mem = NULL;
686     attr.stack_size = TEST_TASK_STACK_SIZE;
687     attr.priority = osPriorityBelowNormal;
688     g_threadCreateExit = 0;
689     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
690     TEST_ASSERT_NOT_NULL(id);
691     WaitThreadExit(id, &g_threadCreateExit);
692 };
693 
694 /**
695  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0480
696  * @tc.name      : thread operation for creat success when priority = osPriorityBelowNormal7
697  * @tc.desc      : [C- SOFTWARE -0200]
698  */
699 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew012, Function | MediumTest | Level1)
700 {
701     osThreadId_t id;
702     osThreadAttr_t attr;
703 
704     attr.name = "test";
705     attr.attr_bits = 0U;
706     attr.cb_mem = NULL;
707     attr.cb_size = 0U;
708     attr.stack_mem = NULL;
709     attr.stack_size = TEST_TASK_STACK_SIZE;
710     attr.priority = osPriorityBelowNormal7;
711     g_threadCreateExit = 0;
712     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
713     TEST_ASSERT_NOT_NULL(id);
714     WaitThreadExit(id, &g_threadCreateExit);
715 };
716 
717 /**
718  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0520
719  * @tc.name      : thread operation for creat success when priority = osPriorityNormal
720  * @tc.desc      : [C- SOFTWARE -0200]
721  */
722 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew013, Function | MediumTest | Level1)
723 {
724     osThreadId_t id;
725     osThreadAttr_t attr;
726 
727     attr.name = "test";
728     attr.attr_bits = 0U;
729     attr.cb_mem = NULL;
730     attr.cb_size = 0U;
731     attr.stack_mem = NULL;
732     attr.stack_size = TEST_TASK_STACK_SIZE;
733     attr.priority = osPriorityNormal;
734     g_threadCreateExit = 0;
735     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
736     TEST_ASSERT_NOT_NULL(id);
737     WaitThreadExit(id, &g_threadCreateExit);
738 };
739 
740 /**
741  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0560
742  * @tc.name      : thread operation for creat success when priority = osPriorityNormal7
743  * @tc.desc      : [C- SOFTWARE -0200]
744  */
745 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew014, Function | MediumTest | Level1)
746 {
747     osThreadId_t id;
748     osThreadAttr_t attr;
749 
750     attr.name = "test";
751     attr.attr_bits = 0U;
752     attr.cb_mem = NULL;
753     attr.cb_size = 0U;
754     attr.stack_mem = NULL;
755     attr.stack_size = TEST_TASK_STACK_SIZE;
756     attr.priority = osPriorityNormal7;
757     g_threadCreateExit = 0;
758     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
759     TEST_ASSERT_NOT_NULL(id);
760     WaitThreadExit(id, &g_threadCreateExit);
761 };
762 
763 /**
764  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0600
765  * @tc.name      : thread operation for creat success when priority = osPriorityAboveNormal
766  * @tc.desc      : [C- SOFTWARE -0200]
767  */
768 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew015, Function | MediumTest | Level1)
769 {
770     osThreadId_t id;
771     osThreadAttr_t attr;
772 
773     attr.name = "test";
774     attr.attr_bits = 0U;
775     attr.cb_mem = NULL;
776     attr.cb_size = 0U;
777     attr.stack_mem = NULL;
778     attr.stack_size = TEST_TASK_STACK_SIZE;
779     attr.priority = osPriorityAboveNormal;
780     g_threadCreateExit = 0;
781     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
782     TEST_ASSERT_NOT_NULL(id);
783     WaitThreadExit(id, &g_threadCreateExit);
784 };
785 
786 /**
787  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0640
788  * @tc.name      : thread operation for creat success when priority = osPriorityAboveNormal6
789  * @tc.desc      : [C- SOFTWARE -0200]
790  */
791 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew016, Function | MediumTest | Level1)
792 {
793     osThreadId_t id;
794     osThreadAttr_t attr;
795 
796     attr.name = "test";
797     attr.attr_bits = 0U;
798     attr.cb_mem = NULL;
799     attr.cb_size = 0U;
800     attr.stack_mem = NULL;
801     attr.stack_size = TEST_TASK_STACK_SIZE;
802     attr.priority = osPriorityAboveNormal6;
803     g_threadCreateExit = 0;
804     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
805     TEST_ASSERT_NOT_NULL(id);
806     WaitThreadExit(id, &g_threadCreateExit);
807 };
808 
809 /**
810  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0680
811  * @tc.name      : thread operation for creat fail when priority = osPriorityAboveNormal7
812  * @tc.desc      : [C- SOFTWARE -0200]
813  */
814 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew017, Function | MediumTest | Level1)
815 {
816     osThreadId_t id;
817     osThreadAttr_t attr;
818 
819     attr.name = "test";
820     attr.attr_bits = 0U;
821     attr.cb_mem = NULL;
822     attr.cb_size = 0U;
823     attr.stack_mem = NULL;
824     attr.stack_size = TEST_TASK_STACK_SIZE;
825     attr.priority = osPriorityAboveNormal7;
826     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
827     TEST_ASSERT_NULL(id);
828 };
829 
830 /**
831  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0720
832  * @tc.name      : thread operation for creat fail when priority = osPriorityHigh
833  * @tc.desc      : [C- SOFTWARE -0200]
834  */
835 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew018, Function | MediumTest | Level1)
836 {
837     osThreadId_t id;
838     osThreadAttr_t attr;
839 
840     attr.name = "test";
841     attr.attr_bits = 0U;
842     attr.cb_mem = NULL;
843     attr.cb_size = 0U;
844     attr.stack_mem = NULL;
845     attr.stack_size = TEST_TASK_STACK_SIZE;
846     attr.priority = osPriorityHigh;
847     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
848     TEST_ASSERT_NULL(id);
849 };
850 
851 /**
852  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0760
853  * @tc.name      : thread operation for creat fail when priority = osPriorityHigh7
854  * @tc.desc      : [C- SOFTWARE -0200]
855  */
856 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew019, Function | MediumTest | Level1)
857 {
858     osThreadId_t id;
859     osThreadAttr_t attr;
860 
861     attr.name = "test";
862     attr.attr_bits = 0U;
863     attr.cb_mem = NULL;
864     attr.cb_size = 0U;
865     attr.stack_mem = NULL;
866     attr.stack_size = TEST_TASK_STACK_SIZE;
867     attr.priority = osPriorityHigh7;
868     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
869     TEST_ASSERT_NULL(id);
870 };
871 
872 /**
873  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0800
874  * @tc.name      : thread operation for creat fail when priority = osPriorityRealtime
875  * @tc.desc      : [C- SOFTWARE -0200]
876  */
877 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew020, Function | MediumTest | Level1)
878 {
879     osThreadId_t id;
880     osThreadAttr_t attr;
881 
882     attr.name = "test";
883     attr.attr_bits = 0U;
884     attr.cb_mem = NULL;
885     attr.cb_size = 0U;
886     attr.stack_mem = NULL;
887     attr.stack_size = TEST_TASK_STACK_SIZE;
888     attr.priority = osPriorityRealtime;
889 
890     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
891     TEST_ASSERT_NULL(id);
892 };
893 
894 /**
895  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0840
896  * @tc.name      : thread operation for creat fail when priority = osPriorityRealtime7
897  * @tc.desc      : [C- SOFTWARE -0200]
898  */
899 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew021, Function | MediumTest | Level1)
900 {
901     osThreadId_t id;
902     osThreadAttr_t attr;
903 
904     attr.name = "test";
905     attr.attr_bits = 0U;
906     attr.cb_mem = NULL;
907     attr.cb_size = 0U;
908     attr.stack_mem = NULL;
909     attr.stack_size = TEST_TASK_STACK_SIZE;
910     attr.priority = osPriorityRealtime7;
911 
912     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
913     TEST_ASSERT_NULL(id);
914 };
915 
916 /**
917  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0880
918  * @tc.name      : thread operation for creat fail when priority = osPriorityISR
919  * @tc.desc      : [C- SOFTWARE -0200]
920  */
921 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew022, Function | MediumTest | Level1)
922 {
923     osThreadId_t id;
924     osThreadAttr_t attr;
925 
926     attr.name = "test";
927     attr.attr_bits = 0U;
928     attr.cb_mem = NULL;
929     attr.cb_size = 0U;
930     attr.stack_mem = NULL;
931     attr.stack_size = TEST_TASK_STACK_SIZE;
932     attr.priority = osPriorityISR;
933 
934     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
935     TEST_ASSERT_NULL(id);
936 };
937 
938 /**
939  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0920
940  * @tc.name      : thread operation for creat fail when priority = osPriorityError
941  * @tc.desc      : [C- SOFTWARE -0200]
942  */
943 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew023, Function | MediumTest | Level1)
944 {
945     osThreadId_t id;
946     osThreadAttr_t attr;
947 
948     attr.name = "test";
949     attr.attr_bits = 0U;
950     attr.cb_mem = NULL;
951     attr.cb_size = 0U;
952     attr.stack_mem = NULL;
953     attr.stack_size = TEST_TASK_STACK_SIZE;
954     attr.priority = osPriorityError;
955 
956     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
957     TEST_ASSERT_NULL(id);
958 };
959 
960 /**
961  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_0960
962  * @tc.name      : thread operation for creat fail when priority = osPriorityReserved
963  * @tc.desc      : [C- SOFTWARE -0200]
964  */
965 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew024, Function | MediumTest | Level1)
966 {
967     osThreadId_t id;
968     osThreadAttr_t attr;
969 
970     attr.name = "test";
971     attr.attr_bits = 0U;
972     attr.cb_mem = NULL;
973     attr.cb_size = 0U;
974     attr.stack_mem = NULL;
975     attr.stack_size = TEST_TASK_STACK_SIZE;
976     attr.priority = osPriorityReserved;
977 
978     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, &attr);
979     TEST_ASSERT_NULL(id);
980 };
981 
982 /**
983  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1000
984  * @tc.name      : thread creat operation with func = NULL
985  * @tc.desc      : [C- SOFTWARE -0200]
986  */
987 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew025, Function | MediumTest | Level1)
988 {
989     osThreadId_t id;
990     osThreadAttr_t attr;
991 
992     attr.name = "test";
993     attr.attr_bits = 0U;
994     attr.cb_mem = NULL;
995     attr.cb_size = 0U;
996     attr.stack_mem = NULL;
997     attr.stack_size = TEST_TASK_STACK_SIZE;
998     attr.priority = osPriorityNormal;
999 
1000     id = osThreadNew(NULL, NULL, &attr);
1001     TEST_ASSERT_NULL(id);
1002 };
1003 
1004 /**
1005  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1040
1006  * @tc.name      : thread creat operation with attr = NULL
1007  * @tc.desc      : [C- SOFTWARE -0200]
1008  */
1009 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew026, Function | MediumTest | Level1)
1010 {
1011     osThreadId_t id;
1012 
1013     id = osThreadNew((osThreadFunc_t)CmsisThreadCreatFunc, NULL, NULL);
1014     TEST_ASSERT_NULL(id);
1015 };
1016 
1017 /**
1018  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1080
1019  * @tc.name      : thread operation for get name when priority = osPriorityNormal
1020  * @tc.desc      : [C- SOFTWARE -0200]
1021  */
1022 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName001, Function | MediumTest | Level1)
1023 {
1024     osThreadId_t id;
1025     osThreadAttr_t attr;
1026     attr.name = "testThreadGetName";
1027     attr.attr_bits = 0U;
1028     attr.cb_mem = NULL;
1029     attr.cb_size = 0U;
1030     attr.stack_mem = NULL;
1031     attr.stack_size = TEST_TASK_STACK_SIZE;
1032     attr.priority = osPriorityNormal;
1033 
1034     g_cmsisTestTaskCount = 0;
1035     g_getNameExit = 0;
1036     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1037     TEST_ASSERT_NOT_NULL(id);
1038     osDelay(DELAY_TICKS_5);
1039     WaitThreadExit(id, &g_getNameExit);
1040 };
1041 
1042 /**
1043  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1120
1044  * @tc.name      : thread operation for get state when priority = osPriorityAboveNormal
1045  * @tc.desc      : [C- SOFTWARE -0200]
1046  */
1047 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState001, Function | MediumTest | Level1)
1048 {
1049     osThreadId_t id;
1050     osThreadAttr_t attr;
1051     attr.name = "test";
1052     attr.attr_bits = 0U;
1053     attr.cb_mem = NULL;
1054     attr.cb_size = 0U;
1055     attr.stack_mem = NULL;
1056     attr.stack_size = TEST_TASK_STACK_SIZE;
1057     attr.priority = osPriorityAboveNormal;
1058     g_puwTaskID01 = osThreadGetId();
1059     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc002, NULL, &attr);
1060     TEST_ASSERT_NOT_NULL(id);
1061     osDelay(DELAY_TICKS_5);
1062 };
1063 
1064 /**
1065  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1160
1066  * @tc.name      : thread operation for suspend when priority = osPriorityLow1
1067  * @tc.desc      : [C- SOFTWARE -0200]
1068  */
1069 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend001, Function | MediumTest | Level1)
1070 {
1071     osThreadId_t id;
1072     osStatus_t uwRet;
1073     osThreadAttr_t attr;
1074     osThreadState_t state;
1075     g_cmsisTestTaskCount = 0;
1076     attr.name = "test";
1077     attr.attr_bits = 0U;
1078     attr.cb_mem = NULL;
1079     attr.cb_size = 0U;
1080     attr.stack_mem = NULL;
1081     attr.stack_size = TEST_TASK_STACK_SIZE;
1082     attr.priority = osPriorityLow1;
1083     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
1084     TEST_ASSERT_NOT_NULL(id);
1085     osDelay(DELAY_TICKS_5);
1086     state = osThreadGetState(g_puwTaskID01);
1087     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
1088     uwRet = osThreadResume(g_puwTaskID01);
1089     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
1090 };
1091 
1092 /**
1093  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1200
1094  * @tc.name      : thread operation for get current ID
1095  * @tc.desc      : [C- SOFTWARE -0200]
1096  */
1097 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId001, Function | MediumTest | Level1)
1098 {
1099     g_puwTaskID01 = osThreadGetId();
1100     TEST_ASSERT_NOT_NULL(g_puwTaskID01);
1101     osDelay(DELAY_TICKS_5);
1102 };
1103 
1104 /**
1105  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1240
1106  * @tc.name      : thread operation for get ID when priority = osPriorityLow1
1107  * @tc.desc      : [C- SOFTWARE -0200]
1108  */
1109 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId002, Function | MediumTest | Level1)
1110 {
1111     osThreadId_t id;
1112     osThreadAttr_t attr;
1113 
1114     attr.name = "test";
1115     attr.attr_bits = 0U;
1116     attr.cb_mem = NULL;
1117     attr.cb_size = 0U;
1118     attr.stack_mem = NULL;
1119     attr.stack_size = TEST_TASK_STACK_SIZE;
1120     attr.priority = osPriorityLow1;
1121 
1122     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1123     TEST_ASSERT_NOT_NULL(id);
1124     osDelay(DELAY_TICKS_5);
1125     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1126 };
1127 
1128 /**
1129  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1280
1130  * @tc.name      : thread operation for get ID when priority = osPriorityLow7
1131  * @tc.desc      : [C- SOFTWARE -0200]
1132  */
1133 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId003, Function | MediumTest | Level1)
1134 {
1135     osThreadId_t id;
1136     osThreadAttr_t attr;
1137 
1138     attr.name = "test";
1139     attr.attr_bits = 0U;
1140     attr.cb_mem = NULL;
1141     attr.cb_size = 0U;
1142     attr.stack_mem = NULL;
1143     attr.stack_size = TEST_TASK_STACK_SIZE;
1144     attr.priority = osPriorityLow7;
1145 
1146     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1147     TEST_ASSERT_NOT_NULL(id);
1148     osDelay(DELAY_TICKS_5);
1149     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1150 };
1151 
1152 /**
1153  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1320
1154  * @tc.name      : thread operation for get ID when priority = osPriorityBelowNormal
1155  * @tc.desc      : [C- SOFTWARE -0200]
1156  */
1157 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId004, Function | MediumTest | Level1)
1158 {
1159     osThreadId_t id;
1160     osThreadAttr_t attr;
1161 
1162     attr.name = "test";
1163     attr.attr_bits = 0U;
1164     attr.cb_mem = NULL;
1165     attr.cb_size = 0U;
1166     attr.stack_mem = NULL;
1167     attr.stack_size = TEST_TASK_STACK_SIZE;
1168     attr.priority = osPriorityBelowNormal;
1169 
1170     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1171     TEST_ASSERT_NOT_NULL(id);
1172     osDelay(DELAY_TICKS_5);
1173     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1174 };
1175 
1176 /**
1177  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1360
1178  * @tc.name      : thread operation for get ID when priority = osPriorityBelowNormal7
1179  * @tc.desc      : [C- SOFTWARE -0200]
1180  */
1181 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId005, Function | MediumTest | Level1)
1182 {
1183     osThreadId_t id;
1184     osThreadAttr_t attr;
1185 
1186     attr.name = "test";
1187     attr.attr_bits = 0U;
1188     attr.cb_mem = NULL;
1189     attr.cb_size = 0U;
1190     attr.stack_mem = NULL;
1191     attr.stack_size = TEST_TASK_STACK_SIZE;
1192     attr.priority = osPriorityBelowNormal7;
1193 
1194     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1195     TEST_ASSERT_NOT_NULL(id);
1196     osDelay(DELAY_TICKS_5);
1197     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1198 };
1199 
1200 /**
1201  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1400
1202  * @tc.name      : thread operation for get ID when priority = osPriorityNormal
1203  * @tc.desc      : [C- SOFTWARE -0200]
1204  */
1205 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId006, Function | MediumTest | Level1)
1206 {
1207     osThreadId_t id;
1208     osThreadAttr_t attr;
1209 
1210     attr.name = "test";
1211     attr.attr_bits = 0U;
1212     attr.cb_mem = NULL;
1213     attr.cb_size = 0U;
1214     attr.stack_mem = NULL;
1215     attr.stack_size = TEST_TASK_STACK_SIZE;
1216     attr.priority = osPriorityNormal;
1217 
1218     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1219     TEST_ASSERT_NOT_NULL(id);
1220     osDelay(DELAY_TICKS_5);
1221     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1222 };
1223 
1224 /**
1225  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1440
1226  * @tc.name      : thread operation for get ID when priority = osPriorityNormal7
1227  * @tc.desc      : [C- SOFTWARE -0200]
1228  */
1229 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId007, Function | MediumTest | Level1)
1230 {
1231     osThreadId_t id;
1232     osThreadAttr_t attr;
1233 
1234     attr.name = "test";
1235     attr.attr_bits = 0U;
1236     attr.cb_mem = NULL;
1237     attr.cb_size = 0U;
1238     attr.stack_mem = NULL;
1239     attr.stack_size = TEST_TASK_STACK_SIZE;
1240     attr.priority = osPriorityNormal7;
1241 
1242     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1243     TEST_ASSERT_NOT_NULL(id);
1244     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1245 };
1246 
1247 /**
1248  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1480
1249  * @tc.name      : thread operation for get ID when priority = osPriorityAboveNormal
1250  * @tc.desc      : [C- SOFTWARE -0200]
1251  */
1252 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId008, Function | MediumTest | Level1)
1253 {
1254     osThreadId_t id;
1255     osThreadAttr_t attr;
1256 
1257     attr.name = "test";
1258     attr.attr_bits = 0U;
1259     attr.cb_mem = NULL;
1260     attr.cb_size = 0U;
1261     attr.stack_mem = NULL;
1262     attr.stack_size = TEST_TASK_STACK_SIZE;
1263     attr.priority = osPriorityAboveNormal;
1264 
1265     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1266     TEST_ASSERT_NOT_NULL(id);
1267     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1268 };
1269 
1270 /**
1271  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1520
1272  * @tc.name      : thread operation for get ID when priority = osPriorityAboveNormal6
1273  * @tc.desc      : [C- SOFTWARE -0200]
1274  */
1275 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId009, Function | MediumTest | Level1)
1276 {
1277     osThreadId_t id;
1278     osThreadAttr_t attr;
1279 
1280     attr.name = "test";
1281     attr.attr_bits = 0U;
1282     attr.cb_mem = NULL;
1283     attr.cb_size = 0U;
1284     attr.stack_mem = NULL;
1285     attr.stack_size = TEST_TASK_STACK_SIZE;
1286     attr.priority = osPriorityAboveNormal6;
1287 
1288     id = osThreadNew((osThreadFunc_t)CmsisThreadGetIDFunc001, NULL, &attr);
1289     TEST_ASSERT_NOT_NULL(id);
1290     TEST_ASSERT_EQUAL_INT((uintptr_t)id, (uintptr_t)g_puwTaskID01);
1291 };
1292 
1293 /**
1294  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1560
1295  * @tc.name      : thread operation for get ID then exit thread
1296  * @tc.desc      : [C- SOFTWARE -0200]
1297  */
1298 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetId010, Function | MediumTest | Level1)
1299 {
1300     g_puwTaskID01 = osThreadGetId();
1301     TEST_ASSERT_NOT_NULL(g_puwTaskID01);
1302 };
1303 
1304 /**
1305  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1600
1306  * @tc.name      : thread operation for get stack size when priority = osPriorityAboveNormal6
1307  * @tc.desc      : [C- SOFTWARE -0200]
1308  */
1309 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize001, Function | MediumTest | Level1)
1310 {
1311     osThreadId_t id;
1312     osThreadAttr_t attr;
1313     g_cmsisTestTaskCount = 0;
1314     g_puwTaskID01 = 0;
1315 
1316     attr.name = "test";
1317     attr.attr_bits = 0U;
1318     attr.cb_mem = NULL;
1319     attr.cb_size = 0U;
1320     attr.stack_mem = NULL;
1321     attr.stack_size = TEST_TASK_STACK_SIZE;
1322     attr.priority = osPriorityAboveNormal6;
1323     g_getStackSizeExit = 0;
1324     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
1325     TEST_ASSERT_NOT_NULL(id);
1326     WaitThreadExit(id, &g_getStackSizeExit);
1327 };
1328 
1329 /**
1330  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1640
1331  * @tc.name      : thread operation for get stack space
1332  * @tc.desc      : [C- SOFTWARE -0200]
1333  */
1334 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace001, Function | MediumTest | Level1)
1335 {
1336     UINT32 uwCount;
1337     g_cmsisTestTaskCount = 0;
1338     g_puwTaskID01 =  osThreadGetId();
1339     uwCount = osThreadGetStackSpace(g_puwTaskID01);
1340     TEST_ASSERT_GREATER_THAN_INT32(0, uwCount);
1341 };
1342 
1343 /**
1344  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1680
1345  * @tc.name      : thread operation for yield when priority = osPriorityLow1
1346  * @tc.desc      : [C- SOFTWARE -0200]
1347  */
1348 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield001, Function | MediumTest | Level1)
1349 {
1350     osThreadId_t id;
1351     osThreadAttr_t attr;
1352     g_threadPriority = osPriorityLow1;
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 = g_threadPriority;
1360     g_cmsisTestTaskCount = 0;
1361     g_cmsisTestTaskCount++;
1362     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1363     osDelay(DELAY_TICKS_5);
1364     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1365     TEST_ASSERT_NOT_NULL(id);
1366 };
1367 
1368 /**
1369  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1720
1370  * @tc.name      : thread operation for yield when priority = osPriorityLow7
1371  * @tc.desc      : [C- SOFTWARE -0200]
1372  */
1373 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield002, Function | MediumTest | Level1)
1374 {
1375     osThreadId_t id;
1376     osThreadAttr_t attr;
1377     g_threadPriority = osPriorityLow7;
1378     attr.name = "test";
1379     attr.attr_bits = 0U;
1380     attr.cb_mem = NULL;
1381     attr.cb_size = 0U;
1382     attr.stack_mem = NULL;
1383     attr.stack_size = TEST_TASK_STACK_SIZE;
1384     attr.priority = g_threadPriority;
1385     g_cmsisTestTaskCount = 0;
1386     g_cmsisTestTaskCount++;
1387     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1388     osDelay(DELAY_TICKS_5);
1389     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1390     TEST_ASSERT_NOT_NULL(id);
1391 };
1392 
1393 /**
1394  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1760
1395  * @tc.name      : thread operation for yield when priority = osPriorityBelowNormal
1396  * @tc.desc      : [C- SOFTWARE -0200]
1397  */
1398 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield003, Function | MediumTest | Level1)
1399 {
1400     osThreadId_t id;
1401     osThreadAttr_t attr;
1402     g_threadPriority = osPriorityBelowNormal;
1403     attr.name = "test";
1404     attr.attr_bits = 0U;
1405     attr.cb_mem = NULL;
1406     attr.cb_size = 0U;
1407     attr.stack_mem = NULL;
1408     attr.stack_size = TEST_TASK_STACK_SIZE;
1409     attr.priority = g_threadPriority;
1410     g_cmsisTestTaskCount = 0;
1411     g_cmsisTestTaskCount++;
1412     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1413     osDelay(DELAY_TICKS_5);
1414     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1415     TEST_ASSERT_NOT_NULL(id);
1416 };
1417 
1418 /**
1419  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1800
1420  * @tc.name      : thread operation for yield when priority = osPriorityBelowNormal7
1421  * @tc.desc      : [C- SOFTWARE -0200]
1422  */
1423 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield004, Function | MediumTest | Level1)
1424 {
1425     osThreadId_t id;
1426     osThreadAttr_t attr;
1427     g_threadPriority = osPriorityBelowNormal7;
1428     attr.name = "test";
1429     attr.attr_bits = 0U;
1430     attr.cb_mem = NULL;
1431     attr.cb_size = 0U;
1432     attr.stack_mem = NULL;
1433     attr.stack_size = TEST_TASK_STACK_SIZE;
1434     attr.priority = g_threadPriority;
1435     g_cmsisTestTaskCount = 0;
1436     g_cmsisTestTaskCount++;
1437     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1438     osDelay(DELAY_TICKS_5);
1439     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1440     TEST_ASSERT_NOT_NULL(id);
1441 };
1442 
1443 /**
1444  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1840
1445  * @tc.name      : thread operation for yield when priority = osPriorityNormal
1446  * @tc.desc      : [C- SOFTWARE -0200]
1447  */
1448 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield005, Function | MediumTest | Level1)
1449 {
1450     osThreadId_t id;
1451     osThreadAttr_t attr;
1452     g_threadPriority = osPriorityNormal;
1453     attr.name = "test";
1454     attr.attr_bits = 0U;
1455     attr.cb_mem = NULL;
1456     attr.cb_size = 0U;
1457     attr.stack_mem = NULL;
1458     attr.stack_size = TEST_TASK_STACK_SIZE;
1459     attr.priority = g_threadPriority;
1460     g_cmsisTestTaskCount = 0;
1461     g_cmsisTestTaskCount++;
1462     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1463     osDelay(DELAY_TICKS_5);
1464     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1465     TEST_ASSERT_NOT_NULL(id);
1466 };
1467 
1468 /**
1469  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1880
1470  * @tc.name      : thread operation for yield when priority = osPriorityNormal7
1471  * @tc.desc      : [C- SOFTWARE -0200]
1472  */
1473 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield006, Function | MediumTest | Level1)
1474 {
1475     osThreadId_t id;
1476     osThreadAttr_t attr;
1477     g_threadPriority = osPriorityNormal7;
1478     attr.name = "test";
1479     attr.attr_bits = 0U;
1480     attr.cb_mem = NULL;
1481     attr.cb_size = 0U;
1482     attr.stack_mem = NULL;
1483     attr.stack_size = TEST_TASK_STACK_SIZE;
1484     attr.priority = g_threadPriority;
1485     g_cmsisTestTaskCount = 0;
1486     g_cmsisTestTaskCount++;
1487     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1488     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1489     TEST_ASSERT_NOT_NULL(id);
1490 };
1491 
1492 /**
1493  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1920
1494  * @tc.name      : thread operation for yield when priority = osPriorityAboveNormal
1495  * @tc.desc      : [C- SOFTWARE -0200]
1496  */
1497 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield007, Function | MediumTest | Level1)
1498 {
1499     osThreadId_t id;
1500     osThreadAttr_t attr;
1501     g_threadPriority = osPriorityAboveNormal;
1502     attr.name = "test";
1503     attr.attr_bits = 0U;
1504     attr.cb_mem = NULL;
1505     attr.cb_size = 0U;
1506     attr.stack_mem = NULL;
1507     attr.stack_size = TEST_TASK_STACK_SIZE;
1508     attr.priority = g_threadPriority;
1509     g_cmsisTestTaskCount = 0;
1510     g_cmsisTestTaskCount++;
1511     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1512     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1513     TEST_ASSERT_NOT_NULL(id);
1514 };
1515 
1516 /**
1517  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_1960
1518  * @tc.name      : thread operation for yield when priority = osPriorityAboveNormal6
1519  * @tc.desc      : [C- SOFTWARE -0200]
1520  */
1521 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield008, Function | MediumTest | Level1)
1522 {
1523     osThreadId_t id;
1524     osThreadAttr_t attr;
1525     g_threadPriority = osPriorityAboveNormal6;
1526     attr.name = "test";
1527     attr.attr_bits = 0U;
1528     attr.cb_mem = NULL;
1529     attr.cb_size = 0U;
1530     attr.stack_mem = NULL;
1531     attr.stack_size = TEST_TASK_STACK_SIZE;
1532     attr.priority = g_threadPriority;
1533     g_cmsisTestTaskCount = 0;
1534     g_cmsisTestTaskCount++;
1535     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc001, NULL, &attr);
1536     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
1537     TEST_ASSERT_NOT_NULL(id);
1538 };
1539 
1540 /**
1541  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2000
1542  * @tc.name      : thread yield operation for thread with different priority
1543  * @tc.desc      : [C- SOFTWARE -0200]
1544  */
1545 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadYield009, Function | MediumTest | Level1)
1546 {
1547     osThreadId_t id;
1548     osThreadAttr_t attr;
1549     attr.name = "test";
1550     attr.attr_bits = 0U;
1551     attr.cb_mem = NULL;
1552     attr.cb_size = 0U;
1553     attr.stack_mem = NULL;
1554     attr.stack_size = TEST_TASK_STACK_SIZE;
1555     attr.priority = osPriorityAboveNormal;
1556     id = osThreadNew((osThreadFunc_t)CmsisThreadYieldFunc003, NULL, &attr);
1557     TEST_ASSERT_NOT_NULL(id);
1558 };
1559 
1560 /**
1561  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2040
1562  * @tc.name      : thread operation for resume
1563  * @tc.desc      : [C- SOFTWARE -0200]
1564  */
1565 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadResume001, Function | MediumTest | Level1)
1566 {
1567     osThreadId_t id;
1568     osThreadAttr_t attr;
1569     attr.name = "test";
1570     attr.attr_bits = 0U;
1571     attr.cb_mem = NULL;
1572     attr.cb_size = 0U;
1573     attr.stack_mem = NULL;
1574     attr.stack_size = TEST_TASK_STACK_SIZE;
1575     attr.priority = osPriorityAboveNormal;
1576     g_cmsisTestTaskCount = 0;
1577     g_cmsisTestTaskCount++;
1578     id = osThreadNew((osThreadFunc_t)CmsisThreadResumeFunc001, NULL, &attr);
1579     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
1580     TEST_ASSERT_NOT_NULL(id);
1581 };
1582 
1583 /**
1584  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2080
1585  * @tc.name      : thread operation for terminate when priority = osPriorityLow1
1586  * @tc.desc      : [C- SOFTWARE -0200]
1587  */
1588 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate001, Function | MediumTest | Level1)
1589 {
1590     osThreadId_t id;
1591     osThreadAttr_t attr;
1592     attr.name = "test";
1593     attr.attr_bits = 0U;
1594     attr.cb_mem = NULL;
1595     attr.cb_size = 0U;
1596     attr.stack_mem = NULL;
1597     attr.stack_size = TEST_TASK_STACK_SIZE;
1598     attr.priority = osPriorityLow1;
1599     g_cmsisTestTaskCount = 0;
1600     g_cmsisTestTaskCount++;
1601     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
1602     TEST_ASSERT_NOT_NULL(id);
1603     osDelay(DELAY_TICKS_5);
1604     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
1605 };
1606 
1607 /**
1608  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2120
1609  * @tc.name      : get thread count with callback function when priority = osPriorityAboveNormal
1610  * @tc.desc      : [C- SOFTWARE -0200]
1611  */
1612 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount001, Function | MediumTest | Level1)
1613 {
1614     osThreadId_t id;
1615     osThreadAttr_t attr;
1616     attr.name = "test";
1617     attr.attr_bits = 0U;
1618     attr.cb_mem = NULL;
1619     attr.cb_size = 0U;
1620     attr.stack_mem = NULL;
1621     attr.stack_size = TEST_TASK_STACK_SIZE;
1622     attr.priority = osPriorityAboveNormal;
1623     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc001, NULL, &attr);
1624     TEST_ASSERT_NOT_NULL(id);
1625 };
1626 
1627 /**
1628  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2160
1629  * @tc.name      : thread operation for current count
1630  * @tc.desc      : [C- SOFTWARE -0200]
1631  */
1632 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount002, Function | MediumTest | Level1)
1633 {
1634     UINT32 uwRet;
1635     uwRet = osThreadGetCount();
1636     TEST_ASSERT_GREATER_THAN_INT32(0, uwRet);
1637 };
1638 
1639 /**
1640  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2200
1641  * @tc.name      : get thread count when priority = osPriorityLow1
1642  * @tc.desc      : [C- SOFTWARE -0200]
1643  */
1644 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount003, Function | MediumTest | Level1)
1645 {
1646     osThreadId_t id;
1647     osThreadAttr_t attr;
1648     attr.name = "test";
1649     attr.attr_bits = 0U;
1650     attr.cb_mem = NULL;
1651     attr.cb_size = 0U;
1652     attr.stack_mem = NULL;
1653     attr.stack_size = TEST_TASK_STACK_SIZE;
1654     attr.priority = osPriorityLow1;
1655     g_threadCount = osThreadGetCount();
1656     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1657     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1658     TEST_ASSERT_NOT_NULL(id);
1659     osDelay(DELAY_TICKS_5);
1660 };
1661 
1662 /**
1663  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2240
1664  * @tc.name      : get thread count when priority = osPriorityLow7
1665  * @tc.desc      : [C- SOFTWARE -0200]
1666  */
1667 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount004, Function | MediumTest | Level1)
1668 {
1669     osThreadId_t id;
1670     osThreadAttr_t attr;
1671     attr.name = "test";
1672     attr.attr_bits = 0U;
1673     attr.cb_mem = NULL;
1674     attr.cb_size = 0U;
1675     attr.stack_mem = NULL;
1676     attr.stack_size = TEST_TASK_STACK_SIZE;
1677     attr.priority = osPriorityLow7;
1678     g_threadCount = osThreadGetCount();
1679     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1680     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1681     TEST_ASSERT_NOT_NULL(id);
1682     osDelay(DELAY_TICKS_5);
1683 };
1684 
1685 /**
1686  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2280
1687  * @tc.name      : get thread count when priority = osPriorityBelowNormal
1688  * @tc.desc      : [C- SOFTWARE -0200]
1689  */
1690 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount005, Function | MediumTest | Level1)
1691 {
1692     osThreadId_t id;
1693     osThreadAttr_t attr;
1694     attr.name = "test";
1695     attr.attr_bits = 0U;
1696     attr.cb_mem = NULL;
1697     attr.cb_size = 0U;
1698     attr.stack_mem = NULL;
1699     attr.stack_size = TEST_TASK_STACK_SIZE;
1700     attr.priority = osPriorityBelowNormal;
1701     g_threadCount = osThreadGetCount();
1702     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1703     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1704     TEST_ASSERT_NOT_NULL(id);
1705     osDelay(DELAY_TICKS_5);
1706 };
1707 
1708 /**
1709  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2320
1710  * @tc.name      : get thread count when priority = osPriorityBelowNormal7
1711  * @tc.desc      : [C- SOFTWARE -0200]
1712  */
1713 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount006, Function | MediumTest | Level1)
1714 {
1715     osThreadId_t id;
1716     osThreadAttr_t attr;
1717     attr.name = "test";
1718     attr.attr_bits = 0U;
1719     attr.cb_mem = NULL;
1720     attr.cb_size = 0U;
1721     attr.stack_mem = NULL;
1722     attr.stack_size = TEST_TASK_STACK_SIZE;
1723     attr.priority = osPriorityBelowNormal7;
1724     g_threadCount = osThreadGetCount();
1725     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1726     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1727     TEST_ASSERT_NOT_NULL(id);
1728     osDelay(DELAY_TICKS_5);
1729 };
1730 
1731 /**
1732  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2360
1733  * @tc.name      : get thread count when priority = osPriorityNormal
1734  * @tc.desc      : [C- SOFTWARE -0200]
1735  */
1736 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount007, Function | MediumTest | Level1)
1737 {
1738     osThreadId_t id;
1739     osThreadAttr_t attr;
1740     attr.name = "test";
1741     attr.attr_bits = 0U;
1742     attr.cb_mem = NULL;
1743     attr.cb_size = 0U;
1744     attr.stack_mem = NULL;
1745     attr.stack_size = TEST_TASK_STACK_SIZE;
1746     attr.priority = osPriorityNormal;
1747     g_threadCount = osThreadGetCount();
1748     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1749     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1750     TEST_ASSERT_NOT_NULL(id);
1751     osDelay(DELAY_TICKS_5);
1752 };
1753 
1754 /**
1755  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2400
1756  * @tc.name      : get thread count when priority = osPriorityNormal7
1757  * @tc.desc      : [C- SOFTWARE -0200]
1758  */
1759 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount008, Function | MediumTest | Level1)
1760 {
1761     osThreadId_t id;
1762     osThreadAttr_t attr;
1763     attr.name = "test";
1764     attr.attr_bits = 0U;
1765     attr.cb_mem = NULL;
1766     attr.cb_size = 0U;
1767     attr.stack_mem = NULL;
1768     attr.stack_size = TEST_TASK_STACK_SIZE;
1769     attr.priority = osPriorityNormal7;
1770     g_threadCount = osThreadGetCount();
1771     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1772     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1773     TEST_ASSERT_NOT_NULL(id);
1774 };
1775 
1776 /**
1777  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2440
1778  * @tc.name      : get thread count when priority = osPriorityAboveNormal
1779  * @tc.desc      : [C- SOFTWARE -0200]
1780  */
1781 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount009, Function | MediumTest | Level1)
1782 {
1783     osThreadId_t id;
1784     osThreadAttr_t attr;
1785     attr.name = "test";
1786     attr.attr_bits = 0U;
1787     attr.cb_mem = NULL;
1788     attr.cb_size = 0U;
1789     attr.stack_mem = NULL;
1790     attr.stack_size = TEST_TASK_STACK_SIZE;
1791     attr.priority = osPriorityAboveNormal;
1792     g_threadCount = osThreadGetCount();
1793     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1794     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1795     TEST_ASSERT_NOT_NULL(id);
1796 };
1797 
1798 /**
1799  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2480
1800  * @tc.name      : get thread count when priority = osPriorityAboveNormal6
1801  * @tc.desc      : [C- SOFTWARE -0200]
1802  */
1803 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetCount010, Function | MediumTest | Level1)
1804 {
1805     osThreadId_t id;
1806     osThreadAttr_t attr;
1807     attr.name = "test";
1808     attr.attr_bits = 0U;
1809     attr.cb_mem = NULL;
1810     attr.cb_size = 0U;
1811     attr.stack_mem = NULL;
1812     attr.stack_size = TEST_TASK_STACK_SIZE;
1813     attr.priority = osPriorityAboveNormal6;
1814     g_threadCount = osThreadGetCount();
1815     TEST_ASSERT_GREATER_THAN_INT32(0, g_threadCount);
1816     id = osThreadNew((osThreadFunc_t)CmsisThreadGetCountFunc003, NULL, &attr);
1817     TEST_ASSERT_NOT_NULL(id);
1818 };
1819 
1820 /**
1821  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2520
1822  * @tc.name      : thread operation for get name input exception
1823  * @tc.desc      : [C- SOFTWARE -0200]
1824  */
1825 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName002, Function | MediumTest | Level1)
1826 {
1827     osThreadAttr_t attr;
1828     attr.name = osThreadGetName(NULL);
1829     TEST_ASSERT_NULL(attr.name);
1830 };
1831 
1832 /**
1833  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2560
1834  * @tc.name      : thread operation for get name when priority = osPriorityLow1
1835  * @tc.desc      : [C- SOFTWARE -0200]
1836  */
1837 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName003, Function | MediumTest | Level1)
1838 {
1839     osThreadId_t id;
1840     osThreadAttr_t attr;
1841 
1842     attr.name = "testThreadGetName";
1843     attr.attr_bits = 0U;
1844     attr.cb_mem = NULL;
1845     attr.cb_size = 0U;
1846     attr.stack_mem = NULL;
1847     attr.stack_size = TEST_TASK_STACK_SIZE;
1848     attr.priority = osPriorityLow1;
1849     g_getNameExit = 0;
1850     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1851     TEST_ASSERT_NOT_NULL(id);
1852     osDelay(DELAY_TICKS_5);
1853     WaitThreadExit(id, &g_getNameExit);
1854 };
1855 
1856 /**
1857  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2600
1858  * @tc.name      : thread operation for get name when priority = osPriorityLow7
1859  * @tc.desc      : [C- SOFTWARE -0200]
1860  */
1861 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName004, Function | MediumTest | Level1)
1862 {
1863     osThreadId_t id;
1864     osThreadAttr_t attr;
1865 
1866     attr.name = "testThreadGetName";
1867     attr.attr_bits = 0U;
1868     attr.cb_mem = NULL;
1869     attr.cb_size = 0U;
1870     attr.stack_mem = NULL;
1871     attr.stack_size = TEST_TASK_STACK_SIZE;
1872     attr.priority = osPriorityLow7;
1873     g_getNameExit = 0;
1874     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1875     TEST_ASSERT_NOT_NULL(id);
1876     osDelay(DELAY_TICKS_5);
1877     WaitThreadExit(id, &g_getNameExit);
1878 };
1879 
1880 /**
1881  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2640
1882  * @tc.name      : thread operation for get name when priority = osPriorityBelowNormal
1883  * @tc.desc      : [C- SOFTWARE -0200]
1884  */
1885 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName005, Function | MediumTest | Level1)
1886 {
1887     osThreadId_t id;
1888     osThreadAttr_t attr;
1889 
1890     attr.name = "testThreadGetName";
1891     attr.attr_bits = 0U;
1892     attr.cb_mem = NULL;
1893     attr.cb_size = 0U;
1894     attr.stack_mem = NULL;
1895     attr.stack_size = TEST_TASK_STACK_SIZE;
1896     attr.priority = osPriorityBelowNormal;
1897     g_getNameExit = 0;
1898     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1899     TEST_ASSERT_NOT_NULL(id);
1900     osDelay(DELAY_TICKS_5);
1901     WaitThreadExit(id, &g_getNameExit);
1902 };
1903 
1904 /**
1905  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2680
1906  * @tc.name      : thread operation for get name when priority = osPriorityBelowNormal7
1907  * @tc.desc      : [C- SOFTWARE -0200]
1908  */
1909 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName006, Function | MediumTest | Level1)
1910 {
1911     osThreadId_t id;
1912     osThreadAttr_t attr;
1913 
1914     attr.name = "testThreadGetName";
1915     attr.attr_bits = 0U;
1916     attr.cb_mem = NULL;
1917     attr.cb_size = 0U;
1918     attr.stack_mem = NULL;
1919     attr.stack_size = TEST_TASK_STACK_SIZE;
1920     attr.priority = osPriorityBelowNormal7;
1921     g_getNameExit = 0;
1922     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1923     TEST_ASSERT_NOT_NULL(id);
1924     osDelay(DELAY_TICKS_5);
1925     WaitThreadExit(id, &g_getNameExit);
1926 };
1927 
1928 /**
1929  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2720
1930  * @tc.name      : thread operation for get name when priority = osPriorityNormal7
1931  * @tc.desc      : [C- SOFTWARE -0200]
1932  */
1933 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName007, Function | MediumTest | Level1)
1934 {
1935     osThreadId_t id;
1936     osThreadAttr_t attr;
1937 
1938     attr.name = "testThreadGetName";
1939     attr.attr_bits = 0U;
1940     attr.cb_mem = NULL;
1941     attr.cb_size = 0U;
1942     attr.stack_mem = NULL;
1943     attr.stack_size = TEST_TASK_STACK_SIZE;
1944     attr.priority = osPriorityNormal7;
1945     g_getNameExit = 0;
1946     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1947     TEST_ASSERT_NOT_NULL(id);
1948     WaitThreadExit(id, &g_getNameExit);
1949 };
1950 
1951 /**
1952  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2760
1953  * @tc.name      : thread operation for get name when priority = osPriorityAboveNormal
1954  * @tc.desc      : [C- SOFTWARE -0200]
1955  */
1956 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName008, Function | MediumTest | Level1)
1957 {
1958     osThreadId_t id;
1959     osThreadAttr_t attr;
1960 
1961     attr.name = "testThreadGetName";
1962     attr.attr_bits = 0U;
1963     attr.cb_mem = NULL;
1964     attr.cb_size = 0U;
1965     attr.stack_mem = NULL;
1966     attr.stack_size = TEST_TASK_STACK_SIZE;
1967     attr.priority = osPriorityAboveNormal;
1968     g_getNameExit = 0;
1969     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1970     TEST_ASSERT_NOT_NULL(id);
1971     WaitThreadExit(id, &g_getNameExit);
1972 };
1973 
1974 /**
1975  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2800
1976  * @tc.name      : thread operation for get name when priority = osPriorityAboveNormal6
1977  * @tc.desc      : [C- SOFTWARE -0200]
1978  */
1979 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName009, Function | MediumTest | Level1)
1980 {
1981     osThreadId_t id;
1982     osThreadAttr_t attr;
1983 
1984     attr.name = "testThreadGetName";
1985     attr.attr_bits = 0U;
1986     attr.cb_mem = NULL;
1987     attr.cb_size = 0U;
1988     attr.stack_mem = NULL;
1989     attr.stack_size = TEST_TASK_STACK_SIZE;
1990     attr.priority = osPriorityAboveNormal6;
1991     g_getNameExit = 0;
1992     id = osThreadNew((osThreadFunc_t)CmsisThreadGetNameFunc001, NULL, &attr);
1993     TEST_ASSERT_NOT_NULL(id);
1994     WaitThreadExit(id, &g_getNameExit);
1995 };
1996 
1997 /**
1998  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2840
1999  * @tc.name      : thread operation for get name
2000  * @tc.desc      : [C- SOFTWARE -0200]
2001  */
2002 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetName010, Function | MediumTest | Level1)
2003 {
2004     osThreadAttr_t attr;
2005     g_puwTaskID01 = osThreadGetId();
2006     attr.name = osThreadGetName(g_puwTaskID01);
2007     TEST_ASSERT_NOT_NULL(attr.name);
2008 };
2009 
2010 /**
2011  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2880
2012  * @tc.name      : thread operation for get state input exception
2013  * @tc.desc      : [C- SOFTWARE -0200]
2014  */
2015 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState002, Function | MediumTest | Level1)
2016 {
2017     osStatus_t uwRet;
2018     uwRet = osThreadGetState(NULL);
2019     TEST_ASSERT_EQUAL_INT(osThreadError, uwRet);
2020 };
2021 
2022 /**
2023  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2920
2024  * @tc.name      : thread operation for get state when priority = osPriorityLow1
2025  * @tc.desc      : [C- SOFTWARE -0200]
2026  */
2027 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState003, Function | MediumTest | Level1)
2028 {
2029     osThreadId_t id;
2030     osThreadAttr_t attr;
2031 
2032     attr.name = "test";
2033     attr.attr_bits = 0U;
2034     attr.cb_mem = NULL;
2035     attr.cb_size = 0U;
2036     attr.stack_mem = NULL;
2037     attr.stack_size = TEST_TASK_STACK_SIZE;
2038     attr.priority = osPriorityLow1;
2039 
2040     g_puwTaskID01 = osThreadGetId();
2041     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc001, NULL, &attr);
2042     TEST_ASSERT_NOT_NULL(id);
2043     osDelay(DELAY_TICKS_5);
2044 };
2045 
2046 /**
2047  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_2960
2048  * @tc.name      : thread operation for get state when priority = osPriorityLow7
2049  * @tc.desc      : [C- SOFTWARE -0200]
2050  */
2051 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState004, Function | MediumTest | Level1)
2052 {
2053     osThreadId_t id;
2054     osThreadAttr_t attr;
2055 
2056     attr.name = "test";
2057     attr.attr_bits = 0U;
2058     attr.cb_mem = NULL;
2059     attr.cb_size = 0U;
2060     attr.stack_mem = NULL;
2061     attr.stack_size = TEST_TASK_STACK_SIZE;
2062     attr.priority = osPriorityLow7;
2063 
2064     g_puwTaskID01 = osThreadGetId();
2065     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc001, NULL, &attr);
2066     TEST_ASSERT_NOT_NULL(id);
2067     osDelay(DELAY_TICKS_5);
2068 };
2069 
2070 /**
2071  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3000
2072  * @tc.name      : thread operation for get state when priority = osPriorityBelowNormal
2073  * @tc.desc      : [C- SOFTWARE -0200]
2074  */
2075 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState005, Function | MediumTest | Level1)
2076 {
2077     osThreadId_t id;
2078     osThreadAttr_t attr;
2079 
2080     attr.name = "test";
2081     attr.attr_bits = 0U;
2082     attr.cb_mem = NULL;
2083     attr.cb_size = 0U;
2084     attr.stack_mem = NULL;
2085     attr.stack_size = TEST_TASK_STACK_SIZE;
2086     attr.priority = osPriorityBelowNormal;
2087 
2088     g_puwTaskID01 = osThreadGetId();
2089     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc001, NULL, &attr);
2090     TEST_ASSERT_NOT_NULL(id);
2091     osDelay(DELAY_TICKS_5);
2092 };
2093 
2094 /**
2095  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3040
2096  * @tc.name      : thread operation for get state when priority = osPriorityBelowNormal7
2097  * @tc.desc      : [C- SOFTWARE -0200]
2098  */
2099 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState006, Function | MediumTest | Level1)
2100 {
2101     osThreadId_t id;
2102     osThreadAttr_t attr;
2103 
2104     attr.name = "test";
2105     attr.attr_bits = 0U;
2106     attr.cb_mem = NULL;
2107     attr.cb_size = 0U;
2108     attr.stack_mem = NULL;
2109     attr.stack_size = TEST_TASK_STACK_SIZE;
2110     attr.priority = osPriorityBelowNormal7;
2111 
2112     g_puwTaskID01 = osThreadGetId();
2113     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc001, NULL, &attr);
2114     TEST_ASSERT_NOT_NULL(id);
2115     osDelay(DELAY_TICKS_5);
2116 };
2117 
2118 /**
2119  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3080
2120  * @tc.name      : thread operation for get state when priority = osPriorityNormal
2121  * @tc.desc      : [C- SOFTWARE -0200]
2122  */
2123 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState007, Function | MediumTest | Level1)
2124 {
2125     osThreadId_t id;
2126     osThreadAttr_t attr;
2127 
2128     attr.name = "test";
2129     attr.attr_bits = 0U;
2130     attr.cb_mem = NULL;
2131     attr.cb_size = 0U;
2132     attr.stack_mem = NULL;
2133     attr.stack_size = TEST_TASK_STACK_SIZE;
2134     attr.priority = osPriorityNormal;
2135 
2136     g_puwTaskID01 = osThreadGetId();
2137     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc001, NULL, &attr);
2138     TEST_ASSERT_NOT_NULL(id);
2139     osDelay(DELAY_TICKS_5);
2140 };
2141 
2142 /**
2143  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3120
2144  * @tc.name      : thread operation for get state when priority = osPriorityNormal7
2145  * @tc.desc      : [C- SOFTWARE -0200]
2146  */
2147 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState008, Function | MediumTest | Level1)
2148 {
2149     osThreadId_t id;
2150     osThreadAttr_t attr;
2151 
2152     attr.name = "test";
2153     attr.attr_bits = 0U;
2154     attr.cb_mem = NULL;
2155     attr.cb_size = 0U;
2156     attr.stack_mem = NULL;
2157     attr.stack_size = TEST_TASK_STACK_SIZE;
2158     attr.priority = osPriorityNormal7;
2159 
2160     g_puwTaskID01 = osThreadGetId();
2161     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc002, NULL, &attr);
2162     TEST_ASSERT_NOT_NULL(id);
2163     osDelay(DELAY_TICKS_5);
2164 };
2165 
2166 /**
2167  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3160
2168  * @tc.name      : thread operation for get state when priority = osPriorityAboveNormal6
2169  * @tc.desc      : [C- SOFTWARE -0200]
2170  */
2171 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState009, Function | MediumTest | Level1)
2172 {
2173     osThreadId_t id;
2174     osThreadAttr_t attr;
2175 
2176     attr.name = "test";
2177     attr.attr_bits = 0U;
2178     attr.cb_mem = NULL;
2179     attr.cb_size = 0U;
2180     attr.stack_mem = NULL;
2181     attr.stack_size = TEST_TASK_STACK_SIZE;
2182     attr.priority = osPriorityAboveNormal6;
2183 
2184     g_puwTaskID01 = osThreadGetId();
2185     id = osThreadNew ((osThreadFunc_t)CmsisThreadGetStateFunc002, NULL, &attr);
2186     TEST_ASSERT_NOT_NULL(id);
2187     osDelay(DELAY_TICKS_5);
2188 };
2189 
2190 /**
2191  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3200
2192  * @tc.name      : thread operation for get current state
2193  * @tc.desc      : [C- SOFTWARE -0200]
2194  */
2195 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetState010, Function | MediumTest | Level1)
2196 {
2197     osThreadState_t state;
2198     g_puwTaskID01 = osThreadGetId();
2199     state = osThreadGetState(g_puwTaskID01);
2200     TEST_ASSERT_EQUAL_INT(osThreadRunning, state);
2201 };
2202 
2203 /**
2204  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3240
2205  * @tc.name      : thread operation for suspend input exception
2206  * @tc.desc      : [C- SOFTWARE -0200]
2207  */
2208 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend002, Function | MediumTest | Level1)
2209 {
2210     osStatus_t uwRet;
2211     uwRet = osThreadSuspend(NULL);
2212     TEST_ASSERT_EQUAL_INT(osErrorParameter, uwRet);
2213 };
2214 
2215 /**
2216  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3280
2217  * @tc.name      : thread operation for suspend when priority = osPriorityLow7
2218  * @tc.desc      : [C- SOFTWARE -0200]
2219  */
2220 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend003, Function | MediumTest | Level1)
2221 {
2222     osThreadId_t id;
2223     osStatus_t uwRet;
2224     osThreadAttr_t attr;
2225     osThreadState_t state;
2226     g_cmsisTestTaskCount = 0;
2227     attr.name = "test";
2228     attr.attr_bits = 0U;
2229     attr.cb_mem = NULL;
2230     attr.cb_size = 0U;
2231     attr.stack_mem = NULL;
2232     attr.stack_size = TEST_TASK_STACK_SIZE;
2233     attr.priority = osPriorityLow7;
2234     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
2235     TEST_ASSERT_NOT_NULL(id);
2236     osDelay(DELAY_TICKS_5);
2237     state = osThreadGetState(g_puwTaskID01);
2238     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
2239     uwRet = osThreadResume(g_puwTaskID01);
2240     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
2241 };
2242 
2243 /**
2244  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3320
2245  * @tc.name      : thread operation for suspend when priority = osPriorityBelowNormal
2246  * @tc.desc      : [C- SOFTWARE -0200]
2247  */
2248 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend004, Function | MediumTest | Level1)
2249 {
2250     osThreadId_t id;
2251     osStatus_t uwRet;
2252     osThreadAttr_t attr;
2253     osThreadState_t state;
2254     g_cmsisTestTaskCount = 0;
2255     attr.name = "test";
2256     attr.attr_bits = 0U;
2257     attr.cb_mem = NULL;
2258     attr.cb_size = 0U;
2259     attr.stack_mem = NULL;
2260     attr.stack_size = TEST_TASK_STACK_SIZE;
2261     attr.priority = osPriorityBelowNormal;
2262     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
2263     TEST_ASSERT_NOT_NULL(id);
2264     osDelay(DELAY_TICKS_5);
2265     state = osThreadGetState(g_puwTaskID01);
2266     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
2267     uwRet = osThreadResume(g_puwTaskID01);
2268     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
2269 };
2270 
2271 /**
2272  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3360
2273  * @tc.name      : thread operation for suspend when priority = osPriorityBelowNormal7
2274  * @tc.desc      : [C- SOFTWARE -0200]
2275  */
2276 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend005, Function | MediumTest | Level1)
2277 {
2278     osThreadId_t id;
2279     osStatus_t uwRet;
2280     osThreadAttr_t attr;
2281     osThreadState_t state;
2282     g_cmsisTestTaskCount = 0;
2283     attr.name = "test";
2284     attr.attr_bits = 0U;
2285     attr.cb_mem = NULL;
2286     attr.cb_size = 0U;
2287     attr.stack_mem = NULL;
2288     attr.stack_size = TEST_TASK_STACK_SIZE;
2289     attr.priority = osPriorityBelowNormal7;
2290     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
2291     TEST_ASSERT_NOT_NULL(id);
2292     osDelay(DELAY_TICKS_5);
2293     state = osThreadGetState(g_puwTaskID01);
2294     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
2295     uwRet = osThreadResume(g_puwTaskID01);
2296     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
2297 };
2298 
2299 /**
2300  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3400
2301  * @tc.name      : thread operation for suspend when priority = osPriorityNormal
2302  * @tc.desc      : [C- SOFTWARE -0200]
2303  */
2304 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend006, Function | MediumTest | Level1)
2305 {
2306     osThreadId_t id;
2307     osStatus_t uwRet;
2308     osThreadAttr_t attr;
2309     osThreadState_t state;
2310     g_cmsisTestTaskCount = 0;
2311     attr.name = "test";
2312     attr.attr_bits = 0U;
2313     attr.cb_mem = NULL;
2314     attr.cb_size = 0U;
2315     attr.stack_mem = NULL;
2316     attr.stack_size = TEST_TASK_STACK_SIZE;
2317     attr.priority = osPriorityNormal;
2318     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
2319     TEST_ASSERT_NOT_NULL(id);
2320     osDelay(DELAY_TICKS_5);
2321     state = osThreadGetState(g_puwTaskID01);
2322     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
2323     uwRet = osThreadResume(g_puwTaskID01);
2324     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
2325 };
2326 
2327 /**
2328  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3440
2329  * @tc.name      : thread operation for suspend when priority = osPriorityNormal7
2330  * @tc.desc      : [C- SOFTWARE -0200]
2331  */
2332 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend007, Function | MediumTest | Level1)
2333 {
2334     osThreadId_t id;
2335     osStatus_t uwRet;
2336     osThreadAttr_t attr;
2337     osThreadState_t state;
2338     g_cmsisTestTaskCount = 0;
2339     attr.name = "test";
2340     attr.attr_bits = 0U;
2341     attr.cb_mem = NULL;
2342     attr.cb_size = 0U;
2343     attr.stack_mem = NULL;
2344     attr.stack_size = TEST_TASK_STACK_SIZE;
2345     attr.priority = osPriorityNormal7;
2346     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
2347     TEST_ASSERT_NOT_NULL(id);
2348     state = osThreadGetState(g_puwTaskID01);
2349     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
2350     uwRet = osThreadResume(g_puwTaskID01);
2351     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
2352 };
2353 
2354 /**
2355  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3480
2356  * @tc.name      : thread operation for suspend when priority = osPriorityAboveNormal
2357  * @tc.desc      : [C- SOFTWARE -0200]
2358  */
2359 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend008, Function | MediumTest | Level1)
2360 {
2361     osThreadId_t id;
2362     osStatus_t uwRet;
2363     osThreadAttr_t attr;
2364     osThreadState_t state;
2365     g_cmsisTestTaskCount = 0;
2366     attr.name = "test";
2367     attr.attr_bits = 0U;
2368     attr.cb_mem = NULL;
2369     attr.cb_size = 0U;
2370     attr.stack_mem = NULL;
2371     attr.stack_size = TEST_TASK_STACK_SIZE;
2372     attr.priority = osPriorityAboveNormal;
2373     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
2374     TEST_ASSERT_NOT_NULL(id);
2375     state = osThreadGetState(g_puwTaskID01);
2376     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
2377     uwRet = osThreadResume(g_puwTaskID01);
2378     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
2379 };
2380 
2381 /**
2382  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3520
2383  * @tc.name      : thread operation for suspend when priority = osPriorityAboveNormal6
2384  * @tc.desc      : [C- SOFTWARE -0200]
2385  */
2386 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadSuspend009, Function | MediumTest | Level1)
2387 {
2388     osThreadId_t id;
2389     osStatus_t uwRet;
2390     osThreadAttr_t attr;
2391     osThreadState_t state;
2392     g_cmsisTestTaskCount = 0;
2393     attr.name = "test";
2394     attr.attr_bits = 0U;
2395     attr.cb_mem = NULL;
2396     attr.cb_size = 0U;
2397     attr.stack_mem = NULL;
2398     attr.stack_size = TEST_TASK_STACK_SIZE;
2399     attr.priority = osPriorityAboveNormal6;
2400     id = osThreadNew ((osThreadFunc_t)CmsisThreadSuspendFunc001, NULL, &attr);
2401     TEST_ASSERT_NOT_NULL(id);
2402     state = osThreadGetState(g_puwTaskID01);
2403     TEST_ASSERT_EQUAL_INT(osThreadBlocked, state);
2404     uwRet = osThreadResume(g_puwTaskID01);
2405     TEST_ASSERT_EQUAL_INT(osOK, uwRet);
2406 };
2407 
2408 /**
2409  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3560
2410  * @tc.name      : thread operation for get stack size input exception
2411  * @tc.desc      : [C- SOFTWARE -0200]
2412  */
2413 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize002, Function | MediumTest | Level1)
2414 {
2415     UINT32 uwRet;
2416     uwRet = osThreadGetStackSize(NULL);
2417     TEST_ASSERT_EQUAL_INT(0, uwRet);
2418 };
2419 
2420 /**
2421  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3600
2422  * @tc.name      : thread operation for get stack size when priority = osPriorityLow1
2423  * @tc.desc      : [C- SOFTWARE -0200]
2424  */
2425 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize003, Function | MediumTest | Level1)
2426 {
2427     osThreadId_t id;
2428     osThreadAttr_t attr;
2429 
2430     attr.name = "test";
2431     attr.attr_bits = 0U;
2432     attr.cb_mem = NULL;
2433     attr.cb_size = 0U;
2434     attr.stack_mem = NULL;
2435     attr.stack_size = TEST_TASK_STACK_SIZE;
2436     attr.priority = osPriorityLow1;
2437     g_getStackSizeExit = 0;
2438     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
2439     TEST_ASSERT_NOT_NULL(id);
2440     WaitThreadExit(id, &g_getStackSizeExit);
2441 };
2442 
2443 /**
2444  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3640
2445  * @tc.name      : thread operation for get stack size when priority = osPriorityLow7
2446  * @tc.desc      : [C- SOFTWARE -0200]
2447  */
2448 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize004, Function | MediumTest | Level1)
2449 {
2450     osThreadId_t id;
2451     osThreadAttr_t attr;
2452 
2453     attr.name = "test";
2454     attr.attr_bits = 0U;
2455     attr.cb_mem = NULL;
2456     attr.cb_size = 0U;
2457     attr.stack_mem = NULL;
2458     attr.stack_size = TEST_TASK_STACK_SIZE;
2459     attr.priority = osPriorityLow7;
2460     g_getStackSizeExit = 0;
2461     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
2462     TEST_ASSERT_NOT_NULL(id);
2463     WaitThreadExit(id, &g_getStackSizeExit);
2464 };
2465 
2466 /**
2467  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3680
2468  * @tc.name      : thread operation for get stack size when priority = osPriorityBelowNormal
2469  * @tc.desc      : [C- SOFTWARE -0200]
2470  */
2471 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize005, Function | MediumTest | Level1)
2472 {
2473     osThreadId_t id;
2474     osThreadAttr_t attr;
2475 
2476     attr.name = "test";
2477     attr.attr_bits = 0U;
2478     attr.cb_mem = NULL;
2479     attr.cb_size = 0U;
2480     attr.stack_mem = NULL;
2481     attr.stack_size = TEST_TASK_STACK_SIZE;
2482     attr.priority = osPriorityBelowNormal;
2483     g_getStackSizeExit = 0;
2484     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
2485     TEST_ASSERT_NOT_NULL(id);
2486     WaitThreadExit(id, &g_getStackSizeExit);
2487 };
2488 
2489 /**
2490  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3720
2491  * @tc.name      : thread operation for get stack size when priority = osPriorityBelowNormal7
2492  * @tc.desc      : [C- SOFTWARE -0200]
2493  */
2494 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize006, Function | MediumTest | Level1)
2495 {
2496     osThreadId_t id;
2497     osThreadAttr_t attr;
2498 
2499     attr.name = "test";
2500     attr.attr_bits = 0U;
2501     attr.cb_mem = NULL;
2502     attr.cb_size = 0U;
2503     attr.stack_mem = NULL;
2504     attr.stack_size = TEST_TASK_STACK_SIZE;
2505     attr.priority = osPriorityBelowNormal7;
2506     g_getStackSizeExit = 0;
2507     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
2508     TEST_ASSERT_NOT_NULL(id);
2509     WaitThreadExit(id, &g_getStackSizeExit);
2510 };
2511 
2512 /**
2513  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3760
2514  * @tc.name      : thread operation for get stack size when priority = osPriorityNormal
2515  * @tc.desc      : [C- SOFTWARE -0200]
2516  */
2517 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize007, Function | MediumTest | Level1)
2518 {
2519     osThreadId_t id;
2520     osThreadAttr_t attr;
2521 
2522     attr.name = "test";
2523     attr.attr_bits = 0U;
2524     attr.cb_mem = NULL;
2525     attr.cb_size = 0U;
2526     attr.stack_mem = NULL;
2527     attr.stack_size = TEST_TASK_STACK_SIZE;
2528     attr.priority = osPriorityNormal;
2529     g_getStackSizeExit = 0;
2530     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
2531     TEST_ASSERT_NOT_NULL(id);
2532     WaitThreadExit(id, &g_getStackSizeExit);
2533 };
2534 
2535 /**
2536  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3800
2537  * @tc.name      : thread operation for get stack size when priority = osPriorityNormal7
2538  * @tc.desc      : [C- SOFTWARE -0200]
2539  */
2540 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize008, Function | MediumTest | Level1)
2541 {
2542     osThreadId_t id;
2543     osThreadAttr_t attr;
2544 
2545     attr.name = "test";
2546     attr.attr_bits = 0U;
2547     attr.cb_mem = NULL;
2548     attr.cb_size = 0U;
2549     attr.stack_mem = NULL;
2550     attr.stack_size = TEST_TASK_STACK_SIZE;
2551     attr.priority = osPriorityNormal7;
2552     g_getStackSizeExit = 0;
2553     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
2554     TEST_ASSERT_NOT_NULL(id);
2555     WaitThreadExit(id, &g_getStackSizeExit);
2556 };
2557 
2558 /**
2559  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3840
2560  * @tc.name      : thread operation for get stack size when priority = osPriorityAboveNormal
2561  * @tc.desc      : [C- SOFTWARE -0200]
2562  */
2563 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize009, Function | MediumTest | Level1)
2564 {
2565     osThreadId_t id;
2566     osThreadAttr_t attr;
2567 
2568     attr.name = "test";
2569     attr.attr_bits = 0U;
2570     attr.cb_mem = NULL;
2571     attr.cb_size = 0U;
2572     attr.stack_mem = NULL;
2573     attr.stack_size = TEST_TASK_STACK_SIZE;
2574     attr.priority = osPriorityAboveNormal;
2575     g_getStackSizeExit = 0;
2576     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSizeFunc001, NULL, &attr);
2577     TEST_ASSERT_NOT_NULL(id);
2578     WaitThreadExit(id, &g_getStackSizeExit);
2579 };
2580 
2581 /**
2582  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3880
2583  * @tc.name      : thread operation for get stack size
2584  * @tc.desc      : [C- SOFTWARE -0200]
2585  */
2586 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSize010, Function | MediumTest | Level1)
2587 {
2588     osThreadAttr_t attr;
2589     g_puwTaskID01 = osThreadGetId();
2590     attr.stack_size = osThreadGetStackSize(g_puwTaskID01);
2591     TEST_ASSERT_GREATER_THAN_INT32(0, attr.stack_size);
2592 };
2593 
2594 /**
2595  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3920
2596  * @tc.name      : thread operation for get stack space input exception
2597  * @tc.desc      : [C- SOFTWARE -0200]
2598  */
2599 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace002, Function | MediumTest | Level1)
2600 {
2601     UINT32 uwRet;
2602     uwRet = osThreadGetStackSpace(NULL);
2603     TEST_ASSERT_EQUAL_INT(0, uwRet);
2604 };
2605 
2606 /**
2607  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_3960
2608  * @tc.name      : thread operation for get stack space when priority = osPriorityLow1
2609  * @tc.desc      : [C- SOFTWARE -0200]
2610  */
2611 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace003, Function | MediumTest | Level1)
2612 {
2613     osThreadId_t id;
2614     osThreadAttr_t attr;
2615 
2616     attr.name = "test";
2617     attr.attr_bits = 0U;
2618     attr.cb_mem = NULL;
2619     attr.cb_size = 0U;
2620     attr.stack_mem = NULL;
2621     attr.stack_size = TEST_TASK_STACK_SIZE;
2622     attr.priority = osPriorityLow1;
2623     g_getStackSpaceExit = 0;
2624     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2625     osDelay(DELAY_TICKS_5);
2626     TEST_ASSERT_NOT_NULL(id);
2627     WaitThreadExit(id, &g_getStackSpaceExit);
2628 };
2629 
2630 /**
2631  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4000
2632  * @tc.name      : thread operation for get stack space when priority = osPriorityLow7
2633  * @tc.desc      : [C- SOFTWARE -0200]
2634  */
2635 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace004, Function | MediumTest | Level1)
2636 {
2637     osThreadId_t id;
2638     osThreadAttr_t attr;
2639 
2640     attr.name = "test";
2641     attr.attr_bits = 0U;
2642     attr.cb_mem = NULL;
2643     attr.cb_size = 0U;
2644     attr.stack_mem = NULL;
2645     attr.stack_size = TEST_TASK_STACK_SIZE;
2646     attr.priority = osPriorityLow7;
2647     g_getStackSpaceExit = 0;
2648     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2649     osDelay(DELAY_TICKS_5);
2650     TEST_ASSERT_NOT_NULL(id);
2651     WaitThreadExit(id, &g_getStackSpaceExit);
2652 };
2653 
2654 /**
2655  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4040
2656  * @tc.name      : thread operation for get stack space when priority = osPriorityBelowNormal
2657  * @tc.desc      : [C- SOFTWARE -0200]
2658  */
2659 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace005, Function | MediumTest | Level1)
2660 {
2661     osThreadId_t id;
2662     osThreadAttr_t attr;
2663 
2664     attr.name = "test";
2665     attr.attr_bits = 0U;
2666     attr.cb_mem = NULL;
2667     attr.cb_size = 0U;
2668     attr.stack_mem = NULL;
2669     attr.stack_size = TEST_TASK_STACK_SIZE;
2670     attr.priority = osPriorityBelowNormal;
2671     g_getStackSpaceExit = 0;
2672     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2673     osDelay(DELAY_TICKS_5);
2674     TEST_ASSERT_NOT_NULL(id);
2675     WaitThreadExit(id, &g_getStackSpaceExit);
2676 };
2677 
2678 /**
2679  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4080
2680  * @tc.name      : thread operation for get stack space when priority = osPriorityBelowNormal7
2681  * @tc.desc      : [C- SOFTWARE -0200]
2682  */
2683 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace006, Function | MediumTest | Level1)
2684 {
2685     osThreadId_t id;
2686     osThreadAttr_t attr;
2687 
2688     attr.name = "test";
2689     attr.attr_bits = 0U;
2690     attr.cb_mem = NULL;
2691     attr.cb_size = 0U;
2692     attr.stack_mem = NULL;
2693     attr.stack_size = TEST_TASK_STACK_SIZE;
2694     attr.priority = osPriorityBelowNormal7;
2695     g_getStackSpaceExit = 0;
2696     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2697     osDelay(DELAY_TICKS_5);
2698     TEST_ASSERT_NOT_NULL(id);
2699     WaitThreadExit(id, &g_getStackSpaceExit);
2700 };
2701 
2702 /**
2703  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4120
2704  * @tc.name      : thread operation for get stack space when priority = osPriorityNormal
2705  * @tc.desc      : [C- SOFTWARE -0200]
2706  */
2707 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace007, Function | MediumTest | Level1)
2708 {
2709     osThreadId_t id;
2710     osThreadAttr_t attr;
2711 
2712     attr.name = "test";
2713     attr.attr_bits = 0U;
2714     attr.cb_mem = NULL;
2715     attr.cb_size = 0U;
2716     attr.stack_mem = NULL;
2717     attr.stack_size = TEST_TASK_STACK_SIZE;
2718     attr.priority = osPriorityNormal;
2719     g_getStackSpaceExit = 0;
2720     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2721     osDelay(DELAY_TICKS_5);
2722     TEST_ASSERT_NOT_NULL(id);
2723     WaitThreadExit(id, &g_getStackSpaceExit);
2724 };
2725 
2726 /**
2727  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4160
2728  * @tc.name      : thread operation for get stack space when priority = osPriorityNormal7
2729  * @tc.desc      : [C- SOFTWARE -0200]
2730  */
2731 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace008, Function | MediumTest | Level1)
2732 {
2733     osThreadId_t id;
2734     osThreadAttr_t attr;
2735 
2736     attr.name = "test";
2737     attr.attr_bits = 0U;
2738     attr.cb_mem = NULL;
2739     attr.cb_size = 0U;
2740     attr.stack_mem = NULL;
2741     attr.stack_size = TEST_TASK_STACK_SIZE;
2742     attr.priority = osPriorityNormal7;
2743     g_getStackSpaceExit = 0;
2744     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2745     osDelay(DELAY_TICKS_5);
2746     TEST_ASSERT_NOT_NULL(id);
2747     WaitThreadExit(id, &g_getStackSpaceExit);
2748 };
2749 
2750 /**
2751  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4200
2752  * @tc.name      : thread operation for get stack space when priority = osPriorityAboveNormal
2753  * @tc.desc      : [C- SOFTWARE -0200]
2754  */
2755 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace009, Function | MediumTest | Level1)
2756 {
2757     osThreadId_t id;
2758     osThreadAttr_t attr;
2759 
2760     attr.name = "test";
2761     attr.attr_bits = 0U;
2762     attr.cb_mem = NULL;
2763     attr.cb_size = 0U;
2764     attr.stack_mem = NULL;
2765     attr.stack_size = TEST_TASK_STACK_SIZE;
2766     attr.priority = osPriorityAboveNormal;
2767     g_getStackSpaceExit = 0;
2768     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2769     osDelay(DELAY_TICKS_5);
2770     TEST_ASSERT_NOT_NULL(id);
2771     WaitThreadExit(id, &g_getStackSpaceExit);
2772 };
2773 
2774 /**
2775  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4240
2776  * @tc.name      : thread operation for get stack space when priority = osPriorityAboveNormal6
2777  * @tc.desc      : [C- SOFTWARE -0200]
2778  */
2779 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadGetStackSpace010, Function | MediumTest | Level1)
2780 {
2781     osThreadId_t id;
2782     osThreadAttr_t attr;
2783 
2784     attr.name = "test";
2785     attr.attr_bits = 0U;
2786     attr.cb_mem = NULL;
2787     attr.cb_size = 0U;
2788     attr.stack_mem = NULL;
2789     attr.stack_size = TEST_TASK_STACK_SIZE;
2790     attr.priority = osPriorityAboveNormal6;
2791     g_getStackSpaceExit = 0;
2792     id = osThreadNew((osThreadFunc_t)CmsisThreadGetStackSpaceFunc001, NULL, &attr);
2793     osDelay(DELAY_TICKS_5);
2794     TEST_ASSERT_NOT_NULL(id);
2795     WaitThreadExit(id, &g_getStackSpaceExit);
2796 };
2797 
2798 /**
2799  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4280
2800  * @tc.name      : thread operation for resume input exception with NULL parameter
2801  * @tc.desc      : [C- SOFTWARE -0200]
2802 
2803  */
2804 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadResume002, Function | MediumTest | Level1)
2805 {
2806     UINT32 uwRet;
2807     uwRet = osThreadResume(NULL);
2808     TEST_ASSERT_EQUAL_INT(osErrorParameter, uwRet);
2809 };
2810 
2811 /**
2812  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4320
2813  * @tc.name      : thread operation for resume input exception
2814  * @tc.desc      : [C- SOFTWARE -0200]
2815 
2816  */
2817 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadResume003, Function | MediumTest | Level1)
2818 {
2819     UINT32 uwRet;
2820     g_puwTaskID01 = osThreadGetId();
2821     uwRet = osThreadResume(g_puwTaskID01);
2822     TEST_ASSERT_EQUAL_INT(osErrorResource, uwRet);
2823 };
2824 
2825 /**
2826  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4360
2827  * @tc.name      : thread operation for terminate input exception
2828  * @tc.desc      : [C- SOFTWARE -0200]
2829  */
2830 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate002, Function | MediumTest | Level1)
2831 {
2832     UINT32 uwRet;
2833     uwRet = osThreadTerminate(NULL);
2834     TEST_ASSERT_EQUAL_INT(osErrorParameter, uwRet);
2835 };
2836 
2837 /**
2838  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4400
2839  * @tc.name      : thread operation for terminate when priority = osPriorityLow7
2840  * @tc.desc      : [C- SOFTWARE -0200]
2841  */
2842 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate003, Function | MediumTest | Level1)
2843 {
2844     osThreadId_t id;
2845     osThreadAttr_t attr;
2846     attr.name = "test";
2847     attr.attr_bits = 0U;
2848     attr.cb_mem = NULL;
2849     attr.cb_size = 0U;
2850     attr.stack_mem = NULL;
2851     attr.stack_size = TEST_TASK_STACK_SIZE;
2852     attr.priority = osPriorityLow7;
2853     g_cmsisTestTaskCount = 0;
2854     g_cmsisTestTaskCount++;
2855     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
2856     TEST_ASSERT_NOT_NULL(id);
2857     osDelay(DELAY_TICKS_5);
2858     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
2859 };
2860 
2861 /**
2862  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4440
2863  * @tc.name      : thread operation for terminate when priority = osPriorityBelowNormal
2864  * @tc.desc      : [C- SOFTWARE -0200]
2865  */
2866 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate004, Function | MediumTest | Level1)
2867 {
2868     osThreadId_t id;
2869     osThreadAttr_t attr;
2870     attr.name = "test";
2871     attr.attr_bits = 0U;
2872     attr.cb_mem = NULL;
2873     attr.cb_size = 0U;
2874     attr.stack_mem = NULL;
2875     attr.stack_size = TEST_TASK_STACK_SIZE;
2876     attr.priority = osPriorityBelowNormal;
2877     g_cmsisTestTaskCount = 0;
2878     g_cmsisTestTaskCount++;
2879     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
2880     TEST_ASSERT_NOT_NULL(id);
2881     osDelay(DELAY_TICKS_5);
2882     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
2883 };
2884 
2885 /**
2886  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4480
2887  * @tc.name      : thread operation for terminate when priority = osPriorityBelowNormal7
2888  * @tc.desc      : [C- SOFTWARE -0200]
2889  */
2890 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate005, Function | MediumTest | Level1)
2891 {
2892     osThreadId_t id;
2893     osThreadAttr_t attr;
2894     attr.name = "test";
2895     attr.attr_bits = 0U;
2896     attr.cb_mem = NULL;
2897     attr.cb_size = 0U;
2898     attr.stack_mem = NULL;
2899     attr.stack_size = TEST_TASK_STACK_SIZE;
2900     attr.priority = osPriorityBelowNormal7;
2901     g_cmsisTestTaskCount = 0;
2902     g_cmsisTestTaskCount++;
2903     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
2904     TEST_ASSERT_NOT_NULL(id);
2905     osDelay(DELAY_TICKS_5);
2906     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
2907 };
2908 
2909 /**
2910  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4520
2911  * @tc.name      : thread operation for terminate when priority = osPriorityNormal
2912  * @tc.desc      : [C- SOFTWARE -0200]
2913  */
2914 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate006, Function | MediumTest | Level1)
2915 {
2916     osThreadId_t id;
2917     osThreadAttr_t attr;
2918     attr.name = "test";
2919     attr.attr_bits = 0U;
2920     attr.cb_mem = NULL;
2921     attr.cb_size = 0U;
2922     attr.stack_mem = NULL;
2923     attr.stack_size = TEST_TASK_STACK_SIZE;
2924     attr.priority = osPriorityNormal;
2925     g_cmsisTestTaskCount = 0;
2926     g_cmsisTestTaskCount++;
2927     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
2928     TEST_ASSERT_NOT_NULL(id);
2929     osDelay(DELAY_TICKS_5);
2930     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
2931 };
2932 
2933 /**
2934  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4560
2935  * @tc.name      : thread operation for terminate when priority = osPriorityNormal7
2936  * @tc.desc      : [C- SOFTWARE -0200]
2937  */
2938 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate007, Function | MediumTest | Level1)
2939 {
2940     osThreadId_t id;
2941     osThreadAttr_t attr;
2942     attr.name = "test";
2943     attr.attr_bits = 0U;
2944     attr.cb_mem = NULL;
2945     attr.cb_size = 0U;
2946     attr.stack_mem = NULL;
2947     attr.stack_size = TEST_TASK_STACK_SIZE;
2948     attr.priority = osPriorityNormal7;
2949     g_cmsisTestTaskCount = 0;
2950     g_cmsisTestTaskCount++;
2951     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
2952     TEST_ASSERT_NOT_NULL(id);
2953     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
2954 };
2955 
2956 /**
2957  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4600
2958  * @tc.name      : thread operation for terminate when priority = osPriorityAboveNormal
2959  * @tc.desc      : [C- SOFTWARE -0200]
2960  */
2961 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate008, Function | MediumTest | Level1)
2962 {
2963     osThreadId_t id;
2964     osThreadAttr_t attr;
2965     attr.name = "test";
2966     attr.attr_bits = 0U;
2967     attr.cb_mem = NULL;
2968     attr.cb_size = 0U;
2969     attr.stack_mem = NULL;
2970     attr.stack_size = TEST_TASK_STACK_SIZE;
2971     attr.priority = osPriorityAboveNormal;
2972     g_cmsisTestTaskCount = 0;
2973     g_cmsisTestTaskCount++;
2974     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
2975     TEST_ASSERT_NOT_NULL(id);
2976     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
2977 };
2978 
2979 /**
2980  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4640
2981  * @tc.name      : thread operation for terminate when priority = osPriorityAboveNormal6
2982  * @tc.desc      : [C- SOFTWARE -0200]
2983  */
2984 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadTerminate009, Function | MediumTest | Level1)
2985 {
2986     osThreadId_t id;
2987     osThreadAttr_t attr;
2988     attr.name = "test";
2989     attr.attr_bits = 0U;
2990     attr.cb_mem = NULL;
2991     attr.cb_size = 0U;
2992     attr.stack_mem = NULL;
2993     attr.stack_size = TEST_TASK_STACK_SIZE;
2994     attr.priority = osPriorityAboveNormal6;
2995     g_cmsisTestTaskCount = 0;
2996     g_cmsisTestTaskCount++;
2997     id = osThreadNew((osThreadFunc_t)CmsisThreadTerminateFunc001, NULL, &attr);
2998     TEST_ASSERT_NOT_NULL(id);
2999     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
3000 };
3001 
3002 /**
3003  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4680
3004  * @tc.name      : kernel operation for get info
3005  * @tc.desc      : [C- SOFTWARE -0200]
3006  */
3007 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelGetInfo001, Function | MediumTest | Level1)
3008 {
3009     CHAR infobuf[100];
3010     osVersion_t osv;
3011     osStatus_t status;
3012     status = osKernelGetInfo(&osv, infobuf, sizeof(infobuf));
3013     TEST_ASSERT_EQUAL_INT(osOK, status);
3014 };
3015 
3016 /**
3017  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4720
3018  * @tc.name      : kernel operation for get state
3019  * @tc.desc      : [C- SOFTWARE -0200]
3020  */
3021 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelGetState001, Function | MediumTest | Level1)
3022 {
3023     osKernelState_t uwRet;
3024     uwRet = osKernelGetState();
3025     TEST_ASSERT_EQUAL_INT(osKernelRunning, uwRet);
3026 };
3027 
3028 /**
3029  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4760
3030  * @tc.name      : kernel operation for get state after kernel lock
3031  * @tc.desc      : [C- SOFTWARE -0200]
3032  */
3033 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelGetState002, Function | MediumTest | Level1)
3034 {
3035     osKernelLock ();
3036     osKernelState_t uwRet;
3037     uwRet = osKernelGetState();
3038     TEST_ASSERT_EQUAL_INT(osKernelLocked, uwRet);
3039     osKernelUnlock ();
3040 };
3041 
3042 /**
3043  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4800
3044  * @tc.name      : kernel lock operation twice
3045  * @tc.desc      : [C- SOFTWARE -0200]
3046  */
3047 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelLock001, Function | MediumTest | Level1)
3048 {
3049     UINT32 uwRet;
3050     uwRet = osKernelLock();
3051     TEST_ASSERT_EQUAL_INT(0, uwRet);
3052     uwRet = osKernelLock();
3053     TEST_ASSERT_EQUAL_INT(1, uwRet);
3054     osKernelUnlock();
3055 };
3056 
3057 /**
3058  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4840
3059  * @tc.name      : kernel operation for lock
3060  * @tc.desc      : [C- SOFTWARE -0200]
3061 
3062  */
3063 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelLock002, Function | MediumTest | Level1)
3064 {
3065     UINT32 uwRet;
3066     osThreadId_t id;
3067     osThreadAttr_t attr;
3068     g_cmsisTestTaskCount = 0;
3069     attr.name = "test";
3070     attr.attr_bits = 0U;
3071     attr.cb_mem = NULL;
3072     attr.cb_size = 0U;
3073     attr.stack_mem = NULL;
3074     attr.stack_size = TEST_TASK_STACK_SIZE;
3075     attr.priority = osPriorityAboveNormal;
3076 
3077     uwRet = osKernelLock();
3078     TEST_ASSERT_EQUAL_INT(0, uwRet);
3079     id = osThreadNew((osThreadFunc_t)CmsisOSKernelLockFunc002, NULL, &attr);
3080     TEST_ASSERT_NOT_NULL(id);
3081     TEST_ASSERT_EQUAL_INT(0, g_cmsisTestTaskCount);
3082     uwRet = osKernelUnlock();
3083     TEST_ASSERT_EQUAL_INT(1, uwRet);
3084     TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
3085 };
3086 
3087 /**
3088  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4880
3089  * @tc.name      : kernel operation for unlock
3090  * @tc.desc      : [C- SOFTWARE -0200]
3091  */
3092 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelUnLock001, Function | MediumTest | Level1)
3093 {
3094     UINT32 uwRet;
3095     uwRet = osKernelUnlock();
3096     TEST_ASSERT_EQUAL_INT(0, uwRet);
3097 };
3098 
3099 /**
3100  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4920
3101  * @tc.name      : kernel operation for unlock after kernel lock
3102  * @tc.desc      : [C- SOFTWARE -0200]
3103  */
3104 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelUnLock002, Function | MediumTest | Level1)
3105 {
3106     UINT32 uwRet;
3107     (void)osKernelLock();
3108     uwRet = osKernelUnlock();
3109     TEST_ASSERT_EQUAL_INT(1, uwRet);
3110     uwRet = osKernelUnlock();
3111     TEST_ASSERT_EQUAL_INT(0, uwRet);
3112 };
3113 
3114 /**
3115  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_4960
3116  * @tc.name      : kernel operation for unlock after kernel lock twice
3117  * @tc.desc      : [C- SOFTWARE -0200]
3118  */
3119 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelUnLock003, Function | MediumTest | Level1)
3120 {
3121     UINT32 uwRet;
3122     (void)osKernelLock();
3123     (void)osKernelLock();
3124     uwRet = osKernelUnlock();
3125     TEST_ASSERT_EQUAL_INT(1, uwRet);
3126     uwRet = osKernelUnlock();
3127     TEST_ASSERT_EQUAL_INT(0, uwRet);
3128 };
3129 
3130 /**
3131  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_5000
3132  * @tc.name      : kernel operation for restore lock after kernel lock
3133  * @tc.desc      : [C- SOFTWARE -0200]
3134  */
3135 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelRestoreLock001, Function | MediumTest | Level1)
3136 {
3137     UINT32 uwRet;
3138     (void)osKernelLock();
3139     uwRet = osKernelRestoreLock(0);
3140     TEST_ASSERT_EQUAL_INT(0, uwRet);
3141     uwRet = osKernelUnlock();
3142     TEST_ASSERT_EQUAL_INT(0, uwRet);
3143 };
3144 
3145 /**
3146  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_5040
3147  * @tc.name      : kernel operation for restore lock after kernel lock twice
3148  * @tc.desc      : [C- SOFTWARE -0200]
3149  */
3150 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelRestoreLock002, Function | MediumTest | Level1)
3151 {
3152     UINT32 uwRet;
3153     (void)osKernelLock();
3154     (void)osKernelLock();
3155     uwRet = osKernelRestoreLock(0);
3156     TEST_ASSERT_EQUAL_INT(0, uwRet);
3157     uwRet = osKernelUnlock();
3158     TEST_ASSERT_EQUAL_INT(0, uwRet);
3159 };
3160 
3161 /**
3162  * @tc.number    : SUB_KERNEL_CMSIS_TASK_OPERATION_5080
3163  * @tc.name      : kernel operation for restore lock
3164  * @tc.desc      : [C- SOFTWARE -0200]
3165  */
3166 LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsKernelRestoreLock003, Function | MediumTest | Level1)
3167 {
3168     UINT32 uwRet;
3169     uwRet = osKernelUnlock();
3170     TEST_ASSERT_EQUAL_INT(0, uwRet);
3171     uwRet = osKernelRestoreLock(1);
3172     TEST_ASSERT_EQUAL_INT(1, uwRet);
3173     uwRet = osKernelUnlock();
3174     TEST_ASSERT_EQUAL_INT(1, uwRet);
3175 };
3176 
3177 RUN_TEST_SUITE(CmsisTaskFuncTestSuite);
3178