feat: 支持posix 和 cmsis join能力

支持API:
  LOS_TaskJoin
  LOS_TaskDeatch
  pthread_join
  pthread_deatch
  osThreadJoin
  osThreadDetach
Close #I44V26

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib61e69c280eef2e4b3b79d9bba7bbd5a300c7fe4
This commit is contained in:
zhushengle
2021-09-15 16:49:01 +08:00
parent 23f634bde5
commit 96b4c460e2
38 changed files with 1084 additions and 166 deletions

View File

@@ -144,6 +144,11 @@ static_library("test_task") {
"It_los_task_115.c",
"It_los_task_116.c",
"It_los_task_117.c",
"It_los_task_118.c",
"It_los_task_119.c",
"It_los_task_120.c",
"It_los_task_121.c",
"It_los_task_122.c",
]
configs += [ "//kernel/liteos_m/testsuits:include" ]

View File

@@ -32,7 +32,6 @@
#include "osTest.h"
#include "It_los_task.h"
VOID ItSuiteLosTask()
{
ItLosTask001();
@@ -76,8 +75,11 @@ VOID ItSuiteLosTask()
ItLosTask042();
ItLosTask046();
ItLosTask047();
ItLosTask048();
ItLosTask049();
ItLosTask050();
ItLosTask051();
ItLosTask052();
ItLosTask055();
ItLosTask057();
ItLosTask058();
@@ -95,28 +97,8 @@ VOID ItSuiteLosTask()
ItLosTask076();
ItLosTask077();
ItLosTask078();
#if (LOS_KERNEL_TEST_FULL == 1)
ItLosTask039();
ItLosTask040();
ItLosTask043();
ItLosTask048();
ItLosTask051();
ItLosTask052();
ItLosTask056();
ItLosTask063();
ItLosTask075();
ItLosTask079();
ItLosTask081();
ItLosTask082();
ItLosTask083();
ItLosTask085();
ItLosTask087();
ItLosTask088();
ItLosTask089();
ItLosTask090();
ItLosTask092();
ItLosTask093();
ItLosTask094();
ItLosTask095();
ItLosTask097();
@@ -135,6 +117,28 @@ VOID ItSuiteLosTask()
ItLosTask112();
ItLosTask113();
ItLosTask115();
ItLosTask118();
ItLosTask119();
ItLosTask120();
ItLosTask121();
ItLosTask122();
#if (LOS_KERNEL_TEST_FULL == 1)
ItLosTask039();
ItLosTask040();
ItLosTask043();
ItLosTask056();
ItLosTask063();
ItLosTask075();
ItLosTask079();
ItLosTask081();
ItLosTask082();
ItLosTask083();
ItLosTask085();
ItLosTask087();
ItLosTask088();
ItLosTask090();
ItLosTask093();
ItLosTask116();
#if (LOS_KERNEL_HWI_TEST == 1)
ItLosTask053();

View File

@@ -179,6 +179,11 @@ extern VOID ItLosTask114(VOID);
extern VOID ItLosTask115(VOID);
extern VOID ItLosTask116(VOID);
extern VOID ItLosTask117(VOID);
extern VOID ItLosTask118(VOID);
extern VOID ItLosTask119(VOID);
extern VOID ItLosTask120(VOID);
extern VOID ItLosTask121(VOID);
extern VOID ItLosTask122(VOID);
#ifdef __cplusplus
#if __cplusplus

View File

@@ -48,7 +48,6 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk014A";
task1.usTaskPrio = TASK_PRIO_TEST - 1;
task1.uwResved = -1;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);

View File

