Compare commits

...

24 Commits

Author SHA1 Message Date
openharmony_ci
556c10121b !1037 fix: 修复拼写错误
Merge pull request !1037 from Wang Jikai/master
2023-04-10 02:18:27 +00:00
openharmony_ci
fe69c9dd65 !1043 Fix : pthread_cond_timedwait 函数等待的信号丢失问题
Merge pull request !1043 from yinjiaming/fix
2023-03-31 09:11:33 +00:00
yinjiaming
2374c01bb9 fix:pthread_cond_timedwait解锁后清理的问题
该函数解锁mutex 后先清理事件,导致等的事件丢失

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I36f8658b1b850734bc029b486fec103f6bd10588
2023-03-31 16:14:31 +08:00
openharmony_ci
66278102ca !1035 使用vprintf来打印va_list类型
Merge pull request !1035 from 乔克叔叔/master
2023-03-22 02:40:55 +00:00
liuwenxin
ecdd47f0c5 fix:使用vprintf来打印va_list类型
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-03-21 11:14:02 +08:00
openharmony_ci
7dbae99194 !1038 增加los错误码和posix错误码对接接口
Merge pull request !1038 from wangchen/0317_m
2023-03-17 13:02:35 +00:00
root
81784f1c6b fix: 增加los错误码和posix错误码对接接口
方案描述:
1, 增加一个内部接口, 用于los接口返回的错误码转换成posix错误码

BREAKING CHANGE:
无新增接口, 原有接口pthread_create错误时的错误码进行了区分

Close #I6NWNV
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-03-17 16:23:31 +08:00
am009
20693c9424 fix: 修复拼写错误
Signed-off-by: am009 <wangjikai@hust.edu.cn>
2023-03-15 22:10:45 +08:00
openharmony_ci
5fa299b4aa !1026 修复task命令打印逻辑问题
Merge pull request !1026 from wangchen/0216_m
2023-03-14 07:54:35 +00:00
root
b02c64dc42 fix: posix用例存在mutex资源泄露
方案描述:
1, 对posix中使用锁之后,增加对锁的释放
2, 修改锁后进入shell, 发现task打印线程信息有异常, 又修复了打印相关的逻辑
fix #I64Y7G
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-03-13 21:53:57 +08:00
openharmony_ci
c5a39437f7 !1007 fix: risc-v架构编译告警修复
Merge pull request !1007 from zhushengle/codex
2023-03-08 06:02:16 +00:00
zhushengle
f211029b12 fix: 修复编译告警
Close #I69TZD

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I5f837b7980b478a02524f8ba056916ca038c544c
2023-03-07 21:37:07 +08:00
openharmony_ci
36d55955ef !1031 newlib error处理
Merge pull request !1031 from 乔克叔叔/master
2023-03-01 08:13:50 +00:00
openharmony_ci
12f6c5d628 !1032 Fix : 配置LOSCFG_BASE_IPC_QUEUE_STATIC后编译错误
Merge pull request !1032 from yinjiaming/fix-1
2023-03-01 08:09:53 +00:00
openharmony_ci
17309e232a !1029 Fix : 打开 LWIP_IPV6 时会有编译错误
Merge pull request !1029 from yinjiaming/fix
2023-03-01 08:09:16 +00:00
liuwenxin
af1afcec6a fix:newlib error解决
close:#I6HL01

Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-03-01 11:52:34 +08:00
yinjiaming
9cef4da850 fix:配置LOSCFG_BASE_IPC_QUEUE_STATIC后编译错误
在target_config.h中配置了LOSCFG_BASE_IPC_QUEUE_STATIC之后编译内核测试套报错
现修复

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Idf99137f822d5040bdb19e489e0a9234f19e93be
2023-02-27 15:12:13 +08:00
yinjiaming
d058b640e2 fix:打开LWIP_IPV6时有编译错误
更改了出错的参与算数运算的指针的数据类型

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I6891797cd1afa801faeecf1bfb891f0ac7db7f68
2023-02-27 11:53:54 +08:00
openharmony_ci
4431b587f8 !1027 Panic支持ExcHook
Merge pull request !1027 from zhangdengyu/supportPanicHook
2023-02-22 06:18:48 +00:00
zhangdengyu
809db71acc feat:Panic支持ExcHook
方案描述:
1、在EXC_TYPE枚举中添加EXC_PANIC成员用于Panic支持ExcHook
2、在LOS_Panic接口执行异常处理钩子函数

