提交 e0b4fcb2 编写于 作者: X xuxinyu

test: replace unsecure function with secure function

Signed-off-by: Nxuxinyu <xuxinyu6@huawei.com>
Change-Id: Ie120ffa529798f0f087ddfcd34f5d9c5802b6766
上级 44ec1994
......@@ -86,14 +86,14 @@ extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
do { \
memset(&testTask, 0, sizeof(TSK_INIT_PARAM_S)); \
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
testTask.uwStackSize = 0x1000; \
testTask.pcName = task_name; \
testTask.usTaskPrio = prio; \
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
do { \
(void)memset_s(&(testTask), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S)); \
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
testTask.uwStackSize = 0x1000; \
testTask.pcName = task_name; \
testTask.usTaskPrio = prio; \
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
} while (0);
#ifdef LOSCFG_KERNEL_SMP
......
......@@ -50,7 +50,7 @@ VOID RecordIntrTrace(INT32 irq, INT32 direction)
VOID ResetIntrTrace(VOID)
{
g_traceIdx = 0;
memset(g_intrTrace, 0, RECORD_SIZE);
(void)memset_s(g_intrTrace, RECORD_SIZE, 0, RECORD_SIZE);
}
UINT32 CheckIntrTrace(UINT32 *expect, UINT32 num)
......
......@@ -44,7 +44,7 @@ static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
g_intrHandleEnd = 1;
UINT32 temp[0x100][2] = {0};
memset(temp, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
(void)memset_s(temp, sizeof(UINT32) * 0x100 * 2, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
}
static VOID TaskF01(VOID)
......
......@@ -58,7 +58,7 @@ static UINT32 Testcase(void)
// 32, number of cycles
for (index = 0; index < 32; index++) {
task1.usTaskPrio = index;
snprintf(acName, 10, "Tsk040A%2d", index); // 10, snprintf size.
(void)snprintf_s(acName, TASK_NAME_NUM, TASK_NAME_NUM - 1, "Tsk040A%2d", index);
task1.pcName = acName;
task1.uwResved = LOS_TASK_STATUS_DETACHED;
......
......@@ -58,9 +58,10 @@ EXIT:
static UINT32 Testcase(void)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
LOS_EventInit(&g_eventCb01);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "Tsk082A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -142,7 +142,8 @@ static UINT32 Testcase(void)
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk118B";
......
......@@ -142,7 +142,8 @@ static UINT32 Testcase(void)
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk118B";
......
......@@ -80,7 +80,8 @@ static UINT32 Testcase(void)
currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM;
#endif
memset(&task, 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
task.pfnTaskEntry = (TSK_ENTRY_FUNC)ItTimeslice001F01;
task.usTaskPrio = TASK_PRIO_TEST_TASK + 1;
task.pcName = "it_timeslice_001_f01";
......
......@@ -99,7 +99,8 @@ static UINT32 Testcase(void)
currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM;
#endif
memset(&task, 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
task.pfnTaskEntry = (TSK_ENTRY_FUNC)ItTimeslice002F01;
task.usTaskPrio = TASK_PRIO_TEST_TASK + 1;
task.pcName = "it_timeslice_002_f01";
......
......@@ -57,8 +57,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk1";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -60,8 +60,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk2";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -56,8 +56,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk3";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -57,8 +57,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk4";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -62,8 +62,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk6";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -88,8 +88,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk7";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -62,8 +62,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk8";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -70,8 +70,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk9";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -62,8 +62,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk10";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -69,8 +69,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk11";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -74,8 +74,8 @@ static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk12";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -75,8 +75,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk13";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -67,8 +67,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk14";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -65,8 +65,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk15";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -60,8 +60,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk16";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -74,8 +74,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk18A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -83,8 +83,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk19A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -84,8 +84,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk20A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -54,8 +54,8 @@ EXIT:
static VOID TaskF01(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
task1.pcName = "EvtTsk21B";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......@@ -85,8 +85,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk21A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -73,8 +73,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk22A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -92,9 +92,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk23A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -66,8 +66,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk26";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -81,8 +81,8 @@ static UINT32 Testcase(VOID)
UINT16 swTmrID;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk27";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -55,10 +55,9 @@ static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT32 event;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk29";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -52,8 +52,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk30";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -83,12 +83,11 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
g_testCount = 0;
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk32A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -96,12 +96,11 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
g_testCount = 0;
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk33A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -60,9 +60,9 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk37";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -104,13 +104,12 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
LOS_EventInit(&g_event);
LOS_EventInit(&g_pevent2);
g_testCount = 0;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk38A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -56,10 +56,8 @@ static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = { 0 };
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk39";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -55,8 +55,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk40";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -56,9 +56,9 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
EVENT_CB_S pevent = { 0 };
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk42";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -81,8 +81,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk43";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -56,11 +56,10 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
TSK_INIT_PARAM_S task1 = {0};
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk36";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -57,8 +57,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk41";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
......
......@@ -46,7 +46,8 @@ static UINT32 Testcase(VOID)
g_testQueueID01 = 0;
memset(bufname, 'a', 5001); // 5001, buffer size.
ret = memset_s(bufname, 5001, 'a', 5001); // 5001, buffer size.
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
bufname[5001] = '\0'; // 5001, buffer size.
ret = LOS_QueueCreate(bufname, 3, &g_testQueueID01, 0, sizeof(UINTPTR)); // 3, Set the queue length.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......
......@@ -57,7 +57,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(g_testQueueID01, filebuf, count, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(readbuf, 0, 260); // 260, Read buf size.
ret = memset_s(readbuf, 260, 0, 260); // 260, Read buf size.
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(g_testQueueID01, readbuf, count, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......
......@@ -66,7 +66,8 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISFULL, ret, EXIT);
for (i = 0; i < 1000; i++) { // 1000, The loop frequency.
memset(readbuf, 0, 260); // 260, Read buf size.
ret = memset_s(readbuf, 260, 0, 260); // 260, Read buf size.
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(g_testQueueID01, readbuf, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
}
......
......@@ -47,14 +47,16 @@ static UINT32 Testcase(VOID)
UINT32 readSize;
queueID = LOSCFG_BASE_IPC_QUEUE_CONFIG + 1;
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
readSize = 8; // 8, Read the setting size of queue buffer.
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
ICUNIT_GOTO_EQUAL(readSize, 8, readSize, EXIT); // 8, Here, assert that g_testCount is equal to 8.
queueID = LOSCFG_BASE_IPC_QUEUE_CONFIG;
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = 8; // 8, Read the setting size of queue buffer.
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
......@@ -62,14 +64,16 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL(readSize, 8, readSize, EXIT); // 8, Here, assert that g_testCount is equal to 8.
queueID = LOSCFG_BASE_IPC_QUEUE_CONFIG - 1;
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = 8; // 8, Read the setting size of queue buffer.
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret, EXIT);
ICUNIT_GOTO_EQUAL(readSize, 8, readSize, EXIT); // 8, Here, assert that g_testCount is equal to 8.
queueID = 0;
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = 8; // 8, Read the setting size of queue buffer.
ret = LOS_QueueReadCopy(queueID - 1, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
......
......@@ -55,7 +55,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueDelete(queueID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = 8; // 8, Read the setting size of queue buffer.
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret, EXIT);
......
......@@ -52,12 +52,14 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1);
ret = LOS_QueueReadCopy(queueID, NULL, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_READ_PTR_NULL, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1);
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......
......@@ -52,7 +52,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1);
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0xffffffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......@@ -60,7 +61,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1);
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0xffffffff + 1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......@@ -68,7 +70,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1);
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0xffffffff - 1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......
......@@ -51,14 +51,16 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWriteCopy(queueID, NULL, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_WRITE_PTR_NULL, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
ret = LOS_QueueWriteCopy(queueID, &buff1, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......
......@@ -51,21 +51,24 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWriteCopy(queueID, &buff1, QUEUE_SHORT_BUFFER_LENGTH, 0xffffffff);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_QueueWriteCopy(queueID, &buff1, QUEUE_SHORT_BUFFER_LENGTH, 0xffffffff + 1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_QueueWriteCopy(queueID, &buff1, QUEUE_SHORT_BUFFER_LENGTH, 0xffffffff - 1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......
......@@ -51,7 +51,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1);
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......@@ -59,7 +60,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1) + 1;
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......@@ -67,7 +69,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = sizeof(buff1);
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
......@@ -75,7 +78,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWrite(queueID, &buff1, 8, 0); // 8, Write the setting size of queue buffer.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = 0;
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_READSIZE_IS_INVALID, ret, EXIT);
......
......@@ -52,32 +52,37 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueWriteCopy(queueID, &buff1, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_QueueWriteCopy(queueID, &buff1, QUEUE_SHORT_BUFFER_LENGTH + PER_ADDED_VALUE, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
ret = LOS_QueueWrite(queueID, &buff1, QUEUE_SHORT_BUFFER_LENGTH - 1, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ret = LOS_QueueRead(queueID, &buff2, QUEUE_SHORT_BUFFER_LENGTH, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
ret = LOS_QueueWrite(queueID, &buff1, 0, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
memset(buff2, 0, QUEUE_SHORT_BUFFER_LENGTH);
ret = memset_s(buff2, QUEUE_SHORT_BUFFER_LENGTH, 0, QUEUE_SHORT_BUFFER_LENGTH);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
readSize = 0;
ret = LOS_QueueReadCopy(queueID, &buff2, &readSize, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_READSIZE_IS_INVALID, ret, EXIT);
......
......@@ -71,7 +71,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task01";
......@@ -84,7 +85,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task02";
......
......@@ -63,7 +63,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup002_task01";
......
......@@ -94,7 +94,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup003_task01";
......@@ -107,7 +108,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup003_task02";
......
......@@ -114,7 +114,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup004_task01";
......@@ -127,7 +128,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup004_task02";
......
......@@ -63,7 +63,8 @@ static void Task01(void)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task03;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup005_task03";
......@@ -74,7 +75,8 @@ static void Task01(void)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID03, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2;
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task04;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup005_task04";
......@@ -137,7 +139,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup005_task01";
......@@ -150,7 +153,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup005_task02";
......
......@@ -67,7 +67,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup007_task01";
......@@ -81,7 +82,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup007_task02";
......
......@@ -67,7 +67,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup008_task01";
......@@ -80,7 +81,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup008_task02";
......
......@@ -50,7 +50,8 @@ static void Task01(void)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task03;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup009_task03";
......@@ -90,7 +91,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup009_task01";
......@@ -104,7 +106,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup009_task02";
......
......@@ -69,7 +69,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task01";
......@@ -83,7 +84,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task02";
......
......@@ -90,7 +90,8 @@ static UINT32 Testcase(VOID)
TSK_INIT_PARAM_S taskInitParam;
UINT32 ret;
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task01";
......@@ -103,7 +104,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task02";
......
......@@ -73,7 +73,8 @@ static UINT32 Testcase(VOID)
ret = LOS_EventInit(&g_eventCB);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT0);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT0);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task01;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task01";
......@@ -86,7 +87,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testSmpCpupTaskID01, &taskInitParam);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
(VOID)memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task02;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup001_task02";
......
......@@ -194,7 +194,7 @@ iUINT32 ICunitInit(void)
g_iCunitCaseCnt = 0x0000;
g_iCunitCaseFailedCnt = 0;
g_iCunitErrLogAddCase = 0;
memset(g_iCunitCaseArray, 0, sizeof(g_iCunitCaseArray));
(void)memset_s(g_iCunitCaseArray, sizeof(g_iCunitCaseArray), 0, sizeof(g_iCunitCaseArray));
g_iCunitCaseRun = 1;
return (iUINT32)ICUNIT_SUCCESS;
......@@ -233,12 +233,12 @@ iUINT32 ICunitRunF(ICUNIT_CASE_S *psubCase)
static LosSemCB *semNode;
UINT32 muxCnt[ARRAY_SIZE];
memset(gUwSwtNum, 0, sizeof(gUwSwtNum));
memset(gUwHwiNum, 0, sizeof(gUwHwiNum));
memset(gUwTskNum, 0, sizeof(gUwTskNum));
memset(gAuwMemuse, 0, sizeof(gAuwMemuse));
memset(gUwQueueNum, 0, sizeof(gUwQueueNum));
memset(gUwSemNum, 0, sizeof(gUwSemNum));
(void)memset_s(gUwSwtNum, sizeof(gUwSwtNum), 0, sizeof(gUwSwtNum));
(void)memset_s(gUwHwiNum, sizeof(gUwHwiNum), 0, sizeof(gUwHwiNum));
(void)memset_s(gUwTskNum, sizeof(gUwTskNum), 0, sizeof(gUwTskNum));
(void)memset_s(gAuwMemuse, sizeof(gAuwMemuse), 0, sizeof(gAuwMemuse));
(void)memset_s(gUwQueueNum, sizeof(gUwQueueNum), 0, sizeof(gUwQueueNum));
(void)memset_s(gUwSemNum, sizeof(gUwSemNum), 0, sizeof(gUwSemNum));
curTestTaskID = LOS_CurTaskIDGet();
......@@ -577,7 +577,7 @@ iUINT32 ICunitRunTestArrayRandom(iUINT32 testcaseNum, iUINT32 testcaseLayer, iUI
iUINT32 failedCount;
iUINT32 successCount;
memset(&subCaseArrayTemp, 0, sizeof(ICUNIT_CASE_S));
(void)memset_s(&subCaseArrayTemp, sizeof(ICUNIT_CASE_S), 0, sizeof(ICUNIT_CASE_S));
idx1 = g_iCunitCaseCnt;
......@@ -586,7 +586,7 @@ iUINT32 ICunitRunTestArrayRandom(iUINT32 testcaseNum, iUINT32 testcaseLayer, iUI
successCount = g_passResult;
for (idx = idx1 - 1; idx > 1; idx--) {
memset(&subCaseArrayTemp, 0, sizeof(ICUNIT_CASE_S));
(void)memset_s(&subCaseArrayTemp, sizeof(ICUNIT_CASE_S), 0, sizeof(ICUNIT_CASE_S));
randIdx = ICunitRand() % idx;
subCaseArrayTemp = g_iCunitCaseArray[randIdx];
......@@ -611,12 +611,12 @@ iUINT32 ICunitRunTestOne(const char *tcId)
iUINT32 idx1;
ICUNIT_CASE_S subCaseArrayTemp;
memset(&subCaseArrayTemp, 0, sizeof(ICUNIT_CASE_S));
(void)memset_s(&subCaseArrayTemp, sizeof(ICUNIT_CASE_S), 0, sizeof(ICUNIT_CASE_S));
idx1 = g_iCunitCaseCnt;
for (idx = 0; idx < idx1; idx++) {
memset(&subCaseArrayTemp, 0, sizeof(ICUNIT_CASE_S));
(void)memset_s(&subCaseArrayTemp, sizeof(ICUNIT_CASE_S), 0, sizeof(ICUNIT_CASE_S));
subCaseArrayTemp = g_iCunitCaseArray[idx];
if (strcmp(subCaseArrayTemp.pcCaseID, tcId) == 0) {
......
......@@ -55,7 +55,8 @@ static int Testcase(VOID)
buf = (char *)malloc(MOUSE_DATA_LEN);
ICUNIT_ASSERT_NOT_EQUAL(buf, NULL, buf);
(void)memset_s(buf, MOUSE_DATA_LEN, 0, MOUSE_DATA_LEN);
ret = memset_s(buf, MOUSE_DATA_LEN, 0, MOUSE_DATA_LEN);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = ioctl(fd, USB_GET_REPORT_ID, &id);
ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret);
......
......@@ -53,7 +53,8 @@ static int Testcase(VOID)
buf = (char *)malloc(STORAGE_DATA_LEN);
ICUNIT_ASSERT_NOT_EQUAL(buf, NULL, buf);
(void)memset_s(buf, STORAGE_DATA_LEN, 0, STORAGE_DATA_LEN);
ret = memset_s(buf, STORAGE_DATA_LEN, 0, STORAGE_DATA_LEN);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = ioctl(fd, DIOC_GETPRIV, &bch);
printf("bch = %#x, &bch = %#x, errno = %d\n", bch, &bch, errno);
......
......@@ -48,7 +48,7 @@ BOOL g_cmsRunningFlag = FALSE;
static void InitCms()
{
memset(g_serviceNameMap, 0, sizeof(g_serviceNameMap));
(void)memset_s(g_serviceNameMap, sizeof(g_serviceNameMap), 0, sizeof(g_serviceNameMap));
}
uint32_t SetCms(int fd)
......@@ -66,7 +66,7 @@ void SendReply(int fd, IpcMsg *dataIn, uint32_t result, uint32_t serviceHandle)
data1.flag = SEND | BUFF_FREE;
data1.buffToFree = dataIn;
data1.outMsg = &dataOut;
memset(data1.outMsg, 0, sizeof(IpcMsg));
(void)memset_s(data1.outMsg, sizeof(IpcMsg), 0, sizeof(IpcMsg));
data1.outMsg->type = MT_REPLY;
data1.outMsg->target.handle = dataIn->taskID;
data1.outMsg->target.token = dataIn->target.token;
......@@ -118,12 +118,12 @@ uint32_t RegService(int fd, char *serviceName, uint32_t nameLen, uint32_t *servi
if (nameLen > NAME_LEN_MAX) {
return -1;
}
memcpy(name.serviceName, serviceName, nameLen);
(void)memcpy_s(name.serviceName, nameLen, serviceName, nameLen);
name.nameLen = nameLen;
data1.flag = SEND | RECV;
data1.outMsg = &dataOut;
memset(data1.outMsg, 0, sizeof(IpcMsg));
(void)memset_s(data1.outMsg, sizeof(IpcMsg), 0, sizeof(IpcMsg));
data1.outMsg->type = MT_REQUEST;
data1.outMsg->target.handle = 0;
data1.outMsg->code = REG_CODE;
......@@ -153,12 +153,12 @@ uint32_t GetService(int fd, char *serviceName, uint32_t nameLen, uint32_t *servi
if (nameLen > NAME_LEN_MAX) {
return -1;
}
memcpy(name.serviceName, serviceName, nameLen);
(void)memcpy_s(name.serviceName, nameLen, serviceName, nameLen);
name.nameLen = nameLen;
data1.flag = SEND | RECV;
data1.outMsg = &dataOut;
memset(data1.outMsg, 0, sizeof(IpcMsg));
(void)memset_s(data1.outMsg, sizeof(IpcMsg), 0, sizeof(IpcMsg));
data1.outMsg->type = MT_REQUEST;
data1.outMsg->target.handle = 0;
data1.outMsg->code = GET_CODE;
......@@ -210,7 +210,8 @@ static void HandleServiceRegAndGet(int fd, IpcMsg *data)
printf("the task has already a service named:%s\n", g_serviceNameMap[content.serviceHandle].serviceName);
goto ERROR_REG;
} else {
(void)memcpy_s(g_serviceNameMap[content.serviceHandle].serviceName, info->nameLen, info->serviceName, info->nameLen);
(void)memcpy_s(g_serviceNameMap[content.serviceHandle].serviceName, info->nameLen,
info->serviceName, info->nameLen);
g_serviceNameMap[content.serviceHandle].nameLen = info->nameLen;
SendReply(fd, data, 0, content.serviceHandle);
}
......@@ -281,7 +282,7 @@ void StopCms(int fd)
data1.flag = SEND;
data1.outMsg = &dataOut;
memset(data1.outMsg, 0, sizeof(IpcMsg));
(void)memset_s(data1.outMsg, sizeof(IpcMsg), 0, sizeof(IpcMsg));
data1.outMsg->type = MT_REQUEST;
data1.outMsg->target.handle = 0;
data1.outMsg->code = STOP_CODE;
......
......@@ -78,7 +78,7 @@ static int CallTestServiceLoop(uint32_t id)
#endif
data1.flag = SEND | RECV;
data1.outMsg = &dataOut;
memset(data1.outMsg, 0, sizeof(IpcMsg));
(void)memset_s(data1.outMsg, sizeof(IpcMsg), 0, sizeof(IpcMsg));
data1.outMsg->type = MT_REQUEST;
data1.outMsg->target.handle = serviceHandle;
data1.outMsg->dataSz = 4;
......@@ -98,7 +98,7 @@ static int CallTestServiceLoop(uint32_t id)
char tmpBuff[2048];
data1.flag = SEND | RECV;
data1.outMsg = &dataOut;
memset(data1.outMsg, 0, sizeof(IpcMsg));
(void)memset_s(data1.outMsg, sizeof(IpcMsg), 0, sizeof(IpcMsg));
data1.outMsg->type = MT_REQUEST;
data1.outMsg->target.handle = serviceHandle;
data1.outMsg->dataSz = 1024;
......
......@@ -37,7 +37,7 @@ static UINT32 Testcase(VOID)
char buffer[20]; // 20, target buffer size
int *sharedflag = NULL;
int shmid;
ret = pipe(pipeFd);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1);
shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm
......
......@@ -59,12 +59,12 @@ int TestPipeSingleProcess()
char sentence1[15] = "Hello World";
char a[4] = {0};
(void)sprintf_s(a, sizeof(a), "%d", i);
strcat(sentence1, a);
(void)strcat_s(sentence1, 15, a); // 15, sizeof sentence1
int ret = write(*writeFd, sentence1, strlen(sentence1) + 1);
usleep(100000); // 100000, Used to calculate the delay time.
printf("read\n");
memset(readbuffer, 0, sizeof(readbuffer));
(void)memset_s(readbuffer, sizeof(readbuffer), 0, sizeof(readbuffer));
retValue = read(*readFd, readbuffer, sizeof(readbuffer));
printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer, errno);
if (strncmp((readbuffer), (readbuffer), (strlen(sentence1))) != 0) {
......
......@@ -59,7 +59,7 @@ int TestPipeSingleProcessFcntl()
char sentence1[15] = "Hello World";
char a[4] = {0};
(void)sprintf_s(a, sizeof(a), "%d", i);
strcat(sentence1, a);
(void)strcat_s(sentence1, 15, a); // 15, sizeof sentence1
int ret = write(*writeFd, sentence1, strlen(sentence1) + 1);
usleep(100000); // 100000, Used to calculate the delay time.
}
......@@ -67,7 +67,7 @@ int TestPipeSingleProcessFcntl()
char a[4] = {0};
usleep(10000); // 10000, Used to calculate the delay time.
printf("read\n");
memset(readbuffer, 0, sizeof(readbuffer));
(void)memset_s(readbuffer, sizeof(readbuffer), 0, sizeof(readbuffer));
retValue = read(*readFd, readbuffer, sizeof(readbuffer));
printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer, errno);
printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer + 13, errno); // 13, readbuffer offset.
......@@ -78,7 +78,7 @@ int TestPipeSingleProcessFcntl()
usleep(100000); // 100000, Used to calculate the delay time.
printf("read\n");
memset(readbuffer, 0, sizeof(readbuffer));
(void)memset_s(readbuffer, sizeof(readbuffer), 0, sizeof(readbuffer));
fcntl(*readFd, F_SETFL, O_NONBLOCK);
ret = fcntl(*readFd, F_GETFL, O_NONBLOCK);
printf("fctrl ret=%d,O_NONBLOCK=%d\n", ret, O_NONBLOCK);
......
......@@ -31,6 +31,8 @@
#include "it_test_signal.h"
#include "signal.h"
static const int NAME_LEN = 60;
static const int MAX_PIPES = 32;
static int PipeUnlinkTest()
......@@ -41,7 +43,7 @@ static int PipeUnlinkTest()
int retValue = -1;
int status, ret;
char devName[60]; // 60, array subscript
char devName[NAME_LEN]; // 60, array subscript
pid = fork();
if (pid == -1) {
printf("Fork Error!\n");
......@@ -54,7 +56,7 @@ static int PipeUnlinkTest()
retValue = pipe(tmpFd);
ICUNIT_ASSERT_EQUAL_EXIT(retValue, -1, __LINE__);
for (int i = 0; i < MAX_PIPES; i++) {
snprintf(devName, 60, "/dev/pipe%d", i); // 60, len of max size
(void)snprintf_s(devName, NAME_LEN, NAME_LEN - 1, "/dev/pipe%d", i); // 60, len of max size
retValue = unlink(devName);
ICUNIT_ASSERT_EQUAL_EXIT(retValue, -1, __LINE__);
retValue = close(pipefd[i][0]);
......
......@@ -68,7 +68,7 @@ static int TestPipeMultiProcess()
char sentence1[15] = "Hello World";
char a[2] = {0};
(void)sprintf_s(a, sizeof(a), "%d", i);
strcat(sentence1, a);
(void)strcat_s(sentence1, 15, a); // 15, sizeof sentence1
int ret = write(*writeFd, sentence1, strlen(sentence1) + 1);
ICUNIT_ASSERT_EQUAL(ret, strlen(sentence1) + 1, ret);
usleep(10000); // 10000, Used to calculate the delay time.
......@@ -88,8 +88,8 @@ static int TestPipeMultiProcess()
char sentence1[15] = "Hello World";
char a[2] = {0};
(void)sprintf_s(a, sizeof(a), "%d", i);
strcat(sentence1, a);
memset(readbuffer, 0, sizeof(readbuffer));
(void)strcat_s(sentence1, 15, a); // 15, sizeof sentence1
(void)memset_s(readbuffer, sizeof(readbuffer), 0, sizeof(readbuffer));
retValue = read(*readFd, readbuffer, strlen(sentence1) + 1);
printf("Receive %d bytes data : %s, errno : %d\n", retValue, readbuffer, errno);
ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer, sentence1, strlen(sentence1), errno);
......
......@@ -51,6 +51,7 @@ static UINT32 testcase(VOID)
sigset_t mask;
struct epoll_event ev;
struct epoll_event evWait[2]; /* 2, evs num */
UINT32 ret;
retval = pipe(pipeFd);
ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT);
......@@ -71,7 +72,8 @@ static UINT32 testcase(VOID)
if (pid == 0) {
close(pipeFd[1]);
memset(evWait, 0, sizeof(struct epoll_event) * 2); /* 2, evs num */
ret = memset_s(evWait, sizeof(struct epoll_event) * 2, 0, sizeof(struct epoll_event) * 2); /* 2, evs num */
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
retval = epoll_wait(epFd, evWait, 2, 3000); /* 2, num of wait fd. 3000, wait time */
close(pipeFd[0]);
......
......@@ -97,7 +97,7 @@ static UINT32 testcase(VOID)
if (pid == 0) {
close(pipeFd[1]);
memset(evWait, 0, sizeof(struct epoll_event) * 2); /* 2, evs num */
(void)memset_s(evWait, sizeof(struct epoll_event) * 2, 0, sizeof(struct epoll_event) * 2); /* 2, evs num */
evWait[0].data.fd = pipeFd[0];
retval = epoll_pwait(epFd, evWait, 2, 3000, &mask); /* 2, num of wait fd. 3000, wait time */
......
......@@ -40,9 +40,13 @@ static UINT32 Testcase(VOID)
int nType;
char pathname[50]; // 50, path name buffer size
FILE *testFile;
(void)strncpy_s(pathname, 50, g_ioTestPath, 50); // 50, path name buffer size
int ret;
ret = strncpy_s(pathname, 50, g_ioTestPath, 50); // 50, path name buffer size
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
char *filename = "/crtfputwstest1";
strcat(pathname, filename);
ret = strcat_s(pathname, 50, filename); // 50, path name buffer size
ICUNIT_ASSERT_EQUAL(ret, EOK, ret);
for (nType = 0; nType < 6; nType++) { // 6, test loop num
testFile = fopen(pathname, "a");
......
......@@ -38,12 +38,14 @@ static UINT32 Testcase(VOID)
int nRet;
unsigned int nPos;
int nType;
char pathname[50]; // 50, path name buffer size
strncpy(pathname, g_ioTestPath, 50); // 50, path name buffer size
char pathname[50]; // 50, path name buffer size
(void)strncpy_s(pathname, 50, g_ioTestPath, 50); // 50, path name buffer size
char *filename = "/crtfwprintftest1";
FILE *testFile = NULL;
int ret;
strcat(pathname, filename);
ret = strcat_s(pathname, 50, filename); // 50, path name buffer size
ICUNIT_ASSERT_EQUAL(ret, EOK, ret);
for (nType = 0; nType < 6; nType++) { // 6, loop test num
testFile = fopen(pathname, "w+");
......@@ -52,7 +54,7 @@ static UINT32 Testcase(VOID)
nPos = (unsigned int)ftell(testFile);
nRet = fwprintf(testFile, L"hello world %d", 666); // 666, for test, print to testFile
ICUNIT_GOTO_EQUAL(nRet, 15, nRet, EXIT); // 15, total write size
ICUNIT_GOTO_EQUAL(nRet, 15, nRet, EXIT); // 15, total write size
if ((nPos + 15) != (unsigned int)ftell(testFile)) { // 15, total write size
ICUNIT_GOTO_EQUAL(1, 0, 1, EXIT);
......
......@@ -37,11 +37,15 @@ static UINT32 Testcase(VOID)
unsigned int nPos;
int ret;
char pathname[50]; // 50, enough space.
(void)strncpy_s(pathname, sizeof(pathname), g_ioTestPath, sizeof(pathname));
char *filename = "/crt_getc_unlocked_test1";
FILE *testFile = NULL;
strcat(pathname, filename);
ret = strncpy_s(pathname, sizeof(pathname), g_ioTestPath, sizeof(pathname));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = strcat_s(pathname, 50, filename); // 50, path name buffer size
ICUNIT_ASSERT_EQUAL(ret, EOK, ret);
testFile = fopen(pathname, "w+");
ICUNIT_ASSERT_NOT_EQUAL(testFile, NULL, LOS_NOK);
ret = fputs("0123456789abcdefghijklmnopqrstuvwxyz", testFile);
......
......@@ -38,9 +38,11 @@ static UINT32 Testcase(VOID)
const char *str = "水";
size_t sz = strlen(str);
int len1, len2, len3;
UINT32 ret;
mbstate_t mb;
memset(&mb, 0, sizeof(mb));
ret = memset_s(&mb, sizeof(mb), 0, sizeof(mb));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
len1 = mbrlen(str, 1, &mb);
ICUNIT_GOTO_EQUAL(len1, -2, len1, EXIT); // -2, except return value
......
......@@ -38,11 +38,15 @@ static UINT32 Testcase(VOID)
long nPos;
int nType, i;
FILE *putwcFile = NULL;
char pathname[50]; // 50, pathname size
strncpy(pathname, g_ioTestPath, 50); // 50, pathname size
char pathname[50]; // 50, pathname size
char *filename = "/crtputwctest1";
int ret;
strcat(pathname, filename);
ret = strncpy_s(pathname, 50, g_ioTestPath, 50); // 50, pathname size
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = strcat_s(pathname, 50, filename); // 50, path name buffer size
ICUNIT_ASSERT_EQUAL(ret, EOK, ret);
for (nType = 0; nType < 6; nType++) { // 6, loop test num
putwcFile = fopen(pathname, "w+");
......
......@@ -41,14 +41,16 @@ static UINT32 Testcase(VOID)
struct iovec iov[2]; // 2, read 2 block
ssize_t nread;
const int testStrLen = 10;
UINT32 ret;
iov[0].iov_base = buf1;
iov[0].iov_len = sizeof(buf1) - 1;
iov[1].iov_base = buf2;
iov[1].iov_len = sizeof(buf2) - 1;
strncpy(pathname, g_ioTestPath, 50); // 50, path name size
strcat(pathname, filename);
(void)strncpy_s(pathname, 50, g_ioTestPath, 50); // 50, path name size
ret = strcat_s(pathname, 50, filename); // 50, path name buffer size
ICUNIT_ASSERT_EQUAL(ret, EOK, ret);
fd = open(pathname, O_CREAT | O_RDWR | O_TRUNC, 0666); // 0666, file authority
if (fd < 0) {
printf("error: can`t open file\n");
......
......@@ -42,7 +42,9 @@ static UINT32 Testcase(VOID)
attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH;
attr.mq_maxmsg = 1;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq002_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq002_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1);
......@@ -66,6 +68,7 @@ EXIT1:
mq_close(mqueue);
EXIT:
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
......@@ -32,10 +32,13 @@
static UINT32 Testcase(VOID)
{
INT32 ret;
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
mqd_t mqueue;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq005_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq005_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1);
mqueue = mq_open(mqname, O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT);
ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno);
......@@ -45,6 +48,7 @@ static UINT32 Testcase(VOID)
EXIT:
mq_close(mqueue);
mq_unlink(mqname);
EXIT1:
return MQUEUE_NO_ERROR;
}
......
......@@ -36,8 +36,10 @@ static UINT32 Testcase(VOID)
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
mqd_t roqueue, roqueue2;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq008_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq008_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
roqueue = mq_open(mqname, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_NOT_EQUAL(roqueue, (mqd_t)-1, roqueue, EXIT);
......@@ -59,6 +61,7 @@ EXIT1:
EXIT:
mq_close(roqueue);
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
......@@ -40,8 +40,10 @@ static UINT32 Testcase(VOID)
mqd_t rdwrqueue, rdwrqueue2;
struct mq_attr attr = { 0 };
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq011_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq011_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH;
attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH;
rdwrqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
......@@ -77,6 +79,7 @@ EXIT1:
EXIT:
mq_close(rdwrqueue);
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
......@@ -37,8 +37,10 @@ static UINT32 Testcase(VOID)
const CHAR *msgptr = MQUEUE_SEND_STRING_TEST;
mqd_t mqueue1, mqueue2;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq013_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq013_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT3);
mqueue1 = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT1);
......@@ -67,6 +69,7 @@ EXIT1:
mq_close(mqueue1);
EXIT:
mq_unlink(mqname);
EXIT3:
return MQUEUE_NO_ERROR;
}
......
......@@ -37,7 +37,9 @@ static UINT32 Testcase(VOID)
mqd_t mqueue;
struct mq_attr attr = { 0 };
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq014_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq014_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1);
......@@ -60,6 +62,7 @@ EXIT1:
mq_close(mqueue);
EXIT:
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
......@@ -38,7 +38,9 @@ static UINT32 Testcase(VOID)
struct mq_attr attr = { 0 };
struct mq_attr attrget;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq015_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq015_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH;
attr.mq_msgsize = 5; // 5, queue message size.
......@@ -67,6 +69,7 @@ EXIT1:
mq_close(mqueue);
EXIT:
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
......@@ -36,8 +36,10 @@ static UINT32 Testcase(VOID)
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
mqd_t mqueue1, mqueue2;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq016_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq016_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT3);
mqueue1 = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT1);
......@@ -57,6 +59,7 @@ EXIT1:
mq_close(mqueue1);
EXIT:
mq_unlink(mqname);
EXIT3:
return MQUEUE_NO_ERROR;
}
......
......@@ -37,7 +37,9 @@ static UINT32 Testcase(VOID)
const CHAR *msgptr = MQUEUE_SEND_STRING_TEST;
mqd_t mqueue;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq018_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq018_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1);
......@@ -56,6 +58,7 @@ EXIT1:
mq_close(mqueue);
EXIT:
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
......@@ -39,7 +39,9 @@ static UINT32 Testcase(VOID)
mqd_t mqueue1, mqueue2;
struct mq_attr attr = { 0 };
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq019_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq019_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT3);
attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH;
attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH;
......@@ -76,6 +78,7 @@ EXIT1:
mq_close(mqueue1);
EXIT:
mq_unlink(mqname);
EXIT3:
return MQUEUE_NO_ERROR;
}
......
......@@ -38,7 +38,9 @@ static UINT32 Testcase(VOID)
struct sigevent ev;
struct sigaction act;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq020_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq020_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1);
......@@ -54,6 +56,7 @@ EXIT1:
mq_close(mqueue);
EXIT:
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
......@@ -32,10 +32,13 @@
static UINT32 Testcase(VOID)
{
INT32 ret;
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
mqd_t mqueue;
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq021_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
"/mq021_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1);
mqueue = mq_open(mqname, O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT);
......@@ -45,6 +48,7 @@ static UINT32 Testcase(VOID)
EXIT:
mq_close(mqueue);
mq_unlink(mqname);
EXIT1:
return MQUEUE_NO_ERROR;
}
......
......@@ -30,16 +30,23 @@
*/
#include "It_posix_queue.h"
#define QUEUE_NAME_MAX_LEN (MQUEUE_NAME_MAX_TEST * 2)
static UINT32 Testcase(VOID)
{
CHAR mqname[MQUEUE_NAME_MAX_TEST * 2];
CHAR mqname[QUEUE_NAME_MAX_LEN];
mqd_t mqueue;
UINT32 ret;
INT32 i;
snprintf(mqname, MQUEUE_NAME_MAX_TEST * 2, "/mq025_%d", LosCurTaskIDGet()); // 2, mqname length.
ret = snprintf_s(mqname, QUEUE_NAME_MAX_LEN, QUEUE_NAME_MAX_LEN - 1, \
"/mq025_%d", LosCurTaskIDGet()); // 2, mqname length.
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1);
for (i = 0; i < MQUEUE_NAME_MAX_TEST; i++)
strcat(mqname, "0");
for (i = 0; i < MQUEUE_NAME_MAX_TEST; i++) {
ret = strcat_s(mqname, QUEUE_NAME_MAX_LEN, "0");
ICUNIT_ASSERT_EQUAL(ret, EOK, ret);
}
mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT);
......@@ -49,6 +56,7 @@ static UINT32 Testcase(VOID)
EXIT:
mq_close(mqueue);
mq_unlink(mqname);
EXIT1:
return MQUEUE_NO_ERROR;
}
......
......@@ -32,10 +32,13 @@
static UINT32 Testcase(VOID)
{
INT32 ret;
CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = "";
mqd_t queue;
snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq026-1_%d", LosCurTaskIDGet());
ret = snprintf_s(qname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
"/mq026-1_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1);
queue = mq_open(qname, O_RDWR, S_IRUSR | S_IWUSR, NULL);
ICUNIT_GOTO_EQUAL(queue, (mqd_t)-1, queue, EXIT);
......@@ -45,6 +48,7 @@ static UINT32 Testcase(VOID)
EXIT:
mq_close(queue);
mq_unlink(qname);
EXIT1:
return MQUEUE_NO_ERROR;
}
......
......@@ -36,7 +36,9 @@ static UINT32 Testcase(VOID)
INT32 ret;
mqd_t queue;
snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq027-1_%d", LosCurTaskIDGet());
ret = snprintf_s(qname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
"/mq027-1_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1);
queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
if (queue == (mqd_t)-1) {
......@@ -53,6 +55,7 @@ static UINT32 Testcase(VOID)
EXIT:
mq_close(queue);
mq_unlink(qname);
EXIT1:
return MQUEUE_NO_ERROR;
}
......
......@@ -40,7 +40,9 @@ static UINT32 Testcase(VOID)
mqd_t mqueue;
struct mq_attr attr = { 0 };
snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq031_%d", LosCurTaskIDGet());
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, \
"/mq031_%d", LosCurTaskIDGet());
ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2);
attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH;
attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH;
......@@ -69,6 +71,7 @@ EXIT1:
mq_close(mqueue);
EXIT:
mq_unlink(mqname);
EXIT2:
return MQUEUE_NO_ERROR;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册