Compare commits
6 Commits
weekly_202
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e74deedba3 | ||
|
|
24f52e0259 | ||
|
|
d4df4d1e54 | ||
|
|
2d1e7e8c29 | ||
|
|
a96f535cd3 | ||
|
|
db32ad90bf |
@@ -43,7 +43,7 @@
|
||||
judgment condition to support multiple code sections. */
|
||||
WEAK BOOL OsStackDataIsCodeAddr(UINTPTR value)
|
||||
{
|
||||
if ((value >= CODE_START_ADDR) && (value < CODE_END_ADDR)) {
|
||||
if ((value > CODE_START_ADDR) && (value < CODE_END_ADDR)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
@@ -93,20 +93,25 @@ EXIT:
|
||||
STATIC LmsMemListNode *OsLmsGetPoolNodeFromAddr(UINTPTR addr)
|
||||
{
|
||||
LmsMemListNode *current = NULL;
|
||||
LmsMemListNode *previous = NULL;
|
||||
LOS_DL_LIST *listHead = &g_lmsCheckPoolList;
|
||||
|
||||
if (LOS_ListEmpty(&g_lmsCheckPoolList)) {
|
||||
goto EXIT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY(current, listHead, LmsMemListNode, node) {
|
||||
if ((addr >= current->poolAddr) && (addr < current->poolAddr + current->poolSize)) {
|
||||
return current;
|
||||
if ((addr < current->poolAddr) || (addr >= (current->poolAddr + current->poolSize))) {
|
||||
continue;
|
||||
}
|
||||
if ((previous == NULL) ||
|
||||
((previous->poolAddr <= current->poolAddr) &&
|
||||
((current->poolAddr + current->poolSize) <= (previous->poolAddr + previous->poolSize)))) {
|
||||
previous = current;
|
||||
}
|
||||
}
|
||||
|
||||
EXIT:
|
||||
return NULL;
|
||||
return previous;
|
||||
}
|
||||
|
||||
STATIC LmsMemListNode *OsLmsCheckPoolCreate(VOID)
|
||||
@@ -136,18 +141,12 @@ UINT32 LOS_LmsCheckPoolAdd(const VOID *pool, UINT32 size)
|
||||
|
||||
LMS_LOCK(intSave);
|
||||
|
||||
lmsPoolNode = OsLmsGetPoolNodeFromAddr((UINTPTR)pool);
|
||||
if (lmsPoolNode != NULL) { /* if pool range already on checklist */
|
||||
if (lmsPoolNode->poolAddr != (UINTPTR)pool) { /* pool is a subset of lmsPoolNode->poolAddr */
|
||||
/* do not add it again, just return */
|
||||
PRINT_DEBUG("[LMS]pool %p already on lms checklist !\n", pool);
|
||||
LMS_UNLOCK(intSave);
|
||||
return size; /* return size indicate the shadow memory init successful */
|
||||
} else { /* Re-initialize the same pool, maybe with different size */
|
||||
/* delete the old node, then add a new one */
|
||||
lmsPoolNode->used = LMS_POOL_UNUSED;
|
||||
LOS_ListDelete(&(lmsPoolNode->node));
|
||||
}
|
||||
lmsPoolNode = OsLmsGetPoolNode(pool);
|
||||
if (lmsPoolNode != NULL) { /* if pool already on checklist */
|
||||
/* Re-initialize the same pool, maybe with different size */
|
||||
/* delete the old node, then add a new one */
|
||||
lmsPoolNode->used = LMS_POOL_UNUSED;
|
||||
LOS_ListDelete(&(lmsPoolNode->node));
|
||||
}
|
||||
|
||||
lmsPoolNode = OsLmsCheckPoolCreate();
|
||||
@@ -163,7 +162,7 @@ UINT32 LOS_LmsCheckPoolAdd(const VOID *pool, UINT32 size)
|
||||
lmsPoolNode->shadowStart = (UINTPTR)poolAddr + realSize;
|
||||
lmsPoolNode->shadowSize = poolAddr + size - lmsPoolNode->shadowStart;
|
||||
/* init shadow value */
|
||||
(VOID)memset((VOID *)lmsPoolNode->shadowStart, LMS_SHADOW_AFTERFREE_U8, lmsPoolNode->shadowSize);
|
||||
(VOID)memset_s((VOID *)lmsPoolNode->shadowStart, lmsPoolNode->shadowSize, LMS_SHADOW_AFTERFREE_U8, lmsPoolNode->shadowSize);
|
||||
|
||||
LOS_ListAdd(&g_lmsCheckPoolList, &(lmsPoolNode->node));
|
||||
|
||||
@@ -193,10 +192,11 @@ RELEASE:
|
||||
|
||||
VOID OsLmsInit(VOID)
|
||||
{
|
||||
(VOID)memset(g_lmsCheckPoolArray, 0, sizeof(g_lmsCheckPoolArray));
|
||||
(VOID)memset_s(g_lmsCheckPoolArray, sizeof(g_lmsCheckPoolArray), 0, sizeof(g_lmsCheckPoolArray));
|
||||
LOS_ListInit(&g_lmsCheckPoolList);
|
||||
static LmsHook hook = {
|
||||
.init = LOS_LmsCheckPoolAdd,
|
||||
.deInit = LOS_LmsCheckPoolDel,
|
||||
.mallocMark = OsLmsLosMallocMark,
|
||||
.freeMark = OsLmsLosFreeMark,
|
||||
.simpleMark = OsLmsSimpleMark,
|
||||
@@ -609,7 +609,7 @@ VOID OsLmsReportError(UINTPTR p, UINT32 size, UINT32 errMod)
|
||||
|
||||
LMS_LOCK(intSave);
|
||||
g_checkDepth += 1;
|
||||
(VOID)memset(&info, 0, sizeof(LmsAddrInfo));
|
||||
(VOID)memset_s(&info, sizeof(LmsAddrInfo), 0, sizeof(LmsAddrInfo));
|
||||
|
||||
PRINT_ERR("***** Kernel Address Sanitizer Error Detected Start *****\n");
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
UINT32 (*init)(const VOID *pool, UINT32 size);
|
||||
VOID (*deInit)(const VOID *pool);
|
||||
VOID (*mallocMark)(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize);
|
||||
VOID (*freeMark)(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize);
|
||||
VOID (*simpleMark)(UINTPTR startAddr, UINTPTR endAddr, UINT32 value);
|
||||
@@ -133,4 +134,4 @@ extern SANITIZER_INTERFACE_ATTRIBUTE VOID __asan_handle_no_return(VOID);
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_LMS_PRI_H */
|
||||
#endif /* _LOS_LMS_PRI_H */
|
||||
|
||||
@@ -453,7 +453,7 @@ extern UINT32 LOS_QueueCreateStatic(const CHAR *queueName,
|
||||
* first.</li>
|
||||
* <li>bufferAddr stores the obtained data.</li>
|
||||
* <li>Do not read or write a queue in unblocking modes such as an interrupt.</li>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The argument timeOut is a relative time.</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -498,7 +498,7 @@ extern UINT32 LOS_QueueReadCopy(UINT32 queueID,
|
||||
* <ul>
|
||||
* <li>The specific queue should be created firstly.</li>
|
||||
* <li>Do not read or write a queue in unblocking modes such as interrupt.</li>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The data to be written is of the size specified by bufferSize and is stored at the address specified by
|
||||
* BufferAddr.</li>
|
||||
* <li>The argument timeOut is a relative time.</li>
|
||||
@@ -547,7 +547,7 @@ extern UINT32 LOS_QueueWriteCopy(UINT32 queueID,
|
||||
* read first.</li>
|
||||
* <li>bufferAddr stores the obtained data address.</li>
|
||||
* <li>Do not read or write a queue in unblocking modes such as an interrupt.</li>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The argument timeOut is a relative time.</li>
|
||||
* <li>The bufferSize is not really used in LOS_QueueRead, because the interface is only used to
|
||||
* obtain the address of data.</li>
|
||||
@@ -592,7 +592,7 @@ extern UINT32 LOS_QueueRead(UINT32 queueID,
|
||||
* <ul>
|
||||
* <li>The specific queue should be created firstly.</li>
|
||||
* <li>Do not read or write a queue in unblocking modes such as an interrupt.</li>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The address of the data of the size specified by bufferSize and stored at the address specified by
|
||||
* BufferAddr is to be written.</li>
|
||||
* <li>The argument timeOut is a relative time.</li>
|
||||
@@ -639,7 +639,7 @@ extern UINT32 LOS_QueueWrite(UINT32 queueID,
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>Do not read or write a queue in unblocking modes such as an interrupt.</li>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The address of the data of the size specified by bufferSize and stored at the address specified by
|
||||
* BufferAddr is to be written.</li>
|
||||
* <li>The argument timeOut is a relative time.</li>
|
||||
@@ -686,7 +686,7 @@ extern UINT32 LOS_QueueWriteHead(UINT32 queueID,
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>Do not read or write a queue in unblocking modes such as an interrupt.</li>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The address of the data of the size specified by bufferSize and stored at the address specified by
|
||||
* BufferAddr is to be written.</li>
|
||||
* <li>The argument timeOut is a relative time.</li>
|
||||
@@ -889,7 +889,7 @@ extern LosQueueCB *g_allQueue;
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>Do not alloc memory in unblocking modes such as interrupt.</li>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The argument timeOut is a relative time.</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -913,7 +913,7 @@ extern VOID *OsQueueMailAlloc(UINT32 queueID, VOID *mailPool, UINT32 timeOut);
|
||||
* This API is used to free a stationary memory for a mail according to queueID.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API cannot be called before the Huawei LiteOS is initialized.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param queueID [IN] Queue ID. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT].
|
||||
|
||||
@@ -474,7 +474,7 @@ RETRY:
|
||||
OsMemFreeNodeAdd(pool, (struct OsMemFreeNodeHead *)newNode);
|
||||
|
||||
endNode = OS_MEM_END_NODE(newNode, size);
|
||||
(VOID)memset(endNode, 0, sizeof(*endNode));
|
||||
(VOID)memset_s(endNode, sizeof(*endNode), 0, sizeof(*endNode));
|
||||
endNode->ptr.next = NULL;
|
||||
OS_MEM_SET_MAGIC(endNode);
|
||||
OsMemSentinelNodeSet(endNode, NULL, 0);
|
||||
@@ -584,7 +584,8 @@ STATIC INLINE VOID OsMemLeakCheckInfoRecord(struct OsMemNodeHead *node)
|
||||
|
||||
STATIC INLINE VOID OsMemLeakCheckInit(VOID)
|
||||
{
|
||||
(VOID)memset(g_leakCheckRecord, 0, sizeof(struct OsMemLeakCheckInfo) * LOSCFG_MEM_LEAKCHECK_RECORD_MAX_NUM);
|
||||
(VOID)memset_s(g_leakCheckRecord, sizeof(struct OsMemLeakCheckInfo) * LOSCFG_MEM_LEAKCHECK_RECORD_MAX_NUM,
|
||||
0, sizeof(struct OsMemLeakCheckInfo) * LOSCFG_MEM_LEAKCHECK_RECORD_MAX_NUM);
|
||||
g_leakCheckRecordCnt = 0;
|
||||
}
|
||||
|
||||
@@ -858,6 +859,9 @@ STATIC UINT32 OsMemPoolInit(VOID *pool, UINT32 size)
|
||||
struct OsMemPoolHead *poolHead = (struct OsMemPoolHead *)pool;
|
||||
struct OsMemNodeHead *newNode = NULL;
|
||||
struct OsMemNodeHead *endNode = NULL;
|
||||
|
||||
(VOID)memset_s(poolHead, size, 0, sizeof(struct OsMemPoolHead));
|
||||
|
||||
#ifdef LOSCFG_KERNEL_LMS
|
||||
UINT32 resize = 0;
|
||||
if (g_lms != NULL) {
|
||||
@@ -869,7 +873,6 @@ STATIC UINT32 OsMemPoolInit(VOID *pool, UINT32 size)
|
||||
size = (resize == 0) ? size : resize;
|
||||
}
|
||||
#endif
|
||||
(VOID)memset(poolHead, 0, sizeof(struct OsMemPoolHead));
|
||||
|
||||
poolHead->info.pool = pool;
|
||||
poolHead->info.totalSize = size;
|
||||
@@ -907,9 +910,14 @@ STATIC UINT32 OsMemPoolInit(VOID *pool, UINT32 size)
|
||||
}
|
||||
|
||||
#if (LOSCFG_MEM_MUL_POOL == 1)
|
||||
STATIC VOID OsMemPoolDeinit(VOID *pool)
|
||||
STATIC VOID OsMemPoolDeInit(VOID *pool, UINT32 size)
|
||||
{
|
||||
(VOID)memset(pool, 0, sizeof(struct OsMemPoolHead));
|
||||
#ifdef LOSCFG_KERNEL_LMS
|
||||
if (g_lms != NULL) {
|
||||
g_lms->deInit(pool);
|
||||
}
|
||||
#endif
|
||||
(VOID)memset_s(pool, size, 0, sizeof(struct OsMemPoolHead));
|
||||
}
|
||||
|
||||
STATIC UINT32 OsMemPoolAdd(VOID *pool, UINT32 size)
|
||||
@@ -988,7 +996,7 @@ UINT32 LOS_MemInit(VOID *pool, UINT32 size)
|
||||
|
||||
#if (LOSCFG_MEM_MUL_POOL == 1)
|
||||
if (OsMemPoolAdd(pool, size)) {
|
||||
(VOID)OsMemPoolDeinit(pool);
|
||||
(VOID)OsMemPoolDeInit(pool, size);
|
||||
return LOS_NOK;
|
||||
}
|
||||
#endif
|
||||
@@ -1001,17 +1009,23 @@ UINT32 LOS_MemInit(VOID *pool, UINT32 size)
|
||||
#if (LOSCFG_MEM_MUL_POOL == 1)
|
||||
UINT32 LOS_MemDeInit(VOID *pool)
|
||||
{
|
||||
if (pool == NULL) {
|
||||
struct OsMemPoolHead *tmpPool = (struct OsMemPoolHead *)pool;
|
||||
|
||||
if (tmpPool == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
if (OsMemPoolDelete(pool)) {
|
||||
if ((tmpPool->info.pool != pool) || (tmpPool->info.totalSize <= OS_MEM_MIN_POOL_SIZE)) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
OsMemPoolDeinit(pool);
|
||||
if (OsMemPoolDelete(tmpPool)) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
OsHookCall(LOS_HOOK_TYPE_MEM_DEINIT, pool);
|
||||
OsMemPoolDeInit(tmpPool, tmpPool->info.totalSize);
|
||||
|
||||
OsHookCall(LOS_HOOK_TYPE_MEM_DEINIT, tmpPool);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
@@ -1950,7 +1964,7 @@ UINT32 LOS_MemInfoGet(VOID *pool, LOS_MEM_POOL_STATUS *poolStatus)
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
(VOID)memset(poolStatus, 0, sizeof(LOS_MEM_POOL_STATUS));
|
||||
(VOID)memset_s(poolStatus, sizeof(LOS_MEM_POOL_STATUS), 0, sizeof(LOS_MEM_POOL_STATUS));
|
||||
|
||||
OsAllMemNodeDoHandle(pool, OsMemNodeInfoGetHandle, (VOID *)poolStatus);
|
||||
|
||||
@@ -2232,7 +2246,7 @@ STATIC VOID OsMemExcInfoGetSub(struct OsMemPoolHead *pool, MemInfoCB *memExcInfo
|
||||
UINT32 taskID = OS_TASK_ERRORID;
|
||||
UINT32 intSave = 0;
|
||||
|
||||
(VOID)memset(memExcInfo, 0, sizeof(MemInfoCB));
|
||||
(VOID)memset_s(memExcInfo, sizeof(MemInfoCB), 0, sizeof(MemInfoCB));
|
||||
|
||||
MEM_LOCK(pool, intSave);
|
||||
memExcInfo->type = MEM_MANG_MEMORY;
|
||||
|
||||
@@ -42,7 +42,7 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
g_testQueueID01 = LOSCFG_BASE_IPC_QUEUE_LIMIT - 1;
|
||||
|
||||
ret = LOS_QueueCreateStatic("Q1", QUEUE_OVERSIZE_NUM, &g_testQueueID01, buff3, 0, 0xFFFF);
|
||||
ret = LOS_QueueCreateStatic("Q1", QUEUE_OVERSIZE_NUM, &g_testQueueID01, (UINT8 *)buff3, 0, 0xFFFF);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_SIZE_TOO_BIG, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
|
||||
@@ -62,10 +62,10 @@ static UINT32 Testcase(VOID)
|
||||
OS_SWTMR_ROUSES_IGNORE, OS_SWTMR_ALIGN_SENSITIVE
|
||||
#endif
|
||||
);
|
||||
id2 = swtmrId1;
|
||||
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
id2 = swtmrId1;
|
||||
ICUNIT_GOTO_NOT_EQUAL(id1, id2, swtmrId1, EXIT);
|
||||
|
||||
ret = LOS_SwtmrDelete(id1);
|
||||
|
||||
@@ -69,7 +69,7 @@ static UINT32 Testcase(VOID)
|
||||
);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
id2 = swtmrId1;
|
||||
ICUNIT_GOTO_NOT_EQUAL(id1, id2, swtmrId1, EXIT);
|
||||
ICUNIT_GOTO_NOT_EQUAL(id1, id2, swtmrId1, EXIT1);
|
||||
|
||||
ret = LOS_SwtmrDelete(id1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
@@ -78,9 +78,10 @@ static UINT32 Testcase(VOID)
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
return LOS_OK;
|
||||
EXIT1:
|
||||
LOS_SwtmrDelete(id2);
|
||||
EXIT:
|
||||
LOS_SwtmrDelete(id1);
|
||||
LOS_SwtmrDelete(id2);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#ifndef IT_POSIX_QUEUE_H
|
||||
#define IT_POSIX_QUEUE_H
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <mqueue.h>
|
||||
@@ -40,6 +42,7 @@
|
||||
#include <signal.h>
|
||||
#include <osTest.h>
|
||||
#include "pthread.h"
|
||||
#include "unistd.h"
|
||||
|
||||
#define MAXMSG5 5
|
||||
#define MSGLEN 10
|
||||
|
||||
@@ -58,7 +58,6 @@ static UINT32 Testcase(VOID)
|
||||
return LOS_OK;
|
||||
EXIT1:
|
||||
mq_close(mqueue);
|
||||
EXIT:
|
||||
mq_unlink(mqname);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,6 @@ static UINT32 Testcase(VOID)
|
||||
CHAR msgrv1[MQUEUE_STANDARD_NAME_LENGTH] = {0};
|
||||
struct mq_attr attr = {0};
|
||||
INT32 ret = 0;
|
||||
INT32 i;
|
||||
pthread_t pthread1;
|
||||
pthread_t pthread2;
|
||||
mqd_t mqueue1;
|
||||
mqd_t mqueue2;
|
||||
struct timespec ts;
|
||||
@@ -59,7 +56,6 @@ static UINT32 Testcase(VOID)
|
||||
ret = mq_timedreceive(mqueue1, msgrv1, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts);
|
||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||
|
||||
EXIT:
|
||||
mq_close(mqueue1);
|
||||
mq_close(mqueue2);
|
||||
mq_unlink(mqname);
|
||||
|
||||
@@ -34,8 +34,6 @@ static UINT32 Testcase(VOID)
|
||||
INT32 ret;
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
mqd_t mqueue;
|
||||
struct sigevent ev;
|
||||
struct sigaction act;
|
||||
|
||||
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
|
||||
"/mq013_%d", LOS_CurTaskIDGet());
|
||||
|
||||
@@ -34,7 +34,6 @@ static UINT32 Testcase(VOID)
|
||||
INT32 ret;
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0};
|
||||
mqd_t mqueue;
|
||||
struct sigevent se;
|
||||
|
||||
ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1,
|
||||
"/mq021_%d", LOS_CurTaskIDGet());
|
||||
|
||||
@@ -55,7 +55,7 @@ EXIT:
|
||||
|
||||
static VOID *PthreadF02(VOID *argument)
|
||||
{
|
||||
INT32 j, ret;
|
||||
INT32 ret;
|
||||
|
||||
CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
|
||||
@@ -82,8 +82,6 @@ static UINT32 Testcase(VOID)
|
||||
{
|
||||
pthread_t newTh1, newTh2;
|
||||
UINT32 ret;
|
||||
CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
const CHAR *msgptr = MQUEUE_SEND_STRING_TEST;
|
||||
struct mq_attr attr = {0};
|
||||
pthread_attr_t attr1;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ static VOID *PthreadF01(VOID *argument)
|
||||
|
||||
g_testCount = 1;
|
||||
|
||||
TestAssertWaitDelay(&g_testCount, 3); // 3, Here, assert the g_testCount.
|
||||
TestAssertWaitDelay((UINT32 *)&g_testCount, 3); // 3, Here, assert the g_testCount.
|
||||
|
||||
ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
@@ -104,7 +104,7 @@ static UINT32 Testcase(VOID)
|
||||
ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1);
|
||||
|
||||
TestAssertWaitDelay(&g_testCount, 1);
|
||||
TestAssertWaitDelay((UINT32 *)&g_testCount, 1);
|
||||
|
||||
ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2);
|
||||
@@ -115,7 +115,7 @@ static UINT32 Testcase(VOID)
|
||||
ret = MqueueTaskDelay(10); // 10, Set delay time.
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2);
|
||||
|
||||
TestAssertWaitDelay(&g_testCount, 4); // 4, Here, assert the g_testCount.
|
||||
TestAssertWaitDelay((UINT32 *)&g_testCount, 4); // 4, Here, assert the g_testCount.
|
||||
|
||||
ret = PosixPthreadDestroy(&attr1, newTh2);
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1);
|
||||
|
||||
@@ -37,7 +37,7 @@ static UINT32 Testcase(VOID)
|
||||
pthread_mutex_t mutex = TEST_MUTEX_INIT;
|
||||
|
||||
sem_t sem;
|
||||
int pshared;
|
||||
int pshared = 0;
|
||||
|
||||
ret = pthread_mutexattr_init(&mta);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#define THREAD_NUM 5
|
||||
#define LOOPS 4
|
||||
|
||||
static g_value;
|
||||
static int g_value;
|
||||
static pthread_mutex_t g_mutex036 = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* pthread_mutex_lock 1-1.c
|
||||
|
||||
@@ -28,13 +28,17 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#include "It_posix_mutex.h"
|
||||
#include "unistd.h"
|
||||
|
||||
#define THREAD_NUM 6
|
||||
#define LOOPS 3
|
||||
|
||||
static pthread_mutex_t g_mutex040 = PTHREAD_MUTEX_INITIALIZER;
|
||||
static g_value;
|
||||
static int g_value;
|
||||
|
||||
static void *TaskF01(void *parm)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ pthread_t TestPthreadSelf(void)
|
||||
{
|
||||
pthread_t tid = pthread_self();
|
||||
if (tid == 0) {
|
||||
tid = ((LosTaskCB *)(OsCurrTaskGet()))->taskID;
|
||||
tid = (pthread_t)(((LosTaskCB *)(OsCurrTaskGet()))->taskID);
|
||||
}
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#include <securec.h>
|
||||
#include "osTest.h"
|
||||
#include "pthread.h"
|
||||
|
||||
@@ -95,7 +95,8 @@ LITE_TEST_CASE(PosixSysFuncTestSuite, testOsSysStrerror001, Function | MediumTes
|
||||
LOG("strerror(10) = %s\n", strerror(10));
|
||||
TEST_ASSERT_EQUAL_STRING("No children", strerror(10));
|
||||
#endif
|
||||
|
||||
|
||||
return LOS_OK;
|
||||
};
|
||||
|
||||
RUN_TEST_SUITE(PosixSysFuncTestSuite);
|
||||
|
||||
@@ -85,6 +85,7 @@ extern void PosixIslowerFuncTest(void);
|
||||
extern void PosixIsxdigitFuncTest(void);
|
||||
extern void PosixTolowerFuncTest(void);
|
||||
extern void PosixToupperFuncTest(void);
|
||||
extern void ItSuitePosixMqueue(void);
|
||||
|
||||
extern void PosixStrerrorTest(void);
|
||||
|
||||
|
||||
@@ -91,12 +91,12 @@ LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll001, Function | MediumTest |
|
||||
LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll002, Function | MediumTest | Level1)
|
||||
{
|
||||
long long value = atoll("-9223372036854775808");
|
||||
if (value == -9223372036854775808LL) {
|
||||
if (value == -9223372036854775808ULL) {
|
||||
LOG("[DEMO] posix stdlib test case 2:atoll(%lld) ok.\n", value);
|
||||
} else {
|
||||
LOG("[DEMO] posix stdlib test case 2:atoll(%lld) fail.\n", value);
|
||||
}
|
||||
TEST_ASSERT_TRUE(value == -9223372036854775808LL);
|
||||
TEST_ASSERT_TRUE(value == -9223372036854775808ULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll003, Function | MediumTest |
|
||||
LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll004, Function | MediumTest | Level1)
|
||||
{
|
||||
long long value = atoll("9223372036854775808");
|
||||
if (value == -9223372036854775808LL) {
|
||||
if (value == -9223372036854775808ULL) {
|
||||
LOG("[DEMO] posix stdlib test case 4(except):atoll(%lld) != 9223372036854775808 ok.\n", value);
|
||||
} else {
|
||||
LOG("[DEMO] posix stdlib test case 4(except):atoll(%lld) fail.\n", value);
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "posix_test.h"
|
||||
#include "los_config.h"
|
||||
#include "kernel_test.h"
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "ohos_types.h"
|
||||
#include "posix_test.h"
|
||||
#include "los_config.h"
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <time.h>
|
||||
|
||||
Reference in New Issue
Block a user