BREAKING CHANGE:
无

Close: #I6GR6G

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I99d293622ff6ddbc49348c692512e5b7780460e6
2023-02-21 21:55:01 +08:00
openharmony_ci
b1a7711e15 !1025 Werror开启产生的告警
Merge pull request !1025 from 乔克叔叔/werrror
2023-02-21 06:58:16 +00:00
liuwenxin
3e83ce79c2 fix:告警清理包含三方库屏蔽
【修改说明】此次开启Werror,解决告警产生的报错,以及屏蔽三方库告警

 close #I6ELI9
Signed-off-by: liuwenxin <liuwenxin11@huawei.com>
2023-02-21 10:35:56 +08:00
openharmony_ci
2cadd65301 !1023 fix: pthread_create时序调整
Merge pull request !1023 from Zhaotianyu/20230210pthread_create
2023-02-10 10:31:43 +00:00
arvinzzz
f038492dbc fix: pthread_create内部逻辑时序调整
在线程创建成功后,pthread_create内部先将函数返回值设置好,再进行TaskResume就绪调度状态

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I795c115da612123b67f34cdc57e85eac955bbc08
2023-02-10 17:42:17 +08:00
26 changed files with 247 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -43,6 +43,10 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 0)
#error "LOSCFG_PLATFORM_HWI_WITH_ARG must be set to 1 !!!"
#endif
/**
* @ingroup los_arch_interrupt
* Define the type of a hardware interrupt vector table function.

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -167,6 +167,7 @@ LITE_OS_SEC_TEXT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
{
(VOID)hwiMode;
UINT32 intSave;
if (hwiHandler == NULL) {
@@ -283,7 +284,7 @@ STATIC VOID ExcInfoDisplayContext(const LosExcInfo *exc)
ExcBackTrace(taskContext->s0);
}
STATIC VOID ExcInfoDisplay(const LosExcContext *excBufAddr)
STATIC VOID ExcInfoDisplay(VOID)
{
PRINTK("\nException Information \n");
@@ -305,6 +306,11 @@ STATIC VOID ExcInfoDisplay(const LosExcContext *excBufAddr)
WEAK UINT32 HalUnalignedAccessFix(UINTPTR mcause, UINTPTR mepc, UINTPTR mtval, VOID *sp)
{
(VOID)mcause;
(VOID)mepc;
(VOID)mtval;
(VOID)sp;
/* Unaligned access fixes are not supported by default */
PRINTK("Unaligned access fixes are not supported by default!\n");
return LOS_NOK;
@@ -329,7 +335,7 @@ VOID HalExcEntry(const LosExcContext *excBufAddr)
}
}
ExcInfoDisplay(excBufAddr);
ExcInfoDisplay();
if (LOS_TaskIsRunning()) {
PRINTK("----------------All Task information ------------\n");

View File

@@ -125,7 +125,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
int squash_pos = ipv6_blocks;
int i;
const unsigned char *sc = (const unsigned char *)cp;
const char *ss = cp-1;
const unsigned char *ss = (const unsigned char *)(cp - 1);
for (; ; sc++) {
if (current_block_index >= ipv6_blocks) {
@@ -142,7 +142,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
break;
} else if (*sc == ':') {
if (sc - ss == 1) {
if (sc != cp || sc[1] != ':') {
if (sc != (const unsigned char *)cp || sc[1] != ':') {
return 0; // address begins with a single ':' or contains ":::"
} // else address begins with one valid "::"
} else {
@@ -163,7 +163,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
#if LWIP_IPV4
} else if (*sc == '.' && current_block_index < ipv6_blocks - 1) {
ip4_addr_t ip4;
int ret = ip4addr_aton(ss+1, &ip4);
int ret = ip4addr_aton((const char *)(ss + 1), &ip4);
if (!ret) {
return 0;
}

View File

@@ -79,7 +79,7 @@ struct ifconfig_option {
unsigned char ethaddr[6];
u16_t mtu;
/* when using telnet, print to the telnet socket will result in system */
/* deadlock. So we cahe the prinf data to a buf, and when the tcpip */
/* deadlock. So we cache the prinf data to a buf, and when the tcpip */
/* callback returns, then print the data out to the telnet socket */
sys_sem_t cb_completed;
char cb_print_buf[PRINT_BUF_LEN];
@@ -319,7 +319,7 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
u32_t succ_cnt = 0;
u32_t failed_cnt = 0;
struct timespec start, end;
long timout_ms;
long timeout_ms;
struct pollfd pfd;
long rtt;
int ret = 0;
@@ -431,17 +431,17 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
((ICMPH_TYPE(iecho_resp) == ICMP_ECHO) && (iphdr_resp->src.addr == to.sin_addr.s_addr))) {
/* second type timeout event */
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &end);
timout_ms = ((end.tv_sec - start.tv_sec) * OS_SYS_MS_PER_SECOND + \
timeout_ms = ((end.tv_sec - start.tv_sec) * OS_SYS_MS_PER_SECOND + \
(end.tv_nsec - start.tv_nsec) / OS_SYS_NS_PER_MS);
timout_ms = LWIP_SHELL_CMD_PING_TIMEOUT - timout_ms;
timeout_ms = LWIP_SHELL_CMD_PING_TIMEOUT - timeout_ms;
} else {
timout_ms = 0;
timeout_ms = 0;
break;
}
} while (timout_ms >= 0);
} while (timeout_ms >= 0);
/* all timeout events are true timeout */
if ((timout_ms < 0) || (timeout_flag == TRUE)) {
if ((timeout_ms < 0) || (timeout_flag == TRUE)) {
failed_cnt++;
i++;
PRINTK("\nPing: destination unreachable ...");

View File

@@ -49,6 +49,7 @@ typedef struct {
int sem_init(sem_t *sem, int shared, unsigned value);
int sem_destroy(sem_t *sem);
int sem_wait(sem_t *sem);
int sem_trywait(sem_t *sem);
int sem_post(sem_t *sem);
int sem_timedwait(sem_t *__restrict sem, const struct timespec *__restrict timeout);
int sem_getvalue(sem_t *__restrict sem, int *__restrict currVal);

View File

@@ -50,6 +50,7 @@
#define _POSIX_THREAD_PRIORITY_SCHEDULING
#define _UNIX98_THREAD_MUTEX_ATTRIBUTES
#define _POSIX_THREAD_PROCESS_SHARED
#define _POSIX_PRIORITY_SCHEDULING
#include_next <sys/features.h>

View File

@@ -35,6 +35,7 @@ kernel_module(module_name) {
sources = [
"src/errno.c",
"src/libc.c",
"src/map_error.c",
]
configs += [ "$LITEOSTOPDIR:warn_config" ]

100
kal/posix/src/map_error.c Normal file
View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_mux.h"
#include "los_queue.h"
#include "los_sem.h"
#include "los_task.h"
#include <errno.h>
INT32 map_errno(UINT32 err)
{
if (err == LOS_OK) {
return 0;
}
switch (err) {
case LOS_ERRNO_QUEUE_INVALID:
case LOS_ERRNO_QUEUE_WRITE_PTR_NULL:
case LOS_ERRNO_QUEUE_WRITESIZE_ISZERO:
case LOS_ERRNO_QUEUE_SIZE_TOO_BIG:
case LOS_ERRNO_QUEUE_CREAT_PTR_NULL:
case LOS_ERRNO_QUEUE_PARA_ISZERO:
case LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG:
case LOS_ERRNO_TSK_ID_INVALID:
case LOS_ERRNO_TSK_PTR_NULL:
case LOS_ERRNO_TSK_NAME_EMPTY:
case LOS_ERRNO_TSK_ENTRY_NULL:
case LOS_ERRNO_TSK_PRIOR_ERROR:
case LOS_ERRNO_TSK_STKSZ_TOO_LARGE:
case LOS_ERRNO_TSK_STKSZ_TOO_SMALL:
case LOS_ERRNO_TSK_NOT_CREATED:
case OS_ERROR:
case LOS_ERRNO_SEM_INVALID:
case LOS_ERRNO_SEM_UNAVAILABLE:
errno = EINVAL;
break;
case LOS_ERRNO_QUEUE_ISFULL:
case LOS_ERRNO_QUEUE_ISEMPTY:
errno = EAGAIN;
break;
case LOS_ERRNO_QUEUE_CREATE_NO_MEMORY:
case LOS_ERRNO_TSK_TCB_UNAVAILABLE:
case LOS_ERRNO_SEM_ALL_BUSY:
errno = ENOSPC;
break;
case LOS_ERRNO_QUEUE_TIMEOUT:
case LOS_ERRNO_SEM_TIMEOUT:
errno = ETIMEDOUT;
break;
case LOS_ERRNO_QUEUE_CB_UNAVAILABLE:
errno = ENFILE;
break;
case LOS_ERRNO_QUEUE_READ_IN_INTERRUPT:
case LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT:
case LOS_ERRNO_SEM_PEND_INTERR:
errno = EINTR;
break;
case LOS_ERRNO_TSK_NO_MEMORY:
case LOS_ERRNO_SEM_OVERFLOW:
errno = ENOMEM;
break;
case LOS_ERRNO_SEM_PENDED:
errno = EBUSY;
break;
case LOS_ERRNO_SEM_PEND_IN_LOCK:
errno = EPERM;
break;
default:
errno = EINVAL;
break;
}
return errno;
}

48
kal/posix/src/map_error.h Normal file
View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _POSIX_MAP_ERROR_H
#define _POSIX_MAP_ERROR_H
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
INT32 map_errno(UINT32 err);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -40,6 +40,7 @@
#include "los_config.h"
#include "los_task.h"
#include "los_debug.h"
#include "map_error.h"
#define PTHREAD_DEFAULT_NAME "pthread"
#define PTHREAD_DEFAULT_NAME_LEN 8
@@ -207,9 +208,10 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
return ret;
}
if (LOS_TaskCreateOnly(&taskID, &taskInitParam) != LOS_OK) {
ret = LOS_TaskCreateOnly(&taskID, &taskInitParam);
if (ret != LOS_OK) {
free((VOID *)(UINTPTR)taskInitParam.uwArg);
return EINVAL;
return map_errno(ret);
}
PthreadData *pthreadData = (PthreadData *)taskInitParam.uwArg;
@@ -221,10 +223,10 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
LOS_ListAdd(&g_pthreadListHead, &pthreadData->threadList);
LOS_IntRestore(intSave);
(void)LOS_TaskResume(taskID);
*thread = (pthread_t)taskID;
(void)LOS_TaskResume(taskID);
return 0;
}

View File

@@ -303,7 +303,6 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
}
(VOID)LOS_EventClear(&(cond->event), 0);
ret = (INT32)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, (UINT32)absTicks);
if (pthread_mutex_lock(mutex) != 0) {

View File

@@ -37,6 +37,7 @@
#include "los_mux.h"
#include "los_queue.h"
#include "los_sem.h"
#include "securec.h"
#if (LOSCFG_PLATFORM_HWI == 1)
#include "los_interrupt.h"
@@ -95,6 +96,8 @@
#include "los_trace_pri.h"
#endif
#define BUFSIZE 256
/*****************************************************************************
Function : LOS_Reboot
Description : system exception, die in here, wait for watchdog.
@@ -110,10 +113,15 @@ LITE_OS_SEC_TEXT_INIT VOID LOS_Reboot(VOID)
LITE_OS_SEC_TEXT_INIT VOID LOS_Panic(const CHAR *fmt, ...)
{
char buf[BUFSIZE] = { 0 };
va_list ap;
va_start(ap, fmt);
PRINT_ERR(fmt, ap);
int len = vsnprintf_s(buf, sizeof(buf), BUFSIZE - 1, fmt, ap);
va_end(ap);
if (len > 0) {
PRINT_ERR("%s\n", buf);
}
OsDoExcHook(EXC_PANIC);
#if (LOSCFG_BACKTRACE_TYPE != 0)
LOS_BackTrace();
#endif

View File

@@ -256,9 +256,9 @@ UINT32 OsGetTaskWaterLine(UINT32 taskID)
}
#if (LOSCFG_BASE_CORE_CPUP == 1)
LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskCpupInfo(CPUP_INFO_S **cpuLessOneSec,
CPUP_INFO_S **cpuTenSec,
CPUP_INFO_S **cpuOneSec)
STATIC UINT32 GetAllTskCpupInfo(CPUP_INFO_S **cpuLessOneSec,
CPUP_INFO_S **cpuTenSec,
CPUP_INFO_S **cpuOneSec)
{
if ((cpuLessOneSec == NULL) || (cpuTenSec == NULL) || (cpuOneSec == NULL)) {
return OS_ERROR;
@@ -304,7 +304,26 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskCpupInfo(CPUP_INFO_S **cpuLessOneSec,
}
#endif
LITE_OS_SEC_TEXT_MINOR VOID OsPrintAllTskInfoHeader(VOID)
STATIC VOID PrintTskInfo(const LosTaskCB *taskCB)
{
UINT32 semID;
if (taskCB->taskStatus & OS_TASK_STATUS_EXIT) {
PRINTK("%4u%9u%10s%#10x%#10x%#11x%#11x%#10x%#7x",
taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus),
taskCB->stackSize, 0, 0, 0, 0, 0);
return;
}
semID = (taskCB->taskSem == NULL) ? OS_NULL_SHORT : (((LosSemCB *)taskCB->taskSem)->semID);
PRINTK("%4u%9u%10s%#10x%#10x%#11x%#11x%#10x%#7x",
taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus),
taskCB->stackSize, OsGetTaskWaterLine(taskCB->taskID),
(UINT32)(UINTPTR)taskCB->stackPointer, taskCB->topOfStack, taskCB->eventMask, semID);
return;
}
STATIC VOID PrintTskInfoHeader(VOID)
{
PRINTK("\r\n TID Priority Status StackSize WaterLine StackPoint TopOfStack EventMask SemID");
#if (LOSCFG_TASK_MEM_USED == 1)
@@ -341,7 +360,6 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
#if (LOSCFG_KERNEL_PRINTF != 0)
LosTaskCB *taskCB = (LosTaskCB *)NULL;
UINT32 loopNum;
UINT32 semID;
#if (LOSCFG_BASE_CORE_CPUP == 1)
CPUP_INFO_S *cpuLessOneSec = (CPUP_INFO_S *)NULL;
CPUP_INFO_S *cpuTenSec = (CPUP_INFO_S *)NULL;
@@ -354,12 +372,12 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
if (OsGetAllTskCpupInfo(&cpuLessOneSec, &cpuTenSec, &cpuOneSec) != LOS_OK) {
if (GetAllTskCpupInfo(&cpuLessOneSec, &cpuTenSec, &cpuOneSec) != LOS_OK) {
return OS_ERROR;
}
#endif
#endif /* LOSCFG_BASE_CORE_CPUP */
OsPrintAllTskInfoHeader();
PrintTskInfoHeader();
for (loopNum = 0; loopNum < g_taskMaxNum; loopNum++) {
taskCB = (((LosTaskCB *)g_taskCBArray) + loopNum);
@@ -367,11 +385,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
continue;
}
semID = (taskCB->taskSem == NULL) ? OS_NULL_SHORT : (((LosSemCB *)taskCB->taskSem)->semID);
PRINTK("%4u%9u%10s%#10x%#10x%#11x%#11x%#10x%#7x",
taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus),
taskCB->stackSize, OsGetTaskWaterLine(taskCB->taskID),
(UINT32)(UINTPTR)taskCB->stackPointer, taskCB->topOfStack, taskCB->eventMask, semID);
PrintTskInfo(taskCB);
#if (LOSCFG_TASK_MEM_USED == 1)
PRINTK("%#10x", g_taskMemUsed[loopNum]);
#endif

View File

@@ -27,6 +27,7 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/config.gni")
import("//kernel/liteos_m/liteos.gni")
config("include") {
@@ -36,6 +37,8 @@ config("include") {
if (defined(LOSCFG_KERNEL_TEST_FULL)) {
defines += [ "LOS_KERNEL_TEST_FULL=1" ]
}
cflags = warn_config_cflags
asmflags = warn_config_asmflags
}
module_switch = defined(LOSCFG_TEST)

View File

@@ -39,7 +39,7 @@ static UINT32 Testcase(VOID)
CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
CHAR buff3[QUEUE_SHORT_BUFFER_LENGTH] = {0};
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, &g_testQueueID01, buff3, 0, QUEUE_BASE_MSGSIZE);
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, &g_testQueueID01, (UINT8 *)buff3, 0, QUEUE_BASE_MSGSIZE);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0);

View File

@@ -43,7 +43,7 @@ static UINT32 Testcase(VOID)
g_testQueueID01 = QUEUW_INVALID_VALUE;
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, &g_testQueueID01, buff3, 0, 0);
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, &g_testQueueID01, (UINT8 *)buff3, 0, 0);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_PARA_ISZERO, ret, EXIT);
ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0);

