提交 034ab6dd 编写于 作者: C chuaizhzh

testOsThreadNew005

Change-Id: I3120cb2673b61bdda1d82f9d1522d9e9cd2b64c0
上级 cb3e98cc
...@@ -127,13 +127,37 @@ static void CmsisThreadCreat004Func001(void const *argument) ...@@ -127,13 +127,37 @@ static void CmsisThreadCreat004Func001(void const *argument)
osThreadExit(); osThreadExit();
} }
static void KeepRunByTick(UINT32 tick)
{
UINT32 tickA = osKernelGetTickCount();
UINT32 runned = 0;
UINT32 loop = 0;
UINT32 tickB = 0;
while (runned < tick) {
loop++;
tickB = osKernelGetTickCount();
if (tickB >= tickA) {
runned = tickB - tickA;
} else {
runned = tickB + (MAX_UINT32 - tickA);
}
if (loop % ALIVE_INFO_DIS == 0) {
printf("runned:%u, tickB:%u, tickA:%u, loop:%u\t\n",
runned, tickB, tickA, loop);
}
}
printf("return runned:%u, tickB:%u, tickA:%u\t\n",
runned, tickB, tickA);
return;
}
static void CmsisThreadCreat005Func001(void const *argument) static void CmsisThreadCreat005Func001(void const *argument)
{ {
(void)argument; (void)argument;
UINT32 uwIndex; UINT32 uwIndex;
TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount); TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
for (uwIndex = 0; uwIndex < TEST_TIME; uwIndex++) { while (g_cmsisTestTaskCount < TESTCOUNT_NUM_2) {
printf("test the thread running delay:%d \t\n", uwIndex); KeepRunByTick(DELAY_TICKS_10);
} }
g_cmsisTestTaskCount++; g_cmsisTestTaskCount++;
TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount); TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
...@@ -504,6 +528,9 @@ LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew005, Function | MediumTest ...@@ -504,6 +528,9 @@ LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew005, Function | MediumTest
g_cmsisTestTaskCount++; g_cmsisTestTaskCount++;
TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount); TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
osDelay(DELAY_TICKS_5); osDelay(DELAY_TICKS_5);
while (g_cmsisTestTaskCount != TESTCOUNT_NUM_3) {
KeepRunByTick(DELAY_TICKS_10);
}
}; };
/** /**
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#define THREAD_COUNT_MIN 3 #define THREAD_COUNT_MIN 3
#define THREAD_COUNT_MAX 30 #define THREAD_COUNT_MAX 30
#define THREAD_STACK_SPACE_MAX 4096 #define THREAD_STACK_SPACE_MAX 4096
#define MAX_UINT32 0xFFFFFFFF
#define ALIVE_INFO_DIS 10000
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册