!1081 liteos_m内核xts用例补齐部分cmsis
Merge pull request !1081 from zwx1232718/master
This commit is contained in:
commit
4140bd673e
|
@ -30,6 +30,10 @@ import("//kernel/liteos_m/liteos.gni")
|
|||
|
||||
static_library("cmsis_test") {
|
||||
sources = [
|
||||
"cmsis_event_func_test.c",
|
||||
"cmsis_msg_func_test.c",
|
||||
"cmsis_mutex_func_test.c",
|
||||
"cmsis_sem_func_test.c",
|
||||
"cmsis_timer_func_test.c",
|
||||
"xts_cmsis.c",
|
||||
]
|
||||
|
|
|
@ -0,0 +1,364 @@
|
|||
/*
|
||||
* Copyright (c) 2023-2023 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 "xts_cmsis.h"
|
||||
|
||||
osEventFlagsId_t g_eventId;
|
||||
UINT16 g_cmsisTestEventCount;
|
||||
|
||||
LITE_TEST_SUIT(Cmsis, Cmsisevent, CmsisEventFuncTestSuite);
|
||||
|
||||
static BOOL CmsisEventFuncTestSuiteSetUp(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CmsisEventFuncTestSuiteTearDown(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void CmsisEventFlagsWaitFunc001(void const *argument)
|
||||
{
|
||||
(void)argument;
|
||||
g_cmsisTestEventCount++;
|
||||
UINT32 ret = osEventFlagsWait(g_eventId, EVENT_MASK_HEX_11, (osFlagsWaitAll | osFlagsNoClear), osWaitForever);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, EVENT_MASK_HEX_11, ret);
|
||||
g_cmsisTestEventCount++;
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
static void CmsisEventFlagsSetFunc002(void const *argument)
|
||||
{
|
||||
(void)argument;
|
||||
UINT32 ret;
|
||||
g_cmsisTestEventCount++;
|
||||
ret = osEventFlagsWait(g_eventId, EVENT_MASK_HEX_11, (osFlagsWaitAll | osFlagsNoClear), TIMEOUT_NUM_3);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, osErrorTimeout, ret);
|
||||
g_cmsisTestEventCount++;
|
||||
|
||||
ret = osEventFlagsWait(g_eventId, EVENT_MASK_HEX_4, (osFlagsWaitAll | osFlagsNoClear), osWaitForever);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, TESTCOUNT_NUM_4, ret);
|
||||
g_cmsisTestEventCount++;
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
static void CmsisEventFlagsClearFunc001(void const *argument)
|
||||
{
|
||||
(void)argument;
|
||||
g_cmsisTestEventCount++;
|
||||
UINT32 ret = osEventFlagsWait(g_eventId, EVENT_MASK_HEX_1, osFlagsWaitAll, osWaitForever);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, EVENT_MASK_HEX_1, ret);
|
||||
g_cmsisTestEventCount++;
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0100
|
||||
* @tc.name : event operation for creat
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsNew001, Function | MediumTest | Level1)
|
||||
{
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_eventId, NULL, g_eventId);
|
||||
(void)osEventFlagsDelete(g_eventId);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0200
|
||||
* @tc.name : event operation for delete
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsDelete001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret;
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_eventId, NULL, g_eventId);
|
||||
ret = osEventFlagsDelete(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0300
|
||||
* @tc.name : event delete operation with EventFlagsId = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsDelete002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret = osEventFlagsDelete(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0400
|
||||
* @tc.name : event operation for flags set
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsSet001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret;
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_10);
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_MASK_HEX_10, ret);
|
||||
ret = osEventFlagsDelete(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0500
|
||||
* @tc.name : event reliability test for flags set
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsSet002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret;
|
||||
osThreadId_t id;
|
||||
osStatus_t status;
|
||||
osThreadAttr_t attr;
|
||||
attr.name = "test";
|
||||
attr.attr_bits = 0U;
|
||||
attr.cb_mem = NULL;
|
||||
attr.cb_size = 0U;
|
||||
attr.stack_mem = NULL;
|
||||
attr.stack_size = TEST_TASK_STACK_SIZE;
|
||||
attr.priority = osPriorityAboveNormal;
|
||||
|
||||
g_cmsisTestEventCount = 0;
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_eventId, NULL, g_eventId);
|
||||
id = osThreadNew((osThreadFunc_t)CmsisEventFlagsSetFunc002, NULL, &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(id, NULL, id);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, EVENT_MASK_HEX_1, g_cmsisTestEventCount);
|
||||
g_cmsisTestEventCount++;
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_2);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, TESTCOUNT_NUM_3, g_cmsisTestEventCount);
|
||||
|
||||
g_cmsisTestEventCount++;
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_11);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, TESTCOUNT_NUM_4, g_cmsisTestEventCount);
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_4);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, TESTCOUNT_NUM_5, g_cmsisTestEventCount);
|
||||
ret = osEventFlagsDelete(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0600
|
||||
* @tc.name : event flags set operation with EventFlagsId = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsSet003, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret = osEventFlagsSet(NULL, EVENT_MASK_HEX_10);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osFlagsErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0700
|
||||
* @tc.name : event operation for wait
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsWait001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret;
|
||||
osThreadId_t id;
|
||||
osThreadAttr_t attr;
|
||||
attr.name = "test";
|
||||
attr.attr_bits = 0U;
|
||||
attr.cb_mem = NULL;
|
||||
attr.cb_size = 0U;
|
||||
attr.stack_mem = NULL;
|
||||
attr.stack_size = TEST_TASK_STACK_SIZE;
|
||||
attr.priority = osPriorityAboveNormal;
|
||||
|
||||
g_cmsisTestEventCount = 0;
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_eventId, NULL, g_eventId);
|
||||
id = osThreadNew((osThreadFunc_t)CmsisEventFlagsWaitFunc001, NULL, &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(id, NULL, id);
|
||||
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_10);
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_MASK_HEX_10, ret);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, EVENT_MASK_HEX_1, g_cmsisTestEventCount);
|
||||
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_MASK_HEX_11, ret);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, TESTCOUNT_NUM_2, g_cmsisTestEventCount);
|
||||
|
||||
ret = osEventFlagsDelete(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0800
|
||||
* @tc.name : event operation for invalid option
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsWait002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret;
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_eventId, NULL, g_eventId);
|
||||
|
||||
ret = osEventFlagsWait(g_eventId, EVENT_MASK_HEX_11, INVALID_FLAG_OPTION, osWaitForever);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osFlagsErrorParameter, ret);
|
||||
|
||||
ret = osEventFlagsDelete(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_0900
|
||||
* @tc.name : event wait operation with EventFlagsId = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsWait003, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret = osEventFlagsWait(NULL, EVENT_MASK_HEX_11, (osFlagsWaitAll | osFlagsNoClear), osWaitForever);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osFlagsErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_1000
|
||||
* @tc.name : event operation for flags get
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsGet001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret;
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_10);
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_MASK_HEX_10, ret);
|
||||
ret = osEventFlagsGet(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_MASK_HEX_10, ret);
|
||||
|
||||
ret = osEventFlagsDelete(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_1100
|
||||
* @tc.name : event flags get operation with EventFlagsId = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsGet002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret = osEventFlagsGet(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_1200
|
||||
* @tc.name : event operation for flags clear
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsClear001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret;
|
||||
osThreadId_t id;
|
||||
|
||||
osThreadAttr_t attr;
|
||||
attr.name = "test";
|
||||
attr.attr_bits = 0U;
|
||||
attr.cb_mem = NULL;
|
||||
attr.cb_size = 0U;
|
||||
attr.stack_mem = NULL;
|
||||
attr.stack_size = TEST_TASK_STACK_SIZE;
|
||||
attr.priority = osPriorityAboveNormal;
|
||||
|
||||
g_cmsisTestEventCount = 0;
|
||||
g_eventId = osEventFlagsNew(NULL);
|
||||
id = osThreadNew((osThreadFunc_t)CmsisEventFlagsClearFunc001, NULL, &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(id, NULL, id);
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_10);
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_MASK_HEX_10, ret);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, EVENT_MASK_HEX_1, g_cmsisTestEventCount);
|
||||
|
||||
ret = osEventFlagsClear(g_eventId, 0xffff);
|
||||
ICUNIT_ASSERT_EQUAL(ret, EVENT_MASK_HEX_10, ret);
|
||||
ret = osEventFlagsGet(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = osEventFlagsSet(g_eventId, EVENT_MASK_HEX_1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisTestEventCount, TESTCOUNT_NUM_2, g_cmsisTestEventCount);
|
||||
ret = osEventFlagsDelete(g_eventId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_EVENT_OPERATION_1300
|
||||
* @tc.name : event flags clear operation with EventFlagsId = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisEventFuncTestSuite, testOsEventFlagsClear002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 ret = osEventFlagsClear(NULL, 0xffff);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osFlagsErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
RUN_TEST_SUITE(CmsisEventFuncTestSuite);
|
||||
|
||||
void CmsisEventFuncTest(void)
|
||||
{
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsNew001);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsDelete001);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsDelete002);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsSet001);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsSet002);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsSet003);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsWait001);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsWait002);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsWait003);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsGet001);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsGet002);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsClear001);
|
||||
RUN_ONE_TESTCASE(testOsEventFlagsClear002);
|
||||
}
|
|
@ -0,0 +1,419 @@
|
|||
/*
|
||||
* Copyright (c) 2023-2023 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 "xts_cmsis.h"
|
||||
|
||||
osMessageQueueId_t g_cmsisMqId;
|
||||
static char *g_cmsisMessageInfo[] = {"msg1", "msg2", "msg3", "msg4", "msg5", "msg6", "msg7", "msg8"};
|
||||
|
||||
LITE_TEST_SUIT(Cmsis, Cmsismsg, CmsisMsgFuncTestSuite);
|
||||
|
||||
static BOOL CmsisMsgFuncTestSuiteSetUp(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CmsisMsgFuncTestSuiteTearDown(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void CmsisMessageQueueGetFunc001(void const *argument)
|
||||
{
|
||||
(void)argument;
|
||||
osStatus_t uwRet;
|
||||
UINT8 msgPrio = 0;
|
||||
CHAR ucTemp[MSGINFO_LEN] = "";
|
||||
UINT32 uwCmp;
|
||||
uwRet = osMessageQueueGet(g_cmsisMqId, ucTemp, &msgPrio, TIMEOUT_COUNT);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
uwCmp = memcmp(ucTemp, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_0], MSGINFO_LEN);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, 0, uwCmp);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0100
|
||||
* @tc.name : message queue operation for creat
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueNew001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
(void)osMessageQueueDelete(g_cmsisMqId);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0200
|
||||
* @tc.name : message queue operation for creat when msg_count = 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueNew002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisMqId = osMessageQueueNew(0, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0300
|
||||
* @tc.name : message queue operation for creat when msg_size = 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueNew003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, 0, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0400
|
||||
* @tc.name : message queue operation for delete
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueDelete001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0500
|
||||
* @tc.name : message queue delete operation with mq_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueDelete002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet = osMessageQueueDelete(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osErrorParameter, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0600
|
||||
* @tc.name : message queue operation for put
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueuePut001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_0], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0700
|
||||
* @tc.name : message queue put operation with mq_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueuePut002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet = osMessageQueuePut(NULL, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_0], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osErrorParameter, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0800
|
||||
* @tc.name : message queue operation for put when msg_ptr = 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueuePut003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, NULL, 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osErrorParameter, uwRet);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_0900
|
||||
* @tc.name : message queue operation for get
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGet001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet;
|
||||
UINT32 uId;
|
||||
osThreadId_t id;
|
||||
osThreadAttr_t attr;
|
||||
attr.name = "test";
|
||||
attr.attr_bits = 0U;
|
||||
attr.cb_mem = NULL;
|
||||
attr.cb_size = 0U;
|
||||
attr.stack_mem = NULL;
|
||||
attr.stack_size = TEST_TASK_STACK_SIZE;
|
||||
attr.priority = osPriorityAboveNormal;
|
||||
uId = osKernelLock();
|
||||
ICUNIT_ASSERT_EQUAL(uId, 0, uId); /* 1, common data for test, no special meaning */
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
|
||||
id = osThreadNew((osThreadFunc_t)CmsisMessageQueueGetFunc001, NULL, &attr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(id, NULL, id);
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_0], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
uId = osKernelUnlock();
|
||||
ICUNIT_ASSERT_EQUAL(uId, 1, uId); /* 1, common data for test, no special meaning */
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1000
|
||||
* @tc.name : message queue get operation with mq_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGet002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet;
|
||||
UINT8 msgPrio = 0;
|
||||
CHAR ucTemp[MSGINFO_LEN] = "";
|
||||
uwRet = osMessageQueueGet(NULL, ucTemp, &msgPrio, TIMEOUT_COUNT);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osErrorParameter, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1100
|
||||
* @tc.name : message queue operation for get when msg_ptr = 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGet003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t uwRet;
|
||||
UINT8 msgPrio = 0;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
|
||||
uwRet = osMessageQueueGet(g_cmsisMqId, NULL, &msgPrio, TIMEOUT_COUNT);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osErrorParameter, uwRet);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1200
|
||||
* @tc.name : message queue operation for get msg size
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetMsgSize001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
|
||||
uwRet = osMessageQueueGetMsgSize(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, MSG_SIZE, uwRet);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1300
|
||||
* @tc.name : message queue get msg size with mq_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetMsgSize002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet = osMessageQueueGetMsgSize(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, 0, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1400
|
||||
* @tc.name : message queue operation for get capacity
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetCapacity001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
uwRet = osMessageQueueGetCapacity(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, MSGQUEUE_COUNT, uwRet);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1500
|
||||
* @tc.name : message queue get capacity with mq_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetCapacity002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet = osMessageQueueGetCapacity(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, 0, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1600
|
||||
* @tc.name : message queue operation for get count
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetCount001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_0], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_1], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_2], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
|
||||
uwRet = osMessageQueueGetCount(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, MSGQUEUE_PUT_COUNT, uwRet);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1700
|
||||
* @tc.name : message queue get count with mq_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetCount002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet = osMessageQueueGetCount(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, 0, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1800
|
||||
* @tc.name : message queue operation for get space
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetSpace001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet;
|
||||
g_cmsisMqId = osMessageQueueNew(MSGQUEUE_COUNT, MSG_SIZE, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisMqId, NULL, g_cmsisMqId);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_0], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_1], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
|
||||
uwRet = osMessageQueuePut(g_cmsisMqId, g_cmsisMessageInfo[MSGQUEUE_COUNT_INDEX_2], 0, 0);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
|
||||
uwRet = osMessageQueueGetSpace(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, MSGQUEUE_SPACE_COUNT, uwRet);
|
||||
|
||||
uwRet = osMessageQueueDelete(g_cmsisMqId);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, osOK, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MSG_OPERATION_1900
|
||||
* @tc.name : message queue get space with mq_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMsgFuncTestSuite, testOsMessageQueueGetSpace002, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet = osMessageQueueGetSpace(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(uwRet, 0, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
RUN_TEST_SUITE(CmsisMsgFuncTestSuite);
|
||||
|
||||
void CmsisMsgFuncTest(void)
|
||||
{
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueNew001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueNew002);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueNew003);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueDelete001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueDelete002);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueuePut001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueuePut002);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueuePut003);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGet001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGet002);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGet003);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetMsgSize001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetMsgSize002);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetCapacity001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetCapacity002);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetCount001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetCount002);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetSpace001);
|
||||
RUN_ONE_TESTCASE(testOsMessageQueueGetSpace002);
|
||||
}
|
|
@ -0,0 +1,296 @@
|
|||
/*
|
||||
* Copyright (c) 2023-2023 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 "xts_cmsis.h"
|
||||
|
||||
UINT16 g_cmsisTestMutexCount;
|
||||
osMutexId_t g_cmsisOsMutexId;
|
||||
osMutexAttr_t g_cmsisMutexAttr;
|
||||
|
||||
LITE_TEST_SUIT(Cmsis, Cmsismutex, CmsisMutexFuncTestSuite);
|
||||
|
||||
static BOOL CmsisMutexFuncTestSuiteSetUp(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CmsisMutexFuncTestSuiteTearDown(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void CmsisMutexGetOwnerFunc001(void const *argument)
|
||||
{
|
||||
(void)argument;
|
||||
osStatus_t ret;
|
||||
osThreadId_t id1;
|
||||
osThreadId_t id2;
|
||||
osThreadAttr_t attr;
|
||||
g_cmsisOsMutexId = osMutexNew(&g_cmsisMutexAttr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
|
||||
ret = osMutexAcquire(g_cmsisOsMutexId, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
id1 = osMutexGetOwner(g_cmsisOsMutexId);
|
||||
id2 = osThreadGetId();
|
||||
ICUNIT_ASSERT_STRING_EQUAL(id1, id2, id1);
|
||||
|
||||
attr.name = osThreadGetName(id1);
|
||||
ICUNIT_ASSERT_STRING_EQUAL("testMutexGetOwner001", attr.name, attr.name);
|
||||
|
||||
ret = osMutexRelease(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0100
|
||||
* @tc.name : mutex operation for creat with NULL para
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexNew001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisOsMutexId = osMutexNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
(void)osMutexDelete(g_cmsisOsMutexId);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0200
|
||||
* @tc.name : mutex operation for creat
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexNew002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisOsMutexId = osMutexNew(&g_cmsisMutexAttr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
(void)osMutexDelete(g_cmsisOsMutexId);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0300
|
||||
* @tc.name : mutex operation for delete after creat mutex with NULL parameter
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexDelete001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisOsMutexId = osMutexNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0400
|
||||
* @tc.name : mutex operation for delete
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexDelete002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisOsMutexId = osMutexNew(&g_cmsisMutexAttr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0500
|
||||
* @tc.name : mutex operation for delete after mutex acquire and release
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexDelete003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisOsMutexId = osMutexNew(NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
|
||||
osMutexAcquire(g_cmsisOsMutexId, LOS_WAIT_FOREVER);
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorResource, ret);
|
||||
|
||||
(void)osMutexRelease(g_cmsisOsMutexId);
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0600
|
||||
* @tc.name : mutex delete operation with mutex_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexDelete004, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret = osMutexDelete(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0700
|
||||
* @tc.name : mutex acquire operation with mutex_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexAcquire001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret = osMutexAcquire(NULL, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0800
|
||||
* @tc.name : mutex operation for acquire
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexAcquire002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisOsMutexId = osMutexNew(&g_cmsisMutexAttr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
|
||||
ret = osMutexAcquire(g_cmsisOsMutexId, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
(void)osMutexRelease(g_cmsisOsMutexId);
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_0900
|
||||
* @tc.name : mutex operation for release
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexRelease001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisOsMutexId = osMutexNew(&g_cmsisMutexAttr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisOsMutexId, NULL, g_cmsisOsMutexId);
|
||||
|
||||
ret = osMutexAcquire(g_cmsisOsMutexId, LOS_WAIT_FOREVER);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorResource, ret);
|
||||
|
||||
ret = osMutexRelease(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osMutexDelete(g_cmsisOsMutexId);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_1000
|
||||
* @tc.name : mutex release operation with mutex_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexRelease002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret = osMutexRelease(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_1100
|
||||
* @tc.name : mutex operation for get owner
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexGetOwner001, Function | MediumTest | Level1)
|
||||
{
|
||||
osThreadId_t id;
|
||||
osThreadAttr_t osAttr;
|
||||
osAttr.name = "testMutexGetOwner001";
|
||||
osAttr.attr_bits = 0U;
|
||||
osAttr.cb_mem = NULL;
|
||||
osAttr.cb_size = 0U;
|
||||
osAttr.stack_mem = NULL;
|
||||
osAttr.stack_size = TEST_TASK_STACK_SIZE;
|
||||
osAttr.priority = osPriorityAboveNormal;
|
||||
id = osThreadNew((osThreadFunc_t)CmsisMutexGetOwnerFunc001, NULL, &osAttr);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(id, NULL, id);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_MUTEX_OPERATION_1200
|
||||
* @tc.name : mutex get owner operation with mutex_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisMutexFuncTestSuite, testOsMutexGetOwner002, Function | MediumTest | Level1)
|
||||
{
|
||||
osThreadId_t id = osMutexGetOwner(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(id, NULL, id);
|
||||
return 0;
|
||||
};
|
||||
|
||||
RUN_TEST_SUITE(CmsisMutexFuncTestSuite);
|
||||
|
||||
void CmsisMutexFuncTest(void)
|
||||
{
|
||||
RUN_ONE_TESTCASE(testOsMutexNew001);
|
||||
RUN_ONE_TESTCASE(testOsMutexNew002);
|
||||
RUN_ONE_TESTCASE(testOsMutexDelete001);
|
||||
RUN_ONE_TESTCASE(testOsMutexDelete002);
|
||||
RUN_ONE_TESTCASE(testOsMutexDelete003);
|
||||
RUN_ONE_TESTCASE(testOsMutexDelete004);
|
||||
RUN_ONE_TESTCASE(testOsMutexAcquire001);
|
||||
RUN_ONE_TESTCASE(testOsMutexAcquire002);
|
||||
RUN_ONE_TESTCASE(testOsMutexRelease001);
|
||||
RUN_ONE_TESTCASE(testOsMutexRelease002);
|
||||
RUN_ONE_TESTCASE(testOsMutexGetOwner001);
|
||||
RUN_ONE_TESTCASE(testOsMutexGetOwner002);
|
||||
}
|
|
@ -0,0 +1,466 @@
|
|||
/*
|
||||
* Copyright (c) 2023-2023 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 "xts_cmsis.h"
|
||||
|
||||
osSemaphoreId_t g_cmsisSemSemaph;
|
||||
|
||||
LITE_TEST_SUIT(Cmsis, CmsisSem, CmsisSemFuncTestSuite);
|
||||
|
||||
static BOOL CmsisSemFuncTestSuiteSetUp(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CmsisSemFuncTestSuiteTearDown(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0100
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 1 and 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0200
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 10 and 1
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT10, SEMAPHHORE_COUNT_INT1, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0300
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 0 and 10
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT0, SEMAPHHORE_COUNT_INT10, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0400
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 0 and 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew004, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT0, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0500
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 1 and 1
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew005, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT1, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0600
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 10 and 10
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew006, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT10, SEMAPHHORE_COUNT_INT10, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0700
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 0xFE and 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew007, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_HEX_MAX, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0800
|
||||
* @tc.name : semaphore operation for creat when Semaphhore count = 0 and 0xFE
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreNew008, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t status;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT0, SEMAPHHORE_COUNT_HEX_MAX, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
(void)osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
status = osDelay(DELAY_TICKS_5);
|
||||
ICUNIT_ASSERT_EQUAL(status, osOK, status);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_0900
|
||||
* @tc.name : semaphore operation for delete
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreDelete001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT10, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1000
|
||||
* @tc.name : semaphore delete operation twice
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreDelete002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT10, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1100
|
||||
* @tc.name : semaphore delete operation with semaphore_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreDelete003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret = osSemaphoreDelete(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1200
|
||||
* @tc.name : semaphore operation for acquire when Semaphhore count = 1 and 1
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreAcquire001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT1, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
ret = osSemaphoreAcquire(g_cmsisSemSemaph, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1300
|
||||
* @tc.name : semaphore operation for acquire when Semaphhore count = 1 and 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreAcquire002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
ret = osSemaphoreAcquire(g_cmsisSemSemaph, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorResource, ret);
|
||||
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1400
|
||||
* @tc.name : semaphore operation for acquire when Semaphhore count = 0 and 1
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreAcquire003, Function | MediumTest | Level1)
|
||||
{
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT0, SEMAPHHORE_COUNT_INT1, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1500
|
||||
* @tc.name : semaphore acquire operation with semaphore_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreAcquire004, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret = osSemaphoreAcquire(NULL, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1600
|
||||
* @tc.name : semaphore operation for release
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreRelease001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
|
||||
ret = osSemaphoreAcquire(g_cmsisSemSemaph, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorResource, ret);
|
||||
|
||||
ret = osSemaphoreRelease(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1700
|
||||
* @tc.name : semaphore release operation twice
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreRelease002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
|
||||
ret = osSemaphoreRelease(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
ret = osSemaphoreRelease(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorResource, ret);
|
||||
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1800
|
||||
* @tc.name : semaphore operation for release after semaphore acquire
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreRelease003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT1, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
|
||||
ret = osSemaphoreRelease(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorResource, ret);
|
||||
|
||||
ret = osSemaphoreAcquire(g_cmsisSemSemaph, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osSemaphoreRelease(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
ret = osSemaphoreRelease(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorResource, ret);
|
||||
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_1900
|
||||
* @tc.name : semaphore release operation with semaphore_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreRelease004, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret = osSemaphoreRelease(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osErrorParameter, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_2000
|
||||
* @tc.name : semaphore operation for get count when Semaphhore count = 1 or 0xFE
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreGetCount001, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT1, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
ret = osSemaphoreGetCount(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 1, ret); /* 1, common data for test, no special meaning */
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_HEX_MAX, SEMAPHHORE_COUNT_HEX_MAX, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
ret = osSemaphoreGetCount(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, SEMAPHHORE_COUNT_HEX_MAX, ret);
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_2100
|
||||
* @tc.name : semaphore operation for get count when Semaphhore count = 1 or 0
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreGetCount002, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT1, SEMAPHHORE_COUNT_INT0, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
ret = osSemaphoreGetCount(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_INT0, SEMAPHHORE_COUNT_INT1, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_2200
|
||||
* @tc.name : semaphore operation for get count
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreGetCount003, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret;
|
||||
g_cmsisSemSemaph = osSemaphoreNew(SEMAPHHORE_COUNT_HEX_MAX, SEMAPHHORE_COUNT_HEX_MAX, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(g_cmsisSemSemaph, NULL, g_cmsisSemSemaph);
|
||||
ret = osSemaphoreAcquire(g_cmsisSemSemaph, osWaitForever);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
|
||||
ret = osSemaphoreGetCount(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, SEMAPHHORE_COUNT_HEX_MAX - 1, ret); /* 1, common data for test, no special meaning */
|
||||
ret = osSemaphoreDelete(g_cmsisSemSemaph);
|
||||
ICUNIT_ASSERT_EQUAL(ret, osOK, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_SEM_OPERATION_2300
|
||||
* @tc.name : semaphore get count operation with semaphore_id = NULL
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisSemFuncTestSuite, testOsSemaphoreGetCount004, Function | MediumTest | Level1)
|
||||
{
|
||||
osStatus_t ret = osSemaphoreGetCount(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
return 0;
|
||||
};
|
||||
|
||||
RUN_TEST_SUITE(CmsisSemFuncTestSuite);
|
||||
|
||||
void CmsisSemFuncTest(void)
|
||||
{
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew001);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew002);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew003);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew004);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew005);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew006);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew007);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreNew008);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreDelete001);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreDelete002);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreDelete003);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreAcquire001);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreAcquire002);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreAcquire003);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreAcquire004);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreRelease001);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreRelease002);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreRelease003);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreRelease004);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreGetCount001);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreGetCount002);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreGetCount003);
|
||||
RUN_ONE_TESTCASE(testOsSemaphoreGetCount004);
|
||||
}
|
|
@ -715,6 +715,18 @@ LITE_TEST_CASE(CmsisTimerFuncTestSuite, testOsKernelGetSysTimerFreq001, Function
|
|||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_KERNEL_CMSIS_TIMER_OPERATION_3400
|
||||
* @tc.name : os operation for get sys time count
|
||||
* @tc.desc : [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(CmsisTimerFuncTestSuite, testOsKernelGetSysTimerCount001, Function | MediumTest | Level1)
|
||||
{
|
||||
UINT32 uwRet = osKernelGetSysTimerCount();
|
||||
ICUNIT_ASSERT_WITHIN_EQUAL(uwRet, 0, UINT_MAX, uwRet);
|
||||
return 0;
|
||||
};
|
||||
|
||||
RUN_TEST_SUITE(CmsisTimerFuncTestSuite);
|
||||
|
||||
void CmsisTimerFuncTest(void)
|
||||
|
@ -752,4 +764,5 @@ void CmsisTimerFuncTest(void)
|
|||
RUN_ONE_TESTCASE(testOsTimerIsRunning009);
|
||||
RUN_ONE_TESTCASE(testOsKernelGetTickFreq001);
|
||||
RUN_ONE_TESTCASE(testOsKernelGetSysTimerFreq001);
|
||||
}
|
||||
RUN_ONE_TESTCASE(testOsKernelGetSysTimerCount001);
|
||||
}
|
|
@ -32,5 +32,9 @@
|
|||
|
||||
void CmsisFuncTest(void)
|
||||
{
|
||||
CmsisEventFuncTest();
|
||||
CmsisMsgFuncTest();
|
||||
CmsisMutexFuncTest();
|
||||
CmsisSemFuncTest();
|
||||
CmsisTimerFuncTest();
|
||||
}
|
|
@ -36,6 +36,39 @@
|
|||
#include <limits.h>
|
||||
#include "cmsis_os2.h"
|
||||
|
||||
#define LOS_WAIT_FOREVER 0xFFFFFFFF
|
||||
|
||||
#define TESTCOUNT_NUM_1 1
|
||||
#define TESTCOUNT_NUM_2 2
|
||||
#define TESTCOUNT_NUM_3 3
|
||||
#define TESTCOUNT_NUM_4 4
|
||||
#define TESTCOUNT_NUM_5 5
|
||||
|
||||
#define MSGQUEUE_COUNT 16
|
||||
#define MSGQUEUE_SPACE_COUNT 13
|
||||
#define MSGQUEUE_PUT_COUNT 3
|
||||
#define MSG_SIZE 4
|
||||
#define MSGINFO_LEN 4
|
||||
#define TIMEOUT_COUNT 1000
|
||||
#define BUF_LEN 32
|
||||
#define MSGQUEUE_COUNT_INDEX_0 0
|
||||
#define MSGQUEUE_COUNT_INDEX_1 1
|
||||
#define MSGQUEUE_COUNT_INDEX_2 2
|
||||
|
||||
#define SEMAPHHORE_COUNT_HEX_MAX 0xFE
|
||||
#define SEMAPHHORE_COUNT_INT0 0
|
||||
#define SEMAPHHORE_COUNT_INT1 1
|
||||
#define SEMAPHHORE_COUNT_INT10 10
|
||||
|
||||
#define EVENT_MASK_HEX_1 0x01
|
||||
#define EVENT_MASK_HEX_2 0x02
|
||||
#define EVENT_MASK_HEX_4 0x04
|
||||
#define EVENT_MASK_HEX_10 0x10
|
||||
#define EVENT_MASK_HEX_11 0x11
|
||||
#define TIMEOUT_NUM_3 3
|
||||
#define TIMEOUT_NUM_10 10
|
||||
#define INVALID_FLAG_OPTION 0x00000004U
|
||||
|
||||
#define MILLISEC_NUM_INT10 10U
|
||||
#define MILLISEC_NUM_INT4 4U
|
||||
#define INVALID_TIMER_TYPE 10
|
||||
|
|
Loading…
Reference in New Issue