View File

@@ -39,7 +39,7 @@ static UINT32 Testcase(VOID)
CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = "";
CHAR buff3[QUEUE_SHORT_BUFFER_LENGTH] = {0};
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, &g_testQueueID01, buff3, 0, 1);
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, &g_testQueueID01, (UINT8 *)buff3, 0, 1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0);

View File

@@ -43,7 +43,7 @@ static UINT32 Testcase(VOID)
g_testQueueID01 = QUEUW_INVALID_VALUE;
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, NULL, buff3, 0, QUEUE_BASE_MSGSIZE);
ret = LOS_QueueCreateStatic("Q1", QUEUE_BASE_NUM, NULL, (UINT8 *)buff3, 0, QUEUE_BASE_MSGSIZE);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_CREAT_PTR_NULL, ret, EXIT);
ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0);

View File

@@ -108,6 +108,7 @@ extern VOID ItSuitePosixMqueue(VOID);
extern UINT32 PosixPthreadInit(pthread_attr_t *attr, int pri);
extern UINT32 PosixPthreadDestroy(pthread_attr_t *attr, pthread_t thread);
extern VOID TestAssertWaitDelay(UINT32 *testCount, UINT32 flag);
extern void TestExtraTaskDelay(UINT32 tick);
VOID ItPosixQueue001(VOID);
VOID ItPosixQueue002(VOID);

