From 143e8a7df647e052cf5e91b9702bd74e79ed4222 Mon Sep 17 00:00:00 2001 From: zhushengle Date: Tue, 30 Nov 2021 19:04:12 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BF=AE=E6=AD=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E4=B8=AD=E5=9B=BA=E5=AE=9A=E7=9A=84=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E8=AE=BE=E5=AE=9A=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close #I4KH68 Signed-off-by: zhushengle Change-Id: I9d23f63cd751a804966a7c6366590897f3858b72 --- testsuites/include/osTest.h | 16 ++------ testsuites/sample/kernel/event/It_los_event.h | 7 ---- testsuites/sample/kernel/power/It_los_pm.h | 7 ---- .../sample/kernel/queue/It_los_queue_016.c | 5 ++- .../sample/kernel/queue/It_los_queue_021.c | 5 ++- .../sample/kernel/queue/It_los_queue_022.c | 5 ++- .../sample/kernel/queue/It_los_queue_030.c | 5 ++- .../sample/kernel/queue/It_los_queue_034.c | 7 ++-- .../sample/kernel/queue/It_los_queue_090.c | 20 +++++----- .../kernel/queue/It_los_queue_head_015.c | 5 ++- .../kernel/queue/It_los_queue_head_016.c | 5 ++- .../kernel/queue/It_los_queue_head_022.c | 5 ++- .../kernel/queue/It_los_queue_head_025.c | 7 ++-- testsuites/sample/kernel/task/It_los_task.h | 7 ---- .../sample/kernel/task/It_los_task_039.c | 5 ++- .../sample/kernel/task/It_los_task_048.c | 8 +--- .../sample/kernel/task/It_los_task_087.c | 30 +-------------- testsuites/src/osTest.c | 38 ++++++++++++++++++- 18 files changed, 84 insertions(+), 103 deletions(-) diff --git a/testsuites/include/osTest.h b/testsuites/include/osTest.h index 0aa028ee..638f8f1b 100644 --- a/testsuites/include/osTest.h +++ b/testsuites/include/osTest.h @@ -230,18 +230,10 @@ extern EVENT_CB_S g_exampleEvent; #define OS_EVENT_TIMEOUT_MAX_VAL 0xFFFFFFFF -#if (LOSCFG_BASE_CORE_SWTMR == 1) -#define TASK_EXISTED_NUM 3 -#else -#define TASK_EXISTED_NUM 2 -#endif - - -#if (LOSCFG_BASE_CORE_SWTMR == 1) -#define QUEUE_EXISTED_NUM 1 -#else -#define QUEUE_EXISTED_NUM 0 -#endif +extern UINT32 QueueUsedCountGet(VOID); +extern UINT32 TaskUsedCountGet(VOID); +#define TASK_EXISTED_NUM TaskUsedCountGet() +#define QUEUE_EXISTED_NUM QueueUsedCountGet() #define HWI_NUM_INT_NEG (-4) #define HWI_NUM_INT0 0 diff --git a/testsuites/sample/kernel/event/It_los_event.h b/testsuites/sample/kernel/event/It_los_event.h index 75913049..c3cd85b4 100644 --- a/testsuites/sample/kernel/event/It_los_event.h +++ b/testsuites/sample/kernel/event/It_los_event.h @@ -41,13 +41,6 @@ extern "C" { #define SYS_EXIST_SWTMR 1 #define TEST_HWI_RUNTIME 0x100000 #define TASK_LOOP_NUM 0x100000 -#if (LOSCFG_BASE_CORE_SWTMR == 1) -#define TASK_EXISTED_NUM 3 -#else -#define TASK_EXISTED_NUM 2 -#endif - -#define TASK_EXISTED_D_NUM TASK_EXISTED_NUM #define TASK_NAME_NUM 10 #define IT_TASK_LOOP 20 diff --git a/testsuites/sample/kernel/power/It_los_pm.h b/testsuites/sample/kernel/power/It_los_pm.h index 6190979c..00c33492 100644 --- a/testsuites/sample/kernel/power/It_los_pm.h +++ b/testsuites/sample/kernel/power/It_los_pm.h @@ -43,13 +43,6 @@ extern "C" { #define TEST_HWI_RUNTIME 0x100000 #define TASK_LOOP_NUM 0x100000 -#if (LOSCFG_BASE_CORE_SWTMR == 1) -#define TASK_EXISTED_NUM 3 -#else -#define TASK_EXISTED_NUM 2 -#endif - -#define TASK_EXISTED_D_NUM TASK_EXISTED_NUM #define TASK_NAME_NUM 10 #define IT_TASK_LOOP 20 diff --git a/testsuites/sample/kernel/queue/It_los_queue_016.c b/testsuites/sample/kernel/queue/It_los_queue_016.c index 9fb36f99..22eb0dfb 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_016.c +++ b/testsuites/sample/kernel/queue/It_los_queue_016.c @@ -42,13 +42,14 @@ static UINT32 Testcase(VOID) ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, NULL, 0, QUEUE_BASE_MSGSIZE); ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_QUEUE_CREAT_PTR_NULL, ret); - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) + for (index = 0; index < limit; index++) LOS_QueueDelete(queueID[index]); return LOS_OK; diff --git a/testsuites/sample/kernel/queue/It_los_queue_021.c b/testsuites/sample/kernel/queue/It_los_queue_021.c index b520bc2e..b1530cec 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_021.c +++ b/testsuites/sample/kernel/queue/It_los_queue_021.c @@ -40,7 +40,8 @@ static UINT32 Testcase(VOID) CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP"; CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = ""; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -57,7 +58,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT); EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/queue/It_los_queue_022.c b/testsuites/sample/kernel/queue/It_los_queue_022.c index 6c04cd17..3eaafc9f 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_022.c +++ b/testsuites/sample/kernel/queue/It_los_queue_022.c @@ -40,7 +40,8 @@ static UINT32 Testcase(VOID) CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP"; CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = ""; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -55,7 +56,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT); EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/queue/It_los_queue_030.c b/testsuites/sample/kernel/queue/It_los_queue_030.c index e0f7faa4..fd54328b 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_030.c +++ b/testsuites/sample/kernel/queue/It_los_queue_030.c @@ -40,7 +40,8 @@ static UINT32 Testcase(VOID) CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP"; CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = ""; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -53,7 +54,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/queue/It_los_queue_034.c b/testsuites/sample/kernel/queue/It_los_queue_034.c index 79f44437..646f5688 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_034.c +++ b/testsuites/sample/kernel/queue/It_los_queue_034.c @@ -39,7 +39,8 @@ static UINT32 Testcase(VOID) UINT32 queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT + 1]; CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP"; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -47,13 +48,13 @@ static UINT32 Testcase(VOID) ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_CB_UNAVAILABLE, ret, EXIT); - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueWrite(queueID[index], &buff1, QUEUE_BASE_MSGSIZE, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/queue/It_los_queue_090.c b/testsuites/sample/kernel/queue/It_los_queue_090.c index bb1c3a16..d67f31b4 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_090.c +++ b/testsuites/sample/kernel/queue/It_los_queue_090.c @@ -46,7 +46,8 @@ static UINT32 Testcase(VOID) const UINT32 len = 1; const UINT32 count = 256; // 256, set maxMsgSize - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, len, &queueID[index], 0, count); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); @@ -60,7 +61,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_CB_UNAVAILABLE, ret, EXIT); for (j = 0; j < 100; j++) { // 100, test times - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { for (i = 0; i < len; i++) { ret = LOS_QueueWrite(queueID[index], filebuf, count, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); @@ -77,29 +78,28 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT); } } - ret = LOS_QueueWrite(queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM - 1], filebuf, count, 0); + ret = LOS_QueueWrite(queueID[limit - 1], filebuf, count, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - ret = LOS_QueueRead(queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM - 1], readbuf, count, 0); + ret = LOS_QueueRead(queueID[limit - 1], readbuf, count, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - ret = LOS_QueueInfoGet(queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM - 1], &queueInfo); + ret = LOS_QueueInfoGet(queueID[limit - 1], &queueInfo); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); ICUNIT_GOTO_EQUAL(queueInfo.queueLen, len, queueInfo.queueLen, EXIT); - ICUNIT_GOTO_EQUAL(queueInfo.queueID, queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM - 1], - queueInfo.queueID, EXIT); + ICUNIT_GOTO_EQUAL(queueInfo.queueID, queueID[limit - 1], queueInfo.queueID, EXIT); - ret = LOS_QueueRead(queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM - 1], readbuf, count, 0); + ret = LOS_QueueRead(queueID[limit - 1], readbuf, count, 0); ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT); - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } return LOS_OK; EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { LOS_QueueDelete(queueID[index]); } return LOS_OK; diff --git a/testsuites/sample/kernel/queue/It_los_queue_head_015.c b/testsuites/sample/kernel/queue/It_los_queue_head_015.c index fd875386..484acd92 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_head_015.c +++ b/testsuites/sample/kernel/queue/It_los_queue_head_015.c @@ -40,7 +40,8 @@ static UINT32 Testcase(VOID) CHAR buff1[8] = "UniDSP"; CHAR buff2[8] = ""; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -57,7 +58,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT); EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/queue/It_los_queue_head_016.c b/testsuites/sample/kernel/queue/It_los_queue_head_016.c index a133e63f..228c26af 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_head_016.c +++ b/testsuites/sample/kernel/queue/It_los_queue_head_016.c @@ -40,7 +40,8 @@ static UINT32 Testcase(VOID) CHAR buff1[8] = "UniDSP"; CHAR buff2[8] = ""; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -55,7 +56,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT); EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/queue/It_los_queue_head_022.c b/testsuites/sample/kernel/queue/It_los_queue_head_022.c index 672a0b05..053a9cda 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_head_022.c +++ b/testsuites/sample/kernel/queue/It_los_queue_head_022.c @@ -40,7 +40,8 @@ static UINT32 Testcase(VOID) CHAR buff1[8] = "UniDSP"; CHAR buff2[8]; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -52,7 +53,7 @@ static UINT32 Testcase(VOID) ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/queue/It_los_queue_head_025.c b/testsuites/sample/kernel/queue/It_los_queue_head_025.c index d769aa0a..ff2489f4 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_head_025.c +++ b/testsuites/sample/kernel/queue/It_los_queue_head_025.c @@ -40,7 +40,8 @@ static UINT32 Testcase(VOID) UINT32 queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT + 1]; CHAR buff1[8] = "UniDSP"; - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + UINT32 limit = LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; + for (index = 0; index < limit; index++) { ret = LOS_QueueCreate(NULL, QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } @@ -48,13 +49,13 @@ static UINT32 Testcase(VOID) ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_CB_UNAVAILABLE, ret, EXIT); - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueWriteHead(queueID[index], &buff1, QUEUE_BASE_MSGSIZE, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); } EXIT: - for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT - QUEUE_EXISTED_NUM; index++) { + for (index = 0; index < limit; index++) { ret = LOS_QueueDelete(queueID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/task/It_los_task.h b/testsuites/sample/kernel/task/It_los_task.h index 1e072d2e..6d18575b 100644 --- a/testsuites/sample/kernel/task/It_los_task.h +++ b/testsuites/sample/kernel/task/It_los_task.h @@ -43,13 +43,6 @@ extern "C" { #define TEST_HWI_RUNTIME 0x100000 #define TASK_LOOP_NUM 0x100000 -#if (LOSCFG_BASE_CORE_SWTMR == 1) -#define TASK_EXISTED_NUM 3 -#else -#define TASK_EXISTED_NUM 2 -#endif - -#define TASK_EXISTED_D_NUM TASK_EXISTED_NUM #define TASK_NAME_NUM 10 #define IT_TASK_LOOP 20 diff --git a/testsuites/sample/kernel/task/It_los_task_039.c b/testsuites/sample/kernel/task/It_los_task_039.c index 3cdfb51f..0395c76b 100644 --- a/testsuites/sample/kernel/task/It_los_task_039.c +++ b/testsuites/sample/kernel/task/It_los_task_039.c @@ -55,7 +55,8 @@ static UINT32 TestCase(VOID) LOS_TaskLock(); - for (index = 0; index < LOSCFG_BASE_CORE_TSK_LIMIT - TASK_EXISTED_D_NUM + 1; index++) { + UINT32 limit = LOSCFG_BASE_CORE_TSK_LIMIT - TaskUsedCountGet(); + for (index = 0; index < limit + 1; index++) { task1.usTaskPrio = index % OS_TASK_PRIORITY_LOWEST; task1.pcName = acName; task1.uwResved = LOS_TASK_STATUS_DETACHED; @@ -70,7 +71,7 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_TSK_TCB_UNAVAILABLE, ret, EXIT); EXIT: - for (index = 0; index < LOSCFG_BASE_CORE_TSK_LIMIT - TASK_EXISTED_D_NUM + 1; index++) { + for (index = 0; index < limit + 1; index++) { ret = LOS_TaskDelete(testTaskID[index]); ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); } diff --git a/testsuites/sample/kernel/task/It_los_task_048.c b/testsuites/sample/kernel/task/It_los_task_048.c index 8d866ed6..0c69785d 100644 --- a/testsuites/sample/kernel/task/It_los_task_048.c +++ b/testsuites/sample/kernel/task/It_los_task_048.c @@ -59,13 +59,7 @@ static UINT32 TestCase(VOID) task1.uwStackSize = TASK_STACK_SIZE_TEST; task1.pcName = "Tsk048A"; 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. - task1.usTaskPrio = 1; - } else { - task1.usTaskPrio = 0; - } + task1.usTaskPrio = 1; g_testCount = 0; diff --git a/testsuites/sample/kernel/task/It_los_task_087.c b/testsuites/sample/kernel/task/It_los_task_087.c index 1b7c19a9..8b3ce849 100644 --- a/testsuites/sample/kernel/task/It_los_task_087.c +++ b/testsuites/sample/kernel/task/It_los_task_087.c @@ -39,27 +39,6 @@ static VOID TaskF01(VOID) return; } -#ifdef __RISC_V__ -static UINT32 OsShellCmdTaskCntGet(VOID) -{ - UINT32 loop; - UINT32 taskCnt = 0; - UINT32 intSave; - LosTaskCB *taskCB = (LosTaskCB *)NULL; - - intSave = LOS_IntLock(); - for (loop = 0; loop < g_taskMaxNum; loop++) { - taskCB = (((LosTaskCB *)g_taskCBArray) + loop); - if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) { - continue; - } - taskCnt++; - } - (VOID)LOS_IntRestore(intSave); - return taskCnt; -} -#endif - static UINT32 TestCase(VOID) { UINT32 ret; @@ -69,19 +48,12 @@ static UINT32 TestCase(VOID) UINT8 pro; CHAR acName[TASK_NAME_NUM]; UINT32 auwTestTaskID[LOSCFG_BASE_CORE_TSK_LIMIT]; -#ifdef __RISC_V__ - UINT32 taskCnt; - taskCnt = OsShellCmdTaskCntGet(); -#endif + UINT32 taskCnt = TaskUsedCountGet(); TSK_INIT_PARAM_S task1 = { 0 }; task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01; task1.uwStackSize = LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE; -#ifdef __RISC_V__ g_leavingTaskNum = LOSCFG_BASE_CORE_TSK_LIMIT - taskCnt; -#else - g_leavingTaskNum = LOSCFG_BASE_CORE_TSK_LIMIT - TASK_EXISTED_NUM; -#endif LOS_TaskLock(); if (LOSCFG_BASE_CORE_SWTMR == 1) { diff --git a/testsuites/src/osTest.c b/testsuites/src/osTest.c index bd42741a..054969ff 100644 --- a/testsuites/src/osTest.c +++ b/testsuites/src/osTest.c @@ -79,7 +79,6 @@ UINT32 g_usSemID3[LOSCFG_BASE_IPC_SEM_CONFIG + 1]; #define TST_RAMADDRSTART 0x20000000 #define TST_RAMADDREND 0x20010000 -#if (CMSIS_OS_VER == 2) extern SWTMR_CTRL_S *g_swtmrCBArray; UINT32 SwtmrCountGetTest(VOID) { @@ -98,7 +97,42 @@ UINT32 SwtmrCountGetTest(VOID) (VOID)LOS_IntRestore(intSave); return swTmrCnt; } -#endif + +extern LosQueueCB *g_allQueue; +UINT32 QueueUsedCountGet(VOID) +{ + UINT32 intSave; + UINT32 count = 0; + + intSave = LOS_IntLock(); + for (UINT32 index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT; index++) { + LosQueueCB *queueNode = ((LosQueueCB *)g_allQueue) + index; + if (queueNode->queueState == OS_QUEUE_INUSED) { + count++; + } + } + LOS_IntRestore(intSave); + + return count; +} + +extern LosTaskCB *g_taskCBArray; +UINT32 TaskUsedCountGet(VOID) +{ + UINT32 intSave; + UINT32 count = 0; + + intSave = LOS_IntLock(); + for (UINT32 index = 0; index < LOSCFG_BASE_CORE_TSK_LIMIT; index++) { + LosTaskCB *taskCB = ((LosTaskCB *)g_taskCBArray) + index; + if (taskCB->taskStatus & OS_TASK_STATUS_UNUSED) { + count++; + } + } + LOS_IntRestore(intSave); + + return (LOSCFG_BASE_CORE_TSK_LIMIT - count); +} void TestKernel(void) {