@@ -58,7 +58,7 @@ static UINT32 TestCase(VOID)
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk048A";
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
if (TASK_EXISTED_D_NUM == 4) { // 4, set priority based on TASK_EXISTED_D_NUM.
task1.usTaskPrio = 2; // 2, TASK_EXISTED_D_NUM == 4, set 2 as priority.
} else if (TASK_EXISTED_D_NUM == 3) { // 3, set reasonable priority based on TASK_EXISTED_D_NUM.
@@ -75,11 +75,14 @@ static UINT32 TestCase(VOID)
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
task1.pcName = "Tsk048B";
task1.usTaskPrio = LOS_TASK_PRIORITY_LOWEST - 1;
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskDelay(2); // 2, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskJoin(g_testTaskID02, NULL);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.

View File

@@ -50,6 +50,7 @@ static VOID TaskF01(VOID)
task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
task1.pcName = "Tsk051B";
task1.usTaskPrio = TASK_PRIO_TEST - 1;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
g_testCount++;
@@ -57,7 +58,7 @@ static VOID TaskF01(VOID)
ret = LOS_TaskCreate(&g_testTaskID02, &task1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskDelay(2); // 2, set delay time
ret = LOS_TaskJoin(g_testTaskID02, NULL);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
@@ -76,13 +77,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk051A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskDelay(2); // 2, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // 3, Here, assert that g_testCount is equal to 3.

View File

@@ -65,7 +65,7 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk094A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = 0;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
task1.uwArg = 0xffff;
g_testCount = 0;
@@ -101,12 +101,22 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_TaskJoin(g_testTaskID02, NULL);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_TaskJoin(g_testTaskID03, NULL);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskDelete(g_testTaskID02);
LOS_TaskDelete(g_testTaskID03);
LOS_TaskJoin(g_testTaskID01, NULL);
LOS_TaskJoin(g_testTaskID02, NULL);
LOS_TaskJoin(g_testTaskID03, NULL);
return LOS_OK;
}

View File

@@ -47,7 +47,7 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk095A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreateOnly(&g_testTaskID01, &task1);
@@ -56,7 +56,8 @@ static UINT32 TestCase(VOID)
LOS_TaskResume(g_testTaskID01);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_TaskCreateOnly(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
@@ -66,11 +67,13 @@ static UINT32 TestCase(VOID)
ret = LOS_TaskDelete(g_testTaskID01);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -72,13 +72,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk097A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
@@ -92,7 +93,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -74,7 +74,7 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk098A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
@@ -84,7 +84,8 @@ static UINT32 TestCase(VOID)
LOS_TaskResume(g_testTaskID01);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
@@ -98,6 +99,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -55,7 +55,7 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk100A";
task1.usTaskPrio = TASK_PRIO_TEST - 1;
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
@@ -70,7 +70,8 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = LOS_TaskPriGet(g_testTaskID01);
ICUNIT_ASSERT_EQUAL(ret, (UINT16)OS_INVALID, ret);
@@ -78,6 +79,7 @@ static UINT32 TestCase(VOID)
return LOS_OK;
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -55,7 +55,7 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk101A";
task1.usTaskPrio = TASK_PRIO_TEST - 1;
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
@@ -70,7 +70,8 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_TaskPriGet(g_testTaskID01);
ICUNIT_ASSERT_EQUAL(ret, (UINT16)OS_INVALID, ret);
@@ -78,6 +79,7 @@ static UINT32 TestCase(VOID)
return LOS_OK;
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -86,13 +86,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk103A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(20); // 20, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
@@ -100,7 +101,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -91,13 +91,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk104A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
@@ -105,7 +106,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -58,7 +58,7 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk105A";
task1.usTaskPrio = TASK_PRIO_TEST - 1;
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
@@ -79,7 +79,8 @@ static UINT32 TestCase(VOID)
ret = LOS_TaskPriSet(g_testTaskID01, OS_TASK_PRIORITY_LOWEST + 1);
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_TSK_PRIOR_ERROR, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
@@ -90,6 +91,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -89,13 +89,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk107A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
@@ -103,7 +104,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -92,13 +92,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk108A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(20); // 20, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
@@ -106,7 +107,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -88,14 +88,15 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk109A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
@@ -103,7 +104,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -94,13 +94,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk110A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
@@ -108,7 +109,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -42,10 +42,10 @@ static VOID TaskF02(VOID)
g_testCount++;
// 3, modify task priority, base on testsuite task`s priority.
ret = LOS_TaskPriSet(g_testTaskID01, TASK_PRIO_TEST - 3);
ret = LOS_TaskPriSet(g_testTaskID01, TASK_PRIO_TEST - 1); /* 1: Priority is relatively cheap */
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); /* 1: count */
g_testCount++;
return;
@@ -70,7 +70,7 @@ static VOID TaskF01(VOID)
ret = LOS_TaskPriGet(g_testTaskID01);
// 3, Assert this result is consistent with the priority that has been set.
ICUNIT_ASSERT_EQUAL_VOID(ret, TASK_PRIO_TEST - 3, ret);
ICUNIT_ASSERT_EQUAL_VOID(ret, TASK_PRIO_TEST - 1, ret); /* 1: Priority is relatively cheap */
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
g_testCount++;
@@ -91,13 +91,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk111A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
@@ -105,7 +106,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -32,9 +32,6 @@
#include "osTest.h"
#include "It_los_task.h"
static VOID TaskF02(VOID)
{
UINT32 ret;
@@ -93,13 +90,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk112A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert that g_testCount is equal to 3.
@@ -107,7 +105,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -99,13 +99,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk113A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, Here, assert that g_testCount is equal to 5.
@@ -113,7 +114,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -98,13 +98,14 @@ static UINT32 TestCase(VOID)
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk078A";
task1.usTaskPrio = TASK_PRIO_TEST - 2; // 2, set new task priority, it is higher than the current task.
task1.uwResved = LOS_TASK_STATUS_DETACHED;
task1.uwResved = LOS_TASK_ATTR_JOINABLE;
g_testCount = 0;
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_TaskDelay(10); // 10, set delay time
ret = LOS_TaskJoin(g_testTaskID01, NULL);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert that g_testCount is equal to 4.
@@ -112,7 +113,7 @@ static UINT32 TestCase(VOID)
EXIT:
LOS_TaskDelete(g_testTaskID01);
LOS_TaskJoin(g_testTaskID01, NULL);
return LOS_OK;
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "It_los_task.h"
static VOID *TaskJoinf01(void *argument)
{
g_testCount++;
return (VOID *)9; /* 9: return val */
}
static UINT32 TestCase(VOID)
{
UINT32 taskID;
UINT32 ret;
UINTPTR uwtemp = 1;
TSK_INIT_PARAM_S osTaskInitParam = { 0 };
g_testCount = 0;
osTaskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskJoinf01;
osTaskInitParam.uwStackSize = OS_TSK_TEST_STACK_SIZE;
osTaskInitParam.pcName = "Join";
osTaskInitParam.usTaskPrio = TASK_PRIO_TEST;
osTaskInitParam.uwResved = LOS_TASK_ATTR_JOINABLE;
ret = LOS_TaskCreate(&taskID, &osTaskInitParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = LOS_TaskJoin(taskID, &uwtemp);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(uwtemp, 9, uwtemp); /* 8: pthread exit code */
return LOS_OK;
}
VOID ItLosTask118(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosTask118", TestCase, TEST_LOS, TEST_TASK, TEST_LEVEL0, TEST_FUNCTION);
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "It_los_task.h"
static VOID *TaskDeatchf01(void *argument)
{
int ret = LOS_TaskDetach(LOS_CurTaskIDGet());
ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_TSK_NOT_JOIN, ret);
g_testCount++;
return NULL;
}
static UINT32 TestCase(VOID)
{
UINT32 ret;
UINT32 taskID;
TSK_INIT_PARAM_S osTaskInitParam = { 0 };
g_testCount = 0;
osTaskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskDeatchf01;
osTaskInitParam.uwStackSize = OS_TSK_TEST_STACK_SIZE;
osTaskInitParam.pcName = "IT_TST_INI";
osTaskInitParam.usTaskPrio = TASK_PRIO_TEST + 1;
osTaskInitParam.uwResved = LOS_TASK_ATTR_JOINABLE;
ret = LOS_TaskCreate(&taskID, &osTaskInitParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = LOS_TaskJoin(taskID, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
return LOS_OK;
}
VOID ItLosTask119(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosTask119", TestCase, TEST_LOS, TEST_TASK, TEST_LEVEL0, TEST_FUNCTION);
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "It_los_task.h"
static VOID *TaskDeatchf01(void *argument)
{
UINT32 ret = LOS_TaskDetach(LOS_CurTaskIDGet());
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
g_testCount++;
LOS_TaskDelay(1000); /* 1000 ticks */
return NULL;
}
static UINT32 TestCase(VOID)
{
UINT32 ret;
UINT32 taskID;
TSK_INIT_PARAM_S osTaskInitParam = { 0 };
g_testCount = 0;
osTaskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskDeatchf01;
osTaskInitParam.uwStackSize = OS_TSK_TEST_STACK_SIZE;
osTaskInitParam.pcName = "deatch";
osTaskInitParam.usTaskPrio = TASK_PRIO_TEST - 1;
osTaskInitParam.uwResved = LOS_TASK_ATTR_JOINABLE;
ret = LOS_TaskCreate(&taskID, &osTaskInitParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
ret = LOS_TaskJoin(taskID, NULL);
ICUNIT_ASSERT_EQUAL(ret, LOS_NOK, ret);
return LOS_OK;
}
VOID ItLosTask120(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosTask120", TestCase, TEST_LOS, TEST_TASK, TEST_LEVEL0, TEST_FUNCTION);
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "It_los_task.h"
static VOID *TaskDeatchf01(void *argument)
{
UINT32 ret = LOS_TaskDetach(LOS_CurTaskIDGet());
ICUNIT_ASSERT_EQUAL(ret, LOS_NOK, ret);
g_testCount++;
LOS_TaskDelay(1000); /* 1000 ticks */
return NULL;
}
static UINT32 TestCase(VOID)
{
UINT32 ret;
UINT32 taskID;
TSK_INIT_PARAM_S osTaskInitParam = { 0 };
g_testCount = 0;
osTaskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskDeatchf01;
osTaskInitParam.uwStackSize = OS_TSK_TEST_STACK_SIZE;
osTaskInitParam.pcName = "deatch";
osTaskInitParam.usTaskPrio = TASK_PRIO_TEST - 1;
ret = LOS_TaskCreate(&taskID, &osTaskInitParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
ret = LOS_TaskJoin(taskID, NULL);
ICUNIT_ASSERT_EQUAL(ret, LOS_NOK, ret);
return LOS_OK;
}
VOID ItLosTask121(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosTask121", TestCase, TEST_LOS, TEST_TASK, TEST_LEVEL0, TEST_FUNCTION);
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "It_los_task.h"
static UINT32 g_joinTaskID;
static VOID *TaskJoinf01(void *argument)
{
g_testCount++;
return NULL;
}
static VOID *TaskJoinf02(VOID *argument)
{
UINT32 ret = LOS_TaskDelete(g_joinTaskID);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return NULL;
}
static UINT32 TestCase(VOID)
{
UINT32 taskID;
UINT32 ret;
UINTPTR temp = 0;
TSK_INIT_PARAM_S osTaskInitParam = { 0 };
g_testCount = 0;
osTaskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskJoinf01;
osTaskInitParam.uwStackSize = OS_TSK_TEST_STACK_SIZE;
osTaskInitParam.pcName = "Join";
osTaskInitParam.usTaskPrio = TASK_PRIO_TEST + 1;
osTaskInitParam.uwResved = LOS_TASK_ATTR_JOINABLE;
ret = LOS_TaskCreate(&g_joinTaskID, &osTaskInitParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
osTaskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskJoinf02;
osTaskInitParam.uwStackSize = OS_TSK_TEST_STACK_SIZE;
osTaskInitParam.pcName = "deatch";
osTaskInitParam.usTaskPrio = TASK_PRIO_TEST - 1;
ret = LOS_TaskCreate(&taskID, &osTaskInitParam);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = LOS_TaskJoin(g_joinTaskID, &temp);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(temp, taskID, temp);
return LOS_OK;
}
VOID ItLosTask122(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosTask122", TestCase, TEST_LOS, TEST_TASK, TEST_LEVEL0, TEST_FUNCTION);
}