View File

@@ -64,7 +64,6 @@
#define PTHREAD_EXISTED_SEM_NUM SEM_EXISTED_NUM
/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */
#define _POSIX_C_SOURCE 200112L
#define PRIORITY_OTHER (-1)
#define PRIORITY_FIFO 20

View File

@@ -71,8 +71,8 @@ static_library("posix_test") {
if (!defined(LOSCFG_COMPILER_ICCARM)) {
cflags = [
"-Wno-error",
"-Wno-unused-function",
"-Wno-int-conversion",
]
} else {
cflags = [ "--no_warnings" ]

View File

@@ -76,7 +76,7 @@ LITE_TEST_CASE(PosixCTypeTolowerTest, testCTypeTolower001, Function | MediumTest
if (ret == 'a') {
LOG("[DEMO] posix ctype test case 1:tolower(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 1:tolower(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 1:tolower(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'a');
return 0;
@@ -94,7 +94,7 @@ LITE_TEST_CASE(PosixCTypeTolowerTest, testCTypeTolower002, Function | MediumTest
if (ret == 'a') {
LOG("[DEMO] posix ctype test case 2:tolower(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 2:tolower(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 2:tolower(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'a');
return 0;
@@ -112,7 +112,7 @@ LITE_TEST_CASE(PosixCTypeTolowerTest, testCTypeTolower003, Function | MediumTest
if (ret == 'z') {
LOG("[DEMO] posix ctype test case 3:tolower(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 3:tolower(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 3:tolower(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'z');
return 0;
@@ -130,7 +130,7 @@ LITE_TEST_CASE(PosixCTypeTolowerTest, testCTypeTolower004, Function | MediumTest
if (ret == 'z') {
LOG("[DEMO] posix ctype test case 4:tolower(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 4:tolower(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 4:tolower(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'z');
return 0;
@@ -148,7 +148,7 @@ LITE_TEST_CASE(PosixCTypeTolowerTest, testCTypeTolower005, Function | MediumTest
if (ret == '1') {
LOG("[DEMO] posix ctype test case 5(except):tolower(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 5(except):tolower(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 5(except):tolower(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == '1');
return 0;

View File

@@ -76,7 +76,7 @@ LITE_TEST_CASE(PosixCTypeToupperTest, testCTypeToupper001, Function | MediumTest
if (ret == 'A') {
LOG("[DEMO] posix ctype test case 1:toupper(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 1:toupper(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 1:toupper(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'A');
return 0;
@@ -94,7 +94,7 @@ LITE_TEST_CASE(PosixCTypeToupperTest, testCTypeToupper002, Function | MediumTest
if (ret == 'A') {
LOG("[DEMO] posix ctype test case 2:toupper(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 2:toupper(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 2:toupper(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'A');
return 0;
@@ -112,7 +112,7 @@ LITE_TEST_CASE(PosixCTypeToupperTest, testCTypeToupper003, Function | MediumTest
if (ret == 'Z') {
LOG("[DEMO] posix ctype test case 3:toupper(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 3:toupper(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 3:toupper(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'Z');
return 0;
@@ -130,7 +130,7 @@ LITE_TEST_CASE(PosixCTypeToupperTest, testCTypeToupper004, Function | MediumTest
if (ret == 'Z') {
LOG("[DEMO] posix ctype test case 4:toupper(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 4:toupper(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 4:toupper(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == 'Z');
return 0;
@@ -148,7 +148,7 @@ LITE_TEST_CASE(PosixCTypeToupperTest, testCTypeToupper005, Function | MediumTest
if (ret == '1') {
LOG("[DEMO] posix ctype test case 5(except):toupper(%c)==%c ok.\n", a, ret);
} else {
LOG("[DEMO] posix ctype test case 5(except):toupper(%c)!=%c fail.\n", a);
LOG("[DEMO] posix ctype test case 5(except):toupper(%c)!=%c fail.\n", a, ret);
}
TEST_ASSERT_TRUE(ret == '1');
return 0;

View File

@@ -71,7 +71,7 @@ static BOOL PosixSemaphoreFuncTestSuiteTearDown(void)
// get cur-time plus ms
struct timespec GetDelayedTime(unsigned int ms)
{
LOG("GetDelayedTime ms = %lu", ms);
LOG("GetDelayedTime ms = %u", ms);
struct timespec ts = { 0 };
const unsigned int nsecPerSec = 1000000000;
const unsigned int nsecPerMs = 1000000;
@@ -91,7 +91,7 @@ int GetTimeDiff(struct timespec ts1, struct timespec ts2)
const int nsecPerMs = 1000000;
int ms = (ts1.tv_sec - ts2.tv_sec) * nsecPerSec + (ts1.tv_nsec - ts2.tv_nsec);
ms = ms / nsecPerMs;
LOG("different result: %ld (ms)", ms);
LOG("different result: %d (ms)", ms);
return ms;
}
@@ -109,7 +109,7 @@ LITE_TEST_CASE(PosixSemaphoreFuncTestSuite, testIpcSem_Timedwait001, Function |
TEST_ASSERT_EQUAL_INT(0, sem_init((sem_t *)&sem, 0, 0));
ts = GetDelayedTime(100);
LOG("predicted time:%lld, %d", ts.tv_sec, ts.tv_nsec);
LOG("predicted time:%lld, %ld", ts.tv_sec, ts.tv_nsec);
if (sem_timedwait((sem_t *)&sem, &ts) == -1) {
TEST_ASSERT_EQUAL_INT(ETIMEDOUT, errno);
} else {
@@ -117,7 +117,7 @@ LITE_TEST_CASE(PosixSemaphoreFuncTestSuite, testIpcSem_Timedwait001, Function |
}
clock_gettime(CLOCK_REALTIME, &tsNow);
LOG("tsNow %lld, %d", tsNow.tv_sec, tsNow.tv_nsec);
LOG("tsNow %lld, %ld", tsNow.tv_sec, tsNow.tv_nsec);
int timeDiff = GetTimeDiff(tsNow, ts); // calculate time different
LOG("timeDiff %d", timeDiff);
TEST_ASSERT_LESS_THAN_INT(20, abs(timeDiff));
@@ -141,26 +141,26 @@ LITE_TEST_CASE(PosixSemaphoreFuncTestSuite, testIpcSem_Timedwait002, Function |
TEST_ASSERT_EQUAL_INT(0, sem_init((sem_t *)&sem, 0, 1));
ts = GetDelayedTime(100);
LOG("\n ts %lld, %d", ts.tv_sec, ts.tv_nsec);
LOG("\n ts %lld, %ld", ts.tv_sec, ts.tv_nsec);
clock_gettime(CLOCK_REALTIME, &tsBegin);
int ret = sem_timedwait((sem_t *)&sem, &ts);
clock_gettime(CLOCK_REALTIME, &tsNow);
TEST_ASSERT_EQUAL_INT(0, ret);
LOG("\n tsBegin %ld, %ld, tsNow %ld, %ld", tsBegin.tv_sec, tsBegin.tv_nsec, tsNow.tv_sec, tsNow.tv_nsec);
LOG("\n tsBegin %lld, %ld, tsNow %lld, %ld", tsBegin.tv_sec, tsBegin.tv_nsec, tsNow.tv_sec, tsNow.tv_nsec);
int timeDiff = GetTimeDiff(tsNow, tsBegin); // calculate time different
LOG("\n timeDiff %d", timeDiff);
TEST_ASSERT_LESS_THAN_INT(20, timeDiff);
// try get semaphore again
ts = GetDelayedTime(100);
LOG("\n ts %d, %d", ts.tv_sec, ts.tv_nsec);
LOG("\n ts %lld, %ld", ts.tv_sec, ts.tv_nsec);
ret = sem_timedwait((sem_t *)&sem, &ts);
clock_gettime(CLOCK_REALTIME, &tsNow);
TEST_ASSERT_EQUAL_INT(-1, ret);
TEST_ASSERT_EQUAL_INT(ETIMEDOUT, errno);
LOG("\n tsNow %ld, %ld", tsNow.tv_sec, tsNow.tv_nsec);
LOG("\n tsNow %lld, %ld", tsNow.tv_sec, tsNow.tv_nsec);
timeDiff = GetTimeDiff(tsNow, tsBegin); // calculate time different
LOG("\n wait timeDiff %d", timeDiff);

View File

@@ -101,7 +101,7 @@ static int KeepRun(int msec)
struct timespec time1 = { 0, 0 };
struct timespec time2 = { 0, 0 };
clock_gettime(CLOCK_MONOTONIC, &time1);
LOG("KeepRun start : tv_sec=%ld, tv_nsec=%ld\n", time1.tv_sec, time1.tv_nsec);
LOG("KeepRun start : tv_sec=%lld, tv_nsec=%ld\n", time1.tv_sec, time1.tv_nsec);
int loop = 0;
int ran = 0;
while (ran < msec) {
@@ -111,7 +111,7 @@ static int KeepRun(int msec)
ran += (time2.tv_nsec - time1.tv_nsec) / NANOSECONDS_PER_MILLISECOND;
}
LOG("KeepRun end : tv_sec=%ld, tv_nsec=%ld\n", time2.tv_sec, time2.tv_nsec);
LOG("KeepRun end : tv_sec=%lld, tv_nsec=%ld\n", time2.tv_sec, time2.tv_nsec);
return loop;
}

View File

@@ -74,6 +74,7 @@ typedef struct {
typedef enum {
EXC_REBOOT,
EXC_ASSERT,
EXC_PANIC,
EXC_STACKOVERFLOW,
EXC_INTERRUPT,
EXC_TYPE_END