Compare commits
18 Commits
master
...
OpenHarmon
Author | SHA1 | Date |
---|---|---|
|
3936764b25 | |
|
df25cc00a5 | |
|
f4c3ac7c38 | |
|
ada7e138cc | |
|
e46f96de46 | |
|
82f06317c5 | |
|
379aa8dd27 | |
|
3b2c37aa66 | |
|
f7dbd27a33 | |
|
0b3430e574 | |
|
518d448a2f | |
|
05b07a29fe | |
|
2bef65046a | |
|
205df75f15 | |
|
85f1c9e0ca | |
|
c04ff6b10f | |
|
1b61489512 | |
|
29c459e045 |
|
@ -49,7 +49,7 @@ ShellCB *OsGetShellCb()
|
|||
return g_shellCB;
|
||||
}
|
||||
|
||||
void ShellDeinit(ShellCB *shellCB)
|
||||
static void ShellDeinit(ShellCB *shellCB)
|
||||
{
|
||||
(void)pthread_mutex_destroy(&shellCB->historyMutex);
|
||||
(void)pthread_mutex_destroy(&shellCB->keyMutex);
|
||||
|
@ -65,27 +65,23 @@ static int OsShellCreateTask(ShellCB *shellCB)
|
|||
|
||||
ret = sched_getparam(getpid(), ¶m);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
|
||||
|
||||
ret = sched_setparam(getpid(), ¶m);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ShellTaskInit(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
shellCB->shellEntryHandle = pthread_self();
|
||||
return 0;
|
||||
|
||||
OUT:
|
||||
ShellDeinit(shellCB);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int DoShellExec(char **argv)
|
||||
|
@ -148,7 +144,7 @@ int main(int argc, char **argv)
|
|||
|
||||
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
|
||||
if (shellCB == NULL) {
|
||||
goto ERR_OUT1;
|
||||
return SH_NOK;
|
||||
}
|
||||
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
|
||||
if (ret != SH_OK) {
|
||||
|
@ -176,7 +172,9 @@ int main(int argc, char **argv)
|
|||
g_shellCB = shellCB;
|
||||
ret = OsShellCreateTask(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
goto ERR_OUT3;
|
||||
ShellDeinit(shellCB);
|
||||
g_shellCB = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShellEntry(shellCB);
|
||||
|
|
|
@ -1465,7 +1465,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
|
|||
ret = VnodeLookup(diskName, &blkDriver, 0);
|
||||
if (ret < 0) {
|
||||
VnodeDrop();
|
||||
ret = ENOENT;
|
||||
PRINT_ERR("disk_init : %s, failed to find the vnode, ERRNO=%d\n", diskName, ret);
|
||||
goto DISK_FIND_ERROR;
|
||||
}
|
||||
struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops;
|
||||
|
|
|
@ -97,5 +97,5 @@ static const struct file_operations_vfs g_memDevOps = {
|
|||
|
||||
int DevMemRegister(void)
|
||||
{
|
||||
return register_driver("/dev/mem", &g_memDevOps, 0666, 0); /* 0666: file mode */
|
||||
return register_driver("/dev/mem", &g_memDevOps, 0644, 0); /* 0644: file mode */
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ static const struct ProcFileOperations FS_CACHE_PROC_FOPS = {
|
|||
|
||||
void ProcFsCacheInit(void)
|
||||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0, NULL);
|
||||
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0400, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("create fs_cache error!\n");
|
||||
return;
|
||||
|
|
|
@ -583,7 +583,7 @@ STATIC INLINE BOOL SwtmrRunqueueFind(SortLinkAttribute *swtmrSortLink, SCHED_TL_
|
|||
STATIC BOOL SwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
|
||||
{
|
||||
for (UINT16 cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
|
||||
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[ArchCurrCpuid()].swtmrSortLink;
|
||||
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[cpuid].swtmrSortLink;
|
||||
if (SwtmrRunqueueFind(swtmrSortLink, checkFunc, arg)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,6 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
|
|||
LosVmSpace *space = NULL;
|
||||
LOS_DL_LIST *spaceList = NULL;
|
||||
UINT32 UProcessUsed = 0;
|
||||
UINT32 pmTmp;
|
||||
|
||||
if (actualPm == NULL) {
|
||||
return 0;
|
||||
|
@ -167,8 +166,7 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
|
|||
if (space == LOS_GetKVmSpace()) {
|
||||
continue;
|
||||
}
|
||||
(VOID)OsUProcessPmUsage(space, NULL, &pmTmp);
|
||||
UProcessUsed += pmTmp;
|
||||
UProcessUsed += OsUProcessPmUsage(space, NULL, NULL);
|
||||
}
|
||||
(VOID)LOS_MuxRelease(vmSpaceListMux);
|
||||
|
||||
|
|
|
@ -233,14 +233,8 @@ static int HiLogWriteRingBuffer(unsigned char *buffer, size_t bufLen)
|
|||
|
||||
static void HiLogHeadInit(struct HiLogEntry *header, size_t len)
|
||||
{
|
||||
struct timespec now;
|
||||
int ret;
|
||||
|
||||
ret = clock_gettime(CLOCK_REALTIME, &now);
|
||||
if (ret != 0) {
|
||||
PRINTK("In %s line %d,clock_gettime fail\n", __FUNCTION__, __LINE__);
|
||||
return;
|
||||
}
|
||||
struct timespec now = {0};
|
||||
(void)clock_gettime(CLOCK_REALTIME, &now);
|
||||
|
||||
header->len = len;
|
||||
header->pid = LOS_GetCurrProcessID();
|
||||
|
|
|
@ -356,7 +356,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
|
|||
buf_len -= (unsigned int)ret;
|
||||
}
|
||||
|
||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
|
||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
|
||||
(netif->flags & NETIF_FLAG_LINK_UP) ? "Link UP" : "Link Down");
|
||||
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
||||
goto out;
|
||||
|
@ -2175,8 +2175,6 @@ u32_t osShellPing6(int argc, const char **argv)
|
|||
/* Setting the start time of the entire ping task for statistics */
|
||||
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &first);
|
||||
|
||||
nsent = 0;
|
||||
|
||||
for (nsent = 0; nsent < ping6_params.pingcount; nsent++) {
|
||||
/* capture the start tick to calculate rtt */
|
||||
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &start);
|
||||
|
@ -3170,7 +3168,6 @@ void netstat_internal(void *ctx)
|
|||
}
|
||||
|
||||
/* For listen PCBs */
|
||||
recvQlen = 0;
|
||||
sendQlen = 0;
|
||||
|
||||
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||
|
@ -3670,7 +3667,7 @@ u32_t netdebug_sock(int argc, const char **argv)
|
|||
int idx;
|
||||
u32_t ret = LOS_NOK;
|
||||
|
||||
if (argc == 2) {
|
||||
if (argc == 2) { /* 2: Number of command parameters */
|
||||
if (!strcmp("-i", argv[1])) {
|
||||
/* netdebug sock -i */
|
||||
for (idx = 0; idx < (int)LWIP_CONFIG_NUM_SOCKETS; idx++) {
|
||||
|
@ -3678,10 +3675,9 @@ u32_t netdebug_sock(int argc, const char **argv)
|
|||
}
|
||||
ret = LOS_OK;
|
||||
}
|
||||
} else if (argc == 3) {
|
||||
} else if (argc == 3) { /* 3: Number of command parameters */
|
||||
if (!strcmp("-d", argv[1])) {
|
||||
/* netdebug sock -d <idx> */
|
||||
idx = atoi(argv[2]);
|
||||
idx = atoi(argv[2]); /* 2: netdebug sock -d <idx> */
|
||||
if (idx >= 0) {
|
||||
debug_socket_info(idx, 1, 1);
|
||||
ret = LOS_OK;
|
||||
|
|
|
@ -94,9 +94,15 @@ int SysMqClose(mqd_t personal)
|
|||
int SysMqNotify(mqd_t personal, const struct sigevent *sigev)
|
||||
{
|
||||
int ret;
|
||||
struct sigevent ksigev;
|
||||
|
||||
ret = LOS_ArchCopyFromUser(&ksigev, sigev, sizeof(struct sigevent));
|
||||
if (ret != 0) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
MQUEUE_FD_U2K(personal);
|
||||
ret = OsMqNotify(personal, sigev);
|
||||
ret = OsMqNotify(personal, &ksigev);
|
||||
if (ret < 0) {
|
||||
return -get_errno();
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
|
|||
{
|
||||
int ret;
|
||||
struct itimerval svalue;
|
||||
struct itimerval sovalue;
|
||||
struct itimerval sovalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -137,7 +137,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
|
|||
int SysGetiTimer(int which, struct itimerval *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerval svalue;
|
||||
struct itimerval svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -189,7 +189,7 @@ int SysTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
|
|||
int SysTimerGettime(timer_t timerID, struct itimerspec *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerspec svalue;
|
||||
struct itimerspec svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -213,7 +213,7 @@ int SysTimerSettime(timer_t timerID, int flags, const struct itimerspec *value,
|
|||
{
|
||||
int ret;
|
||||
struct itimerspec svalue;
|
||||
struct itimerspec soldValue;
|
||||
struct itimerspec soldValue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -285,7 +285,7 @@ int SysClockSettime(clockid_t clockID, const struct timespec *tp)
|
|||
int SysClockGettime(clockid_t clockID, struct timespec *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec stp;
|
||||
struct timespec stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -308,7 +308,7 @@ int SysClockGettime(clockid_t clockID, struct timespec *tp)
|
|||
int SysClockGetres(clockid_t clockID, struct timespec *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec stp;
|
||||
struct timespec stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -356,7 +356,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
|
|||
{
|
||||
int ret;
|
||||
struct timespec srqtp;
|
||||
struct timespec srmtp;
|
||||
struct timespec srmtp = { 0 };
|
||||
|
||||
if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) {
|
||||
errno = EFAULT;
|
||||
|
@ -384,7 +384,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
|
|||
clock_t SysTimes(struct tms *buf)
|
||||
{
|
||||
clock_t ret;
|
||||
struct tms sbuf;
|
||||
struct tms sbuf = { 0 };
|
||||
|
||||
if (buf == NULL) {
|
||||
errno = EFAULT;
|
||||
|
@ -436,7 +436,7 @@ int SysClockGettime64(clockid_t clockID, struct timespec64 *tp)
|
|||
{
|
||||
int ret;
|
||||
struct timespec t;
|
||||
struct timespec64 stp;
|
||||
struct timespec64 stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -463,7 +463,7 @@ int SysClockGetres64(clockid_t clockID, struct timespec64 *tp)
|
|||
{
|
||||
int ret;
|
||||
struct timespec t;
|
||||
struct timespec64 stp;
|
||||
struct timespec64 stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -525,7 +525,7 @@ int SysTimerGettime64(timer_t timerID, struct itimerspec64 *value)
|
|||
{
|
||||
int ret;
|
||||
struct itimerspec val;
|
||||
struct itimerspec64 svalue;
|
||||
struct itimerspec64 svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
|
@ -584,6 +584,7 @@ int SysTimerSettime64(timer_t timerID, int flags, const struct itimerspec64 *val
|
|||
}
|
||||
|
||||
if (oldValue != NULL) {
|
||||
(void)memset_s(&soldValue, sizeof(struct itimerspec64), 0, sizeof(struct itimerspec64));
|
||||
soldValue.it_interval.tv_sec = oldVal.it_interval.tv_sec;
|
||||
soldValue.it_interval.tv_nsec = oldVal.it_interval.tv_nsec;
|
||||
soldValue.it_value.tv_sec = oldVal.it_value.tv_sec;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 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:
|
||||
|
@ -31,6 +31,7 @@
|
|||
#include "it_test_shm.h"
|
||||
|
||||
#define SHMID_MAX 192
|
||||
#define SHM_FLAG 0777
|
||||
|
||||
static int Testcase(VOID)
|
||||
{
|
||||
|
@ -44,24 +45,24 @@ static int Testcase(VOID)
|
|||
ICUNIT_ASSERT_EQUAL(ret, SHMID_MAX, ret);
|
||||
leftShmIds = SHMID_MAX - shmInfo.used_ids;
|
||||
|
||||
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, SHM_FLAG | IPC_CREAT); // 0x1234: a key used to create shared memory
|
||||
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
|
||||
|
||||
ret = shmctl(shmid[0], IPC_RMID, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
|
||||
|
||||
ret = shmctl(shmid[0], IPC_RMID, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
for (i = 0; i < leftShmIds; i++) {
|
||||
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]);
|
||||
}
|
||||
|
||||
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
|
||||
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
|
||||
ICUNIT_ASSERT_EQUAL(shmid[leftShmIds], -1, shmid[leftShmIds]);
|
||||
|
||||
for (i = 0; i < leftShmIds; i++) {
|
||||
|
|
|
@ -55,7 +55,6 @@ static int Testcase(VOID)
|
|||
ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT);
|
||||
|
||||
ret = shmctl(shmid, SHM_STAT, &ds);
|
||||
// ICUNIT_GOTO_EQUAL(ret, 0x10000, ret, ERROR_OUT);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT);
|
||||
ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, ERROR_OUT);
|
||||
|
||||
|
@ -70,7 +69,7 @@ static int Testcase(VOID)
|
|||
ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, ERROR_OUT);
|
||||
ICUNIT_GOTO_EQUAL(info.shmmin, 1, info.shmmin, ERROR_OUT);
|
||||
ICUNIT_GOTO_EQUAL(info.shmmni, 192, info.shmmni, ERROR_OUT);
|
||||
ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT);
|
||||
ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT); // 128: expected value of shmseg
|
||||
ICUNIT_GOTO_EQUAL(info.shmall, 0x1000, info.shmall, ERROR_OUT);
|
||||
|
||||
ret = shmdt(shm);
|
||||
|
|
|
@ -63,13 +63,11 @@ static int LiteIpcTest(void)
|
|||
/* testing mmap liteipc mem pool with different size and flag */
|
||||
retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||
//retptr = mmap(nullptr, 0, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
//ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr);
|
||||
retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||
retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||
retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0);
|
||||
retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0); // 4096: length of mapped memory
|
||||
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
|
||||
|
||||
retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
|
@ -81,7 +79,7 @@ static int LiteIpcTest(void)
|
|||
char buf[10] = {0};
|
||||
ret = read(fd, buf, 10);
|
||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||
ret = write(fd, buf, 10);
|
||||
ret = write(fd, buf, 10); // 10: size of buf
|
||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||
|
||||
/* before set cms, testing ioctl cmd */
|
||||
|
@ -96,7 +94,7 @@ static int LiteIpcTest(void)
|
|||
|
||||
sleep(2);
|
||||
/* after set cms, testing set cms cmd */
|
||||
ret = ioctl(fd, IPC_SET_CMS, 200);
|
||||
ret = ioctl(fd, IPC_SET_CMS, 200); // 200: use 200 for set cms cmd testing
|
||||
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
|
||||
|
||||
exit(0);
|
||||
|
|
|
@ -60,17 +60,6 @@ static int TestCase()
|
|||
exit(0);
|
||||
}
|
||||
|
||||
/* sig = SIGTERM;
|
||||
ret = sigaction(sig, (struct sigaction *)1, &oldAct);
|
||||
printf("ret == %d\n", ret);
|
||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno);
|
||||
|
||||
ret = sigaction(sig, &sigAct, (struct sigaction *)1);
|
||||
printf("ret === %d\n", ret);
|
||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
|
||||
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); */
|
||||
|
||||
ret = waitpid(fpid, &status, 0);
|
||||
ICUNIT_ASSERT_EQUAL(ret, fpid, ret);
|
||||
ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status));
|
||||
|
|
|
@ -37,7 +37,6 @@ static UINT32 testcase(VOID)
|
|||
time_t currtime;
|
||||
struct tm *timer = {nullptr};
|
||||
char buffer[80];
|
||||
//locale_t loc = malloc(sizeof(locale_t);
|
||||
|
||||
time(&currtime);
|
||||
timer = localtime(&currtime);
|
||||
|
@ -46,17 +45,17 @@ static UINT32 testcase(VOID)
|
|||
printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH"));
|
||||
|
||||
printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8"));
|
||||
strftime(buffer, 80, "%c", timer);
|
||||
(void)strftime(buffer, sizeof(buffer), "%c", timer);
|
||||
printf("Date is: %s\n", buffer);
|
||||
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
||||
|
||||
printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8"));
|
||||
strftime(buffer, 80, "%c", timer);
|
||||
(void)strftime(buffer, sizeof(buffer), "%c", timer);
|
||||
printf("Date is: %s\n", buffer);
|
||||
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
||||
|
||||
printf("Locale is: %s\n", setlocale(LC_TIME, ""));
|
||||
strftime(buffer, 80, "%c", timer);
|
||||
(void)strftime(buffer, sizeof(buffer), "%c", timer);
|
||||
printf("Date is: %s\n", buffer);
|
||||
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
|
||||
setlocale(LC_ALL, "C");
|
||||
|
|
|
@ -145,26 +145,6 @@ HWTEST_F(MiscTest, ItTestMisc009, TestSize.Level0)
|
|||
ItTestMisc009();
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.name: IT_TEST_MISC_010
|
||||
* @tc.desc: function for MiscTest
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
/*HWTEST_F(MiscTest, ItTestMisc010, TestSize.Level0)
|
||||
{
|
||||
ItTestMisc010();
|
||||
}*/
|
||||
|
||||
/* *
|
||||
* @tc.name: IT_TEST_MISC_011
|
||||
* @tc.desc: function for MiscTest
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
/*HWTEST_F(MiscTest, ItTestMisc011, TestSize.Level0)
|
||||
{
|
||||
ItTestMisc011();
|
||||
}*/
|
||||
|
||||
/* *
|
||||
* @tc.name: IT_TEST_MISC_012
|
||||
* @tc.desc: function for MiscTest
|
||||
|
@ -174,16 +154,6 @@ HWTEST_F(MiscTest, ItTestMisc012, TestSize.Level0)
|
|||
{
|
||||
ItTestMisc012();
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.name: IT_TEST_MISC_013
|
||||
* @tc.desc: function for MiscTest
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
/*HWTEST_F(MiscTest, ItTestMisc013, TestSize.Level0)
|
||||
{
|
||||
ItTestMisc013();
|
||||
}*/
|
||||
#endif
|
||||
|
||||
} // namespace OHOS
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#define TEST_HwiTrigger(HWI_NUM_TEST)
|
||||
#define LOS_TaskLock()
|
||||
#define LOS_TaskUnlock()
|
||||
#define LOS_MS2Tick(ms) (ms / 10)
|
||||
#define LOS_MS2Tick(ms) ((ms) / 10)
|
||||
#define OS_TASK_PRIORITY_HIGHEST 0
|
||||
#define OS_TASK_PRIORITY_LOWEST 31
|
||||
|
||||
|
@ -228,12 +228,7 @@ struct testdata {
|
|||
};
|
||||
extern struct testdata g_td;
|
||||
|
||||
|
||||
extern unsigned int sleep(unsigned int seconds);
|
||||
extern unsigned int alarm(unsigned int seconds);
|
||||
|
||||
extern int map_errno(UINT32 err);
|
||||
extern long sysconf(int name);
|
||||
extern void posix_signal_start(void);
|
||||
|
||||
VOID ScenarInit(VOID);
|
||||
|
|
|
@ -34,7 +34,6 @@ static void *pthread_f01(void *tmp)
|
|||
{
|
||||
int rc = 0;
|
||||
g_testCount++;
|
||||
// printf("www\n");
|
||||
|
||||
/* acquire the mutex */
|
||||
rc = pthread_mutex_lock(&g_pthreadMutexTest1);
|
||||
|
@ -69,7 +68,7 @@ static UINT32 Testcase(VOID)
|
|||
|
||||
/* Let the other thread run */
|
||||
LosTaskDelay(2);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2: expected value of g_testCount
|
||||
|
||||
/* Try to destroy the cond var. This should return an error */
|
||||
rc = pthread_cond_destroy(&g_pthreadCondTest1);
|
||||
|
@ -79,7 +78,7 @@ static UINT32 Testcase(VOID)
|
|||
ICUNIT_ASSERT_EQUAL(rc, 0, rc);
|
||||
|
||||
LosTaskDelay(2);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount);
|
||||
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // 4: expected value of g_testCount
|
||||
|
||||
rc = pthread_cond_destroy(&g_pthreadCondTest1);
|
||||
ICUNIT_ASSERT_EQUAL(rc, 0, rc);
|
||||
|
|
|
@ -51,10 +51,6 @@ static UINT32 Testcase(VOID)
|
|||
|
||||
tmp = pthread_equal(a, b);
|
||||
|
||||
// pthread_join(a, NULL);
|
||||
|
||||
// pthread_detach(a);
|
||||
|
||||
pthread_attr_init(&aa);
|
||||
|
||||
pthread_attr_getdetachstate(&aa, &detachstate);
|
||||
|
@ -63,19 +59,6 @@ static UINT32 Testcase(VOID)
|
|||
|
||||
pthread_attr_destroy(&aa);
|
||||
|
||||
// pthread_mutex_init(&c, NULL);
|
||||
|
||||
// pthread_mutex_destroy(&c);
|
||||
|
||||
// pthread_mutex_lock(&c);
|
||||
|
||||
// pthread_mutex_trylock(&c);
|
||||
|
||||
// pthread_mutex_unlock(&c);
|
||||
|
||||
// pthread_mutexattr_init(&c);
|
||||
|
||||
// pthread_mutexattr_destroy(&c);
|
||||
ret = pthread_join(aThread, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@ static void *ThreadF01(void *arg)
|
|||
|
||||
/* Shouldn't reach here. If we do, then the pthread_cancel()
|
||||
* function did not succeed. */
|
||||
// uart_printf_func("Could not send cancel request correctly\n");
|
||||
// ICUNIT_TRACK_EQUAL(1, 0, errno);
|
||||
pthread_exit(nullptr);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -62,7 +60,6 @@ static UINT32 Testcase(VOID)
|
|||
|
||||
ret = pthread_join(newTh, (void **)&temp);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
// ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp);
|
||||
return PTHREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ static void *ThreadF01(void *arg)
|
|||
{
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
||||
|
||||
// while (1)
|
||||
sleep(1);
|
||||
|
||||
pthread_exit(nullptr);
|
||||
|
@ -48,7 +47,6 @@ static UINT32 Testcase(VOID)
|
|||
pthread_t a;
|
||||
|
||||
/* SIGALRM will be sent in 5 seconds. */
|
||||
// alarm(5);//alarm NOT SUPPORT
|
||||
|
||||
/* Create a new thread. */
|
||||
if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) {
|
||||
|
@ -61,7 +59,6 @@ static UINT32 Testcase(VOID)
|
|||
/* If 'main' has reached here, then the test passed because it means
|
||||
* that the thread is truly asynchronise, and main isn't waiting for
|
||||
* it to return in order to move on. */
|
||||
// printf("Test PASSED\n");
|
||||
|
||||
ret = pthread_join(a, &temp);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 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:
|
||||
|
@ -41,7 +41,7 @@
|
|||
#define CLOCK_RES_NSEC 1000
|
||||
#define CLOCK_COARSE_RES_SEC 0
|
||||
#define CLOCK_COARSE_RES_NSEC 1000000
|
||||
#define CLOCK_GET_CPU_CLOCKID(pid) ((-pid - 1) * 8U + 2)
|
||||
#define CLOCK_GET_CPU_CLOCKID(pid) ((-(pid) - 1) * 8U + 2)
|
||||
|
||||
void ClockTestSmoke(void);
|
||||
void ClockTest001(void);
|
||||
|
|
|
@ -176,16 +176,5 @@ HWTEST_F(NetSocketTest, NetSocketTest012, TestSize.Level0)
|
|||
NetSocketTest012();
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.name: NetSocketTest013
|
||||
* @tc.desc: function for NetSocketTest
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
/*
|
||||
HWTEST_F(NetSocketTest, NetSocketTest013, TestSize.Level0)
|
||||
{
|
||||
//NetSocketTest013(); // broadcast to self to be supported.
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ def parse_user_pc_ulr(excinfo_file, rootfs_dir, string, addr2line_cmd, objdump_c
|
|||
ret = commands.getoutput(cmd)
|
||||
print(ret)
|
||||
cmd = "%s%s%s %s" % (addr2line_cmd, rootfs_dir, strlist[4], strlist[6])
|
||||
#print(cmd)
|
||||
ret = commands.getoutput(cmd)
|
||||
ret = ret.split('\n')
|
||||
print("<%s>%s<%s><%s>\n" % (string, ret[0], strlist[6], strlist[4]))
|
||||
|
|
|
@ -38,7 +38,7 @@ get_line()
|
|||
{
|
||||
SYM_ADDR=$(echo $1 | awk '{print $2}')
|
||||
ELF_OFFSET=$(echo ${SYM_ADDR} | cut -d '[' -f2 | cut -d ']' -f1)
|
||||
FILE_LINE=$(${ADDR2LINE} -f -e $2 ${ELF_OFFSET} | awk 'NR==2'`)
|
||||
FILE_LINE=$(${ADDR2LINE} -f -e $2 ${ELF_OFFSET} | awk 'NR==2')
|
||||
if [[ "${FILE_LINE}" == *"?"* ]]; then
|
||||
typeset ELF_OFFSET=$((ELF_OFFSET+LOAD_BASE))
|
||||
ELF_OFFSET=$(echo "obase=16;${ELF_OFFSET}" | bc)
|
||||
|
|
Loading…
Reference in New Issue