Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
1b11caa4
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
460
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
1b11caa4
编写于
3月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!853 检视问题修复
Merge pull request !853 from wangchen/0322_up
上级
f61ecd76
6ba17fc8
变更
40
隐藏空白更改
内联
并排
Showing
40 changed file
with
146 addition
and
248 deletion
+146
-248
apps/lms/src/sample_usr_lms.c
apps/lms/src/sample_usr_lms.c
+33
-1
drivers/char/random/src/random_hw.c
drivers/char/random/src/random_hw.c
+1
-1
fs/patchfs/los_patchfs.c
fs/patchfs/los_patchfs.c
+8
-3
fs/rootfs/los_bootargs.c
fs/rootfs/los_bootargs.c
+2
-2
fs/rootfs/los_rootfs.c
fs/rootfs/los_rootfs.c
+2
-2
fs/vfs/vfs_cmd/vfs_shellcmd.c
fs/vfs/vfs_cmd/vfs_shellcmd.c
+3
-3
kernel/base/mem/tlsf/los_memory.c
kernel/base/mem/tlsf/los_memory.c
+2
-2
kernel/base/misc/los_stackinfo.c
kernel/base/misc/los_stackinfo.c
+4
-2
kernel/extended/hilog/los_hilog.c
kernel/extended/hilog/los_hilog.c
+3
-3
net/lwip-2.1/enhancement/src/api_shell.c
net/lwip-2.1/enhancement/src/api_shell.c
+4
-4
testsuites/kernel/include/iCunit.h
testsuites/kernel/include/iCunit.h
+0
-110
testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_004.c
...le/kernel_base/core/task/full/It_los_task_timeslice_004.c
+0
-2
testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_022.c
...rnel/sample/kernel_base/ipc/event/full/It_los_event_022.c
+0
-1
testsuites/kernel/sample/kernel_base/ipc/event/smp/It_smp_los_event_032.c
...l/sample/kernel_base/ipc/event/smp/It_smp_los_event_032.c
+0
-1
testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_head_015.c
...sample/kernel_base/ipc/queue/full/It_los_queue_head_015.c
+0
-2
testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.c
testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.c
+1
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_023.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_023.c
+1
-2
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_069.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_069.c
+8
-4
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_101.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_101.c
+1
-2
testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp
testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp
+7
-3
testsuites/unittest/basic/mem/shm/full/it_test_mem_100.cpp
testsuites/unittest/basic/mem/shm/full/it_test_mem_100.cpp
+2
-0
testsuites/unittest/basic/mem/shm/full/shm_test_013.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_013.cpp
+13
-7
testsuites/unittest/basic/mem/vm/mem_vm_test.cpp
testsuites/unittest/basic/mem/vm/mem_vm_test.cpp
+0
-31
testsuites/unittest/basic/mem/vm/smoke/mmap_test_002.cpp
testsuites/unittest/basic/mem/vm/smoke/mmap_test_002.cpp
+4
-2
testsuites/unittest/extended/ipc/ipc_test.cpp
testsuites/unittest/extended/ipc/ipc_test.cpp
+0
-26
testsuites/unittest/extended/signal/smoke/mkfifo_test_001.cpp
...suites/unittest/extended/signal/smoke/mkfifo_test_001.cpp
+6
-0
testsuites/unittest/libc/io/full/It_stdio_fwprintf_001.cpp
testsuites/unittest/libc/io/full/It_stdio_fwprintf_001.cpp
+2
-0
testsuites/unittest/libc/io/full/It_stdio_hasmntopt_001.cpp
testsuites/unittest/libc/io/full/It_stdio_hasmntopt_001.cpp
+4
-0
testsuites/unittest/libc/io/full/It_stdio_putwc_001.cpp
testsuites/unittest/libc/io/full/It_stdio_putwc_001.cpp
+2
-0
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_134.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_134.cpp
+0
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_044.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_044.cpp
+0
-2
testsuites/unittest/libc/sys/smoke/sys_test_007.cpp
testsuites/unittest/libc/sys/smoke/sys_test_007.cpp
+1
-1
testsuites/unittest/libc/sys/smoke/sys_test_030.cpp
testsuites/unittest/libc/sys/smoke/sys_test_030.cpp
+0
-12
testsuites/unittest/libc/util/smoke/util_test_003.cpp
testsuites/unittest/libc/util/smoke/util_test_003.cpp
+3
-0
testsuites/unittest/libc/util/smoke/util_test_007.cpp
testsuites/unittest/libc/util/smoke/util_test_007.cpp
+4
-2
testsuites/unittest/net/socket/smoke/net_socket_test_003.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_003.cpp
+8
-8
testsuites/unittest/net/socket/smoke/net_socket_test_007.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_007.cpp
+7
-3
testsuites/unittest/process/basic/process/full/process_test_066.cpp
.../unittest/process/basic/process/full/process_test_066.cpp
+3
-0
testsuites/unittest/process/basic/process/smoke/process_test_046.cpp
...unittest/process/basic/process/smoke/process_test_046.cpp
+0
-1
testsuites/unittest/security/vid/smoke/vid_test_001.cpp
testsuites/unittest/security/vid/smoke/vid_test_001.cpp
+7
-0
未找到文件。
apps/lms/src/sample_usr_lms.c
浏览文件 @
1b11caa4
...
...
@@ -53,7 +53,9 @@ static void LmsMallocTest(void)
#define TEST_SIZE 16
printf
(
"
\n
-------- LmsMallocTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
malloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
printf
(
"[LmsMallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]
\n
"
);
BufReadTest
(
buf
,
-
1
,
TEST_SIZE
);
printf
(
"[LmsMallocTest] write overflow error should be triggered, write range[0, TEST_SIZE]
\n
"
);
...
...
@@ -88,6 +90,9 @@ static void LmsCallocTest(void)
#define TEST_SIZE 16
printf
(
"
\n
-------- LmsCallocTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
calloc
(
4
,
4
);
/* 4: test size */
if
(
buf
==
NULL
)
{
return
;
}
printf
(
"[LmsCallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]
\n
"
);
BufReadTest
(
buf
,
-
1
,
TEST_SIZE
);
free
(
buf
);
...
...
@@ -99,6 +104,9 @@ static void LmsVallocTest(void)
#define TEST_SIZE 4096
printf
(
"
\n
-------- LmsVallocTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
valloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
printf
(
"[LmsVallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]
\n
"
);
BufReadTest
(
buf
,
-
1
,
TEST_SIZE
);
free
(
buf
);
...
...
@@ -111,6 +119,9 @@ static void LmsAlignedAllocTest(void)
#define TEST_SIZE 128
printf
(
"
\n
-------- LmsAlignedAllocTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
aligned_alloc
(
TEST_ALIGN_SIZE
,
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
printf
(
"[LmsAlignedAllocTest] read overflow & underflow error should be triggered, read range[-1,128]
\n
"
);
BufReadTest
(
buf
,
-
1
,
128
);
free
(
buf
);
...
...
@@ -122,6 +133,9 @@ static void LmsMemsetTest(void)
#define TEST_SIZE 32
printf
(
"
\n
-------- LmsMemsetTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
malloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
printf
(
"[LmsMemsetTest] memset overflow & underflow error should be triggered, memset size:%d
\n
"
,
TEST_SIZE
+
1
);
memset
(
buf
,
0
,
TEST_SIZE
+
1
);
free
(
buf
);
...
...
@@ -133,6 +147,9 @@ static void LmsMemcpyTest(void)
#define TEST_SIZE 20
printf
(
"
\n
-------- LmsMemcpyTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
malloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
char
localBuf
[
32
]
=
{
0
};
/* 32: test size */
printf
(
"[LmsMemcpyTest] memcpy overflow error should be triggered, memcpy size:%d
\n
"
,
TEST_SIZE
+
1
);
memcpy
(
buf
,
localBuf
,
TEST_SIZE
+
1
);
...
...
@@ -145,6 +162,9 @@ static void LmsMemmoveTest(void)
#define TEST_SIZE 20
printf
(
"
\n
-------- LmsMemmoveTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
malloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
printf
(
"[LmsMemmoveTest] memmove overflow error should be triggered
\n
"
);
memmove
(
buf
+
12
,
buf
,
10
);
/* 12 and 10: test size */
free
(
buf
);
...
...
@@ -156,6 +176,9 @@ static void LmsStrcpyTest(void)
#define TEST_SIZE 16
printf
(
"
\n
-------- LmsStrcpyTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
malloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
char
*
testStr
=
"bbbbbbbbbbbbbbbbb"
;
printf
(
"[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d
\n
"
,
strlen
(
testStr
)
+
1
);
strcpy
(
buf
,
testStr
);
...
...
@@ -168,6 +191,9 @@ static void LmsStrcatTest(void)
#define TEST_SIZE 16
printf
(
"
\n
-------- LmsStrcatTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
malloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
buf
[
0
]
=
'a'
;
buf
[
1
]
=
'b'
;
buf
[
2
]
=
0
;
...
...
@@ -185,6 +211,9 @@ static void LmsFreeTest(void)
#define TEST_SIZE 16
printf
(
"
\n
-------- LmsFreeTest Start --------
\n
"
);
char
*
buf
=
(
char
*
)
malloc
(
TEST_SIZE
);
if
(
buf
==
NULL
)
{
return
;
}
printf
(
"[LmsFreeTest] free size:%d
\n
"
,
TEST_SIZE
);
free
(
buf
);
printf
(
"[LmsFreeTest] Use after free error should be triggered, read range[1,1]
\n
"
);
...
...
@@ -200,6 +229,9 @@ int main(int argc, char * const *argv)
(
void
)
argv
;
printf
(
"
\n
############### Lms Test start ###############
\n
"
);
char
*
tmp
=
(
char
*
)
malloc
(
5000
);
/* 5000: test mem size */
if
(
tmp
==
NULL
)
{
return
;
}
LmsMallocTest
();
LmsReallocTest
();
LmsCallocTest
();
...
...
drivers/char/random/src/random_hw.c
浏览文件 @
1b11caa4
...
...
@@ -41,7 +41,7 @@ void RandomOperationsInit(const RandomOperations *r)
if
(
r
!=
NULL
)
{
(
void
)
memcpy_s
(
&
g_randomOp
,
sizeof
(
RandomOperations
),
r
,
sizeof
(
RandomOperations
));
}
else
{
PRINT_ERR
(
"param is invalid
\n
"
,
__FUNCTION__
,
__LINE__
);
PRINT_ERR
(
"
%s %d
param is invalid
\n
"
,
__FUNCTION__
,
__LINE__
);
}
return
;
}
...
...
fs/patchfs/los_patchfs.c
浏览文件 @
1b11caa4
...
...
@@ -55,14 +55,15 @@ INT32 OsMountPatchFs(VOID)
}
partInfo
.
fsType
=
strdup
(
FS_TYPE
);
if
(
partInfo
.
fsType
==
NULL
)
{
return
LOS_NOK
;
ret
=
LOS_NOK
;
goto
EXIT
;
}
partInfo
.
startAddr
=
PATCHFS_FLASH_ADDR
;
partInfo
.
partSize
=
PATCHFS_FLASH_SIZE
;
#else
ret
=
GetPartitionInfo
(
&
partInfo
);
if
(
ret
!=
LOS_OK
)
{
return
ret
;
goto
EXIT
;
}
partInfo
.
startAddr
=
(
partInfo
.
startAddr
>=
0
)
?
partInfo
.
startAddr
:
PATCHFS_FLASH_ADDR
;
partInfo
.
partSize
=
(
partInfo
.
partSize
>=
0
)
?
partInfo
.
partSize
:
PATCHFS_FLASH_SIZE
;
...
...
@@ -71,7 +72,7 @@ INT32 OsMountPatchFs(VOID)
ret
=
LOS_NOK
;
partInfo
.
devName
=
strdup
(
PATCH_FLASH_DEV_NAME
);
if
(
partInfo
.
devName
==
NULL
)
{
return
LOS_NOK
;
goto
EXIT
;
}
const
CHAR
*
devName
=
GetDevNameOfPartition
(
&
partInfo
);
if
(
devName
!=
NULL
)
{
...
...
@@ -92,9 +93,13 @@ INT32 OsMountPatchFs(VOID)
ResetDevNameofPartition
(
&
partInfo
);
}
EXIT:
free
(
partInfo
.
devName
);
partInfo
.
devName
=
NULL
;
free
(
partInfo
.
storageType
);
partInfo
.
storageType
=
NULL
;
free
(
partInfo
.
fsType
);
partInfo
.
fsType
=
NULL
;
return
ret
;
}
...
...
fs/rootfs/los_bootargs.c
浏览文件 @
1b11caa4
...
...
@@ -214,7 +214,7 @@ UINT64 LOS_SizeStrToNum(CHAR *value)
UINT64
num
=
0
;
/* If the string is a hexadecimal value */
if
(
sscanf_s
(
value
,
"0x%x"
,
&
num
)
>
0
)
{
if
(
sscanf_s
(
value
,
"0x%
ll
x"
,
&
num
)
>
0
)
{
value
+=
strlen
(
"0x"
);
if
(
strspn
(
value
,
"0123456789abcdefABCDEF"
)
<
strlen
(
value
))
{
goto
ERROUT
;
...
...
@@ -247,4 +247,4 @@ UINT64 LOS_SizeStrToNum(CHAR *value)
ERROUT:
PRINT_ERR
(
"Invalid value string
\"
%s
\"
!
\n
"
,
value
);
return
num
;
}
\ No newline at end of file
}
fs/rootfs/los_rootfs.c
浏览文件 @
1b11caa4
...
...
@@ -327,7 +327,7 @@ STATIC INT32 CheckValidation(UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr,
if
((
rootAddr
&
(
alignSize
-
1
))
||
(
rootSize
&
(
alignSize
-
1
))
||
(
userAddr
&
(
alignSize
-
1
))
||
(
userSize
&
(
alignSize
-
1
)))
{
PRINT_ERR
(
"The address or size value should be 0x%x aligned!
\n
"
,
alignSize
);
PRINT_ERR
(
"The address or size value should be 0x%
ll
x aligned!
\n
"
,
alignSize
);
return
LOS_NOK
;
}
...
...
@@ -371,4 +371,4 @@ INT32 OsMountRootfs()
}
return
LOS_OK
;
}
\ No newline at end of file
}
fs/vfs/vfs_cmd/vfs_shellcmd.c
浏览文件 @
1b11caa4
...
...
@@ -654,7 +654,7 @@ static int os_shell_cmd_do_cp(const char *src_filepath, const char *dst_filename
char
*
dst_filepath
=
NULL
;
char
*
buf
=
NULL
;
const
char
*
filename
=
NULL
;
size_t
r_size
,
w_size
;
s
s
ize_t
r_size
,
w_size
;
int
src_fd
=
-
1
;
int
dst_fd
=
-
1
;
struct
stat
stat_buf
;
...
...
@@ -1391,8 +1391,8 @@ int checkNum(const char *arg)
#ifdef LOSCFG_KERNEL_SYSCALL
int
osShellCmdSu
(
int
argc
,
const
char
**
argv
)
{
unsigned
int
su_uid
;
unsigned
int
su_gid
;
int
su_uid
;
int
su_gid
;
if
(
argc
==
0
)
{
...
...
kernel/base/mem/tlsf/los_memory.c
浏览文件 @
1b11caa4
...
...
@@ -1748,7 +1748,7 @@ STATIC VOID OsMemNodeInfo(const struct OsMemNodeHead *tmpNode,
usedNode
->
header
.
ptr
.
prev
,
usedNode
->
header
.
magic
,
usedNode
->
header
.
sizeAndFlag
);
}
else
{
freeNode
=
(
struct
OsMemFreeNodeHead
*
)
tmpNode
;
PRINTK
(
"
\n
broken node head: %#x %#x %#x %#x, "
,
PRINTK
(
"
\n
broken node head: %#x %#x %#x %#x,
%#x
"
,
freeNode
->
header
.
ptr
.
prev
,
freeNode
->
next
,
freeNode
->
prev
,
freeNode
->
header
.
magic
,
freeNode
->
header
.
sizeAndFlag
);
}
...
...
@@ -1759,7 +1759,7 @@ STATIC VOID OsMemNodeInfo(const struct OsMemNodeHead *tmpNode,
usedNode
->
header
.
ptr
.
prev
,
usedNode
->
header
.
magic
,
usedNode
->
header
.
sizeAndFlag
);
}
else
{
freeNode
=
(
struct
OsMemFreeNodeHead
*
)
preNode
;
PRINTK
(
"prev node head: %#x %#x %#x %#x, "
,
PRINTK
(
"prev node head: %#x %#x %#x %#x,
%#x
"
,
freeNode
->
header
.
ptr
.
prev
,
freeNode
->
next
,
freeNode
->
prev
,
freeNode
->
header
.
magic
,
freeNode
->
header
.
sizeAndFlag
);
}
...
...
kernel/base/misc/los_stackinfo.c
浏览文件 @
1b11caa4
...
...
@@ -117,8 +117,10 @@ VOID OsExcStackInfoReg(const StackInfo *stackInfo, UINT32 stackNum)
VOID
OsStackInit
(
VOID
*
stacktop
,
UINT32
stacksize
)
{
/* initialize the task stack, write magic num to stack top */
(
VOID
)
memset_s
(
stacktop
,
stacksize
,
(
INT32
)
OS_STACK_INIT
,
stacksize
);
*
((
UINTPTR
*
)
stacktop
)
=
OS_STACK_MAGIC_WORD
;
errno_t
ret
=
memset_s
(
stacktop
,
stacksize
,
(
INT32
)
OS_STACK_INIT
,
stacksize
);
if
(
ret
==
EOK
)
{
*
((
UINTPTR
*
)
stacktop
)
=
OS_STACK_MAGIC_WORD
;
}
}
#ifdef LOSCFG_SHELL_CMD_DEBUG
...
...
kernel/extended/hilog/los_hilog.c
浏览文件 @
1b11caa4
...
...
@@ -148,7 +148,7 @@ static int HiLogBufferCopy(unsigned char *dst, unsigned dstLen, const unsigned c
static
int
HiLogReadRingBuffer
(
unsigned
char
*
buffer
,
size_t
bufLen
)
{
size_
t
retval
;
in
t
retval
;
size_t
bufLeft
=
HILOG_BUFFER
-
g_hiLogDev
.
headOffset
;
if
(
bufLeft
>
bufLen
)
{
retval
=
HiLogBufferCopy
(
buffer
,
bufLen
,
HiLogBufferHead
(),
bufLen
);
...
...
@@ -165,7 +165,7 @@ static int HiLogReadRingBuffer(unsigned char *buffer, size_t bufLen)
static
ssize_t
HiLogRead
(
struct
file
*
filep
,
char
*
buffer
,
size_t
bufLen
)
{
size_
t
retval
;
in
t
retval
;
struct
HiLogEntry
header
;
(
void
)
filep
;
...
...
@@ -209,7 +209,7 @@ out:
g_hiLogDev
.
count
=
0
;
}
(
VOID
)
LOS_MuxRelease
(
&
g_hiLogDev
.
mtx
);
return
retval
;
return
(
ssize_t
)
retval
;
}
static
int
HiLogWriteRingBuffer
(
unsigned
char
*
buffer
,
size_t
bufLen
)
...
...
net/lwip-2.1/enhancement/src/api_shell.c
浏览文件 @
1b11caa4
...
...
@@ -1337,10 +1337,10 @@ out:
LWIP_STATIC
void
lwip_arp_usage
(
const
char
*
cmd
)
{
PRINTK
(
"Usage:"
\
"
\n
%s"
"
\n
%s [-i IF] -s IPADDR HWADDR"
\
"
\n
%s [-i IF] -d IPADDR
\n
"
,
PRINTK
(
"Usage:"
"
\n
%s"
"
\n
%s [-i IF] -s IPADDR HWADDR"
"
\n
%s [-i IF] -d IPADDR
\n
"
,
cmd
,
cmd
,
cmd
);
}
...
...
testsuites/kernel/include/iCunit.h
浏览文件 @
1b11caa4
...
...
@@ -237,8 +237,6 @@ extern void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode);
#define ICUNIT_SUCCESS 0x00000000
#if 1
#define ICUNIT_TRACK_EQUAL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
...
...
@@ -414,114 +412,6 @@ extern void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode);
} \
} while (0)
#else
#define ICUNIT_TRACK_EQUAL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
} \
} while (0)
#define ICUNIT_TRACK_NOT_EQUAL(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL_VOID(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_NOT_EQUAL_VOID(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return; \
} \
} while (0)
#define ICUNIT_ASSERT_EQUAL(param, g_value, retcode) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_NOT_EQUAL(param, g_value, retcode) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_STRING_EQUAL(str1, str2, retcode) \
do { \
if (strcmp(str1, str2) != 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_ASSERT_STRING_NOT_EQUAL(str1, str2, retcode) \
do { \
if (strcmp(str1, str2) == 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
return 1; \
} \
} while (0)
#define ICUNIT_GOTO_EQUAL(param, g_value, retcode, label) \
do { \
if ((param) != (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_NOT_EQUAL(param, g_value, retcode, label) \
do { \
if ((param) == (g_value)) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_STRING_EQUAL(str1, str2, retcode, label) \
do { \
if (strcmp(str1, str2) != 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#define ICUNIT_GOTO_STRING_NOT_EQUAL(str1, str2, retcode, label) \
do { \
if (strcmp(str1, str2) == 0) { \
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
goto label; \
} \
} while (0)
#endif
#ifdef LOSCFG_KERNEL_SMP
extern
SPIN_LOCK_S
g_testSuitSpin
;
#define TESTSUIT_LOCK(state) LOS_SpinLockSave(&g_testSuitSpin, &(state))
...
...
testsuites/kernel/sample/kernel_base/core/task/full/It_los_task_timeslice_004.c
浏览文件 @
1b11caa4
...
...
@@ -45,8 +45,6 @@ static void TaskF02(void const * argument)
ICUNIT_GOTO_EQUAL
(
g_timesliceTestCount
,
1
,
ret
,
EXIT
);
g_timesliceTestCount
++
;
return
;
EXIT:
;
}
static
void
SwtmrF01
(
UINT32
*
arg
)
...
...
testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_022.c
浏览文件 @
1b11caa4
...
...
@@ -117,7 +117,6 @@ EXIT:
LOS_TaskDelete
(
g_testTaskID01
);
return
LOS_OK
;
return
LOS_OK
;
}
VOID
ItLosEvent022
(
VOID
)
// IT_Layer_ModuleORFeature_No
...
...
testsuites/kernel/sample/kernel_base/ipc/event/smp/It_smp_los_event_032.c
浏览文件 @
1b11caa4
...
...
@@ -103,7 +103,6 @@ static UINT32 Testcase(void)
PRINT_DEBUG
(
"ret1= 0x%x,ret2 = 0x%x,ret3=0x%x
\n
"
,
g_ret1
,
g_ret2
,
g_ret3
);
if
((
g_ret1
==
0x11
)
&&
(
g_ret2
==
LOS_OK
)
&&
(
g_ret3
==
LOS_OK
))
{
// pend-post-del ///post-pend-del
}
else
if
((
g_ret1
==
0x11
)
&&
(
g_ret2
==
LOS_OK
)
&&
(
g_ret3
==
LOS_OK
))
{
// del-pend-post//del-post-pend
}
else
if
((
g_ret1
==
0x11
)
&&
(
g_ret2
==
LOS_OK
)
&&
(
g_ret3
==
LOS_ERRNO_EVENT_SHOULD_NOT_DESTROY
))
{
// pend-delete-post
}
else
if
((
g_ret1
==
0xff
)
&&
(
g_ret2
==
LOS_OK
)
&&
(
g_ret3
==
LOS_OK
))
{
// post-del-pend
...
...
testsuites/kernel/sample/kernel_base/ipc/queue/full/It_los_queue_head_015.c
浏览文件 @
1b11caa4
...
...
@@ -56,8 +56,6 @@ static UINT32 Testcase(VOID)
ret
=
LOS_QueueRead
(
queueID
[
index
-
1
],
&
buff2
,
sizeof
(
UINTPTR
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
LOS_OK
,
ret
,
EXIT
);
ret
=
LOS_QueueCreate
(
"Q1"
,
3
,
&
queueID
[
index
],
0
,
8
);
// 3, Set the queue length; 8, Set the node size of the queue.
ret
=
LOS_QueueCreate
(
"Q1"
,
3
,
&
queueID
[
index
],
0
,
8
);
// 3, Set the queue length; 8, Set the node size of the queue.
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
LOS_OK
,
ret
,
EXIT
);
EXIT:
...
...
testsuites/kernel/sample/kernel_extend/cpup/It_extend_cpup.c
浏览文件 @
1b11caa4
...
...
@@ -46,7 +46,7 @@ UINT32 TestGetSingleHwiCpup(UINT32 hwi, UINT32 mode)
{
UINT32
size
;
UINT32
tempHwi
;
if
(
hwi
<
0
||
hwi
>
OS_HWI_MAX_NUM
)
{
if
(
hwi
>
OS_HWI_MAX_NUM
)
{
return
-
1
;
}
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_023.c
浏览文件 @
1b11caa4
...
...
@@ -51,7 +51,6 @@ static VOID *PthreadF01(void *argument)
pthread_cleanup_push
(
PthreadCleanF01
,
(
void
*
)
8
);
// 8, here set value.
return
(
void
*
)
8
;
// 8, here set value about the return status.
pthread_cleanup_pop
(
0
)
}
static
UINT32
Testcase
(
VOID
)
...
...
@@ -85,4 +84,4 @@ VOID ItPosixPthread023(VOID) // IT_Layer_ModuleORFeature_No
#if __cplusplus
}
#endif
/* __cpluscplus */
#endif
/* __cpluscplus */
\ No newline at end of file
#endif
/* __cpluscplus */
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_069.c
浏览文件 @
1b11caa4
...
...
@@ -51,13 +51,17 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
rc
=
pthread_cond_init
(
&
cond2
,
NULL
);
ICUNIT_
ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_
GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
rc
=
pthread_cond_destroy
(
&
cond1
);
ICUNIT_
ASSERT_EQUAL
(
rc
,
ENOERR
,
rc
);
ICUNIT_
GOTO_EQUAL
(
rc
,
ENOERR
,
rc
,
EXIT
);
rc
=
pthread_cond_destroy
(
&
cond2
);
ICUNIT_ASSERT_EQUAL
(
rc
,
ENOERR
,
rc
);
ICUNIT_GOTO_EQUAL
(
rc
,
ENOERR
,
rc
,
EXIT
);
return
PTHREAD_NO_ERROR
;
EXIT:
(
void
)
pthread_cond_destroy
(
&
cond1
);
(
void
)
pthread_cond_destroy
(
&
cond2
);
}
VOID
ItPosixPthread069
(
VOID
)
// IT_Layer_ModuleORFeature_No
...
...
@@ -69,4 +73,4 @@ VOID ItPosixPthread069(VOID) // IT_Layer_ModuleORFeature_No
#if __cplusplus
}
#endif
/* __cpluscplus */
#endif
/* __cpluscplus */
\ No newline at end of file
#endif
/* __cpluscplus */
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_101.c
浏览文件 @
1b11caa4
...
...
@@ -48,8 +48,7 @@ static VOID *PthreadF01(void *argument)
ret
=
pthread_setcanceltype
(
PTHREAD_CANCEL_ASYNCHRONOUS
,
&
oldstate
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
oldstate
,
PTHREAD_CANCEL_DEFERRED
,
oldstate
,
EXIT
);
LOS_TaskDelay
(
2
);
// 2, delay for Timing control.
LOS_TaskDelay
(
2
);
// 2, delay for Timing control.
LOS_TaskDelay
(
4
);
// 4, delay for Timing control.
EXIT:
return
(
void
*
)
9
;
// 9, here set value about the return status.
...
...
testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp
浏览文件 @
1b11caa4
...
...
@@ -56,8 +56,8 @@ static int Testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
handle
,
NULL
,
handle
);
func
=
(
int
(
*
)(
int
))
dlsym
(
handle
,
SYMBOL_TO_FIND
);
ICUNIT_
ASSERT_NOT_EQUAL
(
func
,
NULL
,
func
);
ICUNIT_
ASSERT_EQUAL
(
func
,
SYMBOL_TO_MATCH
,
func
);
ICUNIT_
GOTO_NOT_EQUAL
(
func
,
NULL
,
func
,
EXIT
);
ICUNIT_
GOTO_EQUAL
(
func
,
SYMBOL_TO_MATCH
,
func
,
EXIT
);
ret
=
dlclose
(
handle
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
...
@@ -66,12 +66,16 @@ static int Testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
handle
,
NULL
,
handle
);
func
=
(
int
(
*
)(
int
))
dlsym
(
handle
,
SYMBOL_TO_FIND
);
ICUNIT_
ASSERT_NOT_EQUAL
(
func
,
NULL
,
func
);
ICUNIT_
GOTO_NOT_EQUAL
(
func
,
NULL
,
func
,
EXIT
);
ret
=
dlclose
(
handle
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
return
0
;
EXIT:
dlclose
(
handle
);
return
0
;
}
void
ItTestDynload002
(
void
)
...
...
testsuites/unittest/basic/mem/shm/full/it_test_mem_100.cpp
浏览文件 @
1b11caa4
...
...
@@ -42,6 +42,8 @@ static int TestCase(void)
wchar_t
*
p
,
*
pnew
;
pnew
=
(
wchar_t
*
)
malloc
(
sizeof
(
wchar_t
)
*
(
wcslen
(
res
)
+
wcslen
(
res1
)));
ICUNIT_ASSERT_NOT_EQUAL
(
pnew
,
NULL
,
pnew
);
p
=
wmempcpy
(
pnew
,
res
,
wcslen
(
res
));
wmempcpy
(
p
,
res1
,
wcslen
(
res1
));
flag
=
wmemcmp
(
pnew
,
res2
,
wcslen
(
res
));
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_013.cpp
浏览文件 @
1b11caa4
...
...
@@ -44,21 +44,27 @@ static int testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
shmfd
,
-
1
,
shmfd
);
writebuf
=
(
char
*
)
malloc
(
pageSize
);
ICUNIT_ASSERT_NOT_EQUAL
(
writebuf
,
NULL
,
writebuf
);
ICUNIT_ASSERT_NOT_EQUAL
(
writebuf
,
NULL
,
writebuf
);
readbuf
=
(
char
*
)
malloc
(
pageSize
);
ICUNIT_
ASSERT_NOT_EQUAL
(
readbuf
,
NULL
,
readbuf
);
ICUNIT_
GOTO_NOT_EQUAL
(
readbuf
,
NULL
,
readbuf
,
EXIT
);
(
void
)
memset_s
(
writebuf
,
pageSize
,
0xf
,
pageSize
);
count
=
write
(
shmfd
,
writebuf
,
pageSize
);
ICUNIT_
ASSERT_EQUAL
(
count
,
pageSize
,
count
);
ICUNIT_
GOTO_EQUAL
(
count
,
pageSize
,
count
,
EXIT
);
ret
=
lseek
(
shmfd
,
0
,
SEEK_SET
);
ICUNIT_
ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_
GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
count
=
read
(
shmfd
,
readbuf
,
pageSize
);
ICUNIT_ASSERT_EQUAL
(
count
,
pageSize
,
count
);
free
(
readbuf
);
free
(
writebuf
);
ICUNIT_GOTO_EQUAL
(
count
,
pageSize
,
count
,
EXIT
);
EXIT:
if
(
readbuf
!=
NULL
)
{
free
(
readbuf
);
}
if
(
writebuf
!=
NULL
)
{
free
(
writebuf
);
}
close
(
shmfd
);
ret
=
shm_unlink
(
"test_1"
);
return
0
;
...
...
testsuites/unittest/basic/mem/vm/mem_vm_test.cpp
浏览文件 @
1b11caa4
...
...
@@ -51,37 +51,6 @@ HWTEST_F(MemVmTest, ItTestMmap001, TestSize.Level0)
{
ItTestMmap001
();
}
#if 0 // need tmpfs
/* *
* @tc.name: it_test_mmap_002
* @tc.desc: function for MemVmTest
* @tc.type: FUNC
*/
HWTEST_F(MemVmTest, ItTestMmap002, TestSize.Level0)
{
ItTestMmap002();
}
/* *
* @tc.name: it_test_mmap_003
* @tc.desc: function for MemVmTest
* @tc.type: FUNC
*/
HWTEST_F(MemVmTest, ItTestMmap003, TestSize.Level0)
{
ItTestMmap003();
}
/* *
* @tc.name: it_test_mmap_004
* @tc.desc: function for MemVmTest
* @tc.type: FUNC
*/
HWTEST_F(MemVmTest, ItTestMmap004, TestSize.Level0)
{
ItTestMmap004();
}
#endif
/* *
* @tc.name: it_test_mmap_005
...
...
testsuites/unittest/basic/mem/vm/smoke/mmap_test_002.cpp
浏览文件 @
1b11caa4
...
...
@@ -76,8 +76,10 @@ static int Testcase(void)
(
void
)
memset_s
(
buf
,
pageSize
,
0xf
,
pageSize
);
count
=
write
(
shmfd
,
buf
,
pageSize
);
ICUNIT_ASSERT_EQUAL
(
count
,
pageSize
,
count
);
if
(
count
!=
pageSize
)
{
free
(
buf
);
ICUNIT_ASSERT_EQUAL
(
count
,
pageSize
,
count
);
}
free
(
buf
);
/* Simple MAP_ANONYMOUS */
...
...
testsuites/unittest/extended/ipc/ipc_test.cpp
浏览文件 @
1b11caa4
...
...
@@ -40,30 +40,4 @@ public:
static
void
SetUpTestCase
(
void
)
{}
static
void
TearDownTestCase
(
void
)
{}
};
#if defined(LOSCFG_USER_TEST_FULL)
/* *
* @tc.name: IPC_TEST_MKFIFOAT_001
* @tc.desc: function for IoTest:mkfifoat-normal test
* @tc.type: FUNC
*/
#if 0
HWTEST_F(IoTest, IPC_TEST_MKFIFOAT_001, TestSize.Level0)
{
IPC_TEST_MKFIFOAT_001();
}
#endif
/* *
* @tc.name: IPC_TEST_MKFIFOAT_002
* @tc.desc: function for IoTest:mkfifoat-innormal test
* @tc.type: FUNC
*/
#if 0
HWTEST_F(IoTest, IPC_TEST_MKFIFOAT_002, TestSize.Level0)
{
IPC_TEST_MKFIFOAT_002();
}
#endif
#endif
}
// namespace OHOS
testsuites/unittest/extended/signal/smoke/mkfifo_test_001.cpp
浏览文件 @
1b11caa4
...
...
@@ -56,11 +56,17 @@ static int TestMkfifo()
return
-
1
;
}
else
if
(
pid
==
0
)
{
fd
=
open
(
"/dev/fifo"
,
O_WRONLY
);
if
(
fd
<
0
)
{
return
-
1
;
}
write
(
fd
,
sentence
,
sizeof
(
sentence
)
+
1
);
close
(
fd
);
exit
(
0
);
}
else
{
fd
=
open
(
"/dev/fifo"
,
O_RDONLY
);
if
(
fd
<
0
)
{
return
-
1
;
}
read
(
fd
,
buffer
,
sizeof
(
buffer
));
printf
(
"Receive data: %s
\n
"
,
buffer
);
close
(
fd
);
...
...
testsuites/unittest/libc/io/full/It_stdio_fwprintf_001.cpp
浏览文件 @
1b11caa4
...
...
@@ -60,6 +60,8 @@ static UINT32 Testcase(VOID)
fclose
(
testFile
);
testFile
=
fopen
(
pathname
,
"r"
);
ICUNIT_GOTO_NOT_EQUAL
(
testFile
,
NULL
,
testFile
,
EXIT
);
p
=
fgetws
(
tarStr
,
16
,
testFile
);
// 16, read size,total write and '\0'
nRet
=
wcscmp
(
L"hello world 666"
,
tarStr
);
ICUNIT_GOTO_EQUAL
(
nRet
,
0
,
nRet
,
EXIT
);
...
...
testsuites/unittest/libc/io/full/It_stdio_hasmntopt_001.cpp
浏览文件 @
1b11caa4
...
...
@@ -55,6 +55,10 @@ static UINT32 testcase(VOID)
}
mnt_new
=
(
struct
mntent
*
)
malloc
(
sizeof
(
struct
mntent
));
if
(
mnt_new
==
NULL
)
{
(
VOID
)
RecoveryFileEnv
(
pathList
,
1
);
return
LOS_NOK
;
}
mnt_new
->
mnt_fsname
=
"UUID=c4992556-a86e-45e8-ba5f-190b16a9073x"
;
mnt_new
->
mnt_dir
=
"/usr1"
;
mnt_new
->
mnt_type
=
"ext3"
;
...
...
testsuites/unittest/libc/io/full/It_stdio_putwc_001.cpp
浏览文件 @
1b11caa4
...
...
@@ -55,6 +55,8 @@ static UINT32 Testcase(VOID)
fclose
(
putwcFile
);
putwcFile
=
fopen
(
pathname
,
"r"
);
ICUNIT_GOTO_NOT_EQUAL
(
putwcFile
,
NULL
,
putwcFile
,
EXIT
);
tarWc
=
getwc
(
putwcFile
);
ICUNIT_GOTO_EQUAL
(
tarWc
,
L'H'
,
tarWc
,
EXIT
);
...
...
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_134.cpp
浏览文件 @
1b11caa4
...
...
@@ -44,8 +44,6 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_044.cpp
浏览文件 @
1b11caa4
...
...
@@ -43,7 +43,6 @@ static VOID *pthread_f02(void *argument)
ret
=
pthread_getschedparam
(
pthread_self
(),
&
policy
,
&
param
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
policy
,
SCHED_RR
,
policy
,
EXIT
);
//
ICUNIT_GOTO_EQUAL
(
param
.
sched_priority
,
3
,
param
.
sched_priority
,
EXIT
);
...
...
@@ -63,7 +62,6 @@ static VOID *pthread_f01(void *argument)
ret
=
pthread_getschedparam
(
pthread_self
(),
&
policy
,
&
param
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
policy
,
SCHED_RR
,
policy
,
EXIT
);
//
ICUNIT_GOTO_EQUAL
(
param
.
sched_priority
,
4
,
param
.
sched_priority
,
EXIT
);
...
...
testsuites/unittest/libc/sys/smoke/sys_test_007.cpp
浏览文件 @
1b11caa4
...
...
@@ -43,7 +43,7 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
p
,
NULL
,
p
,
EXIT
);
x
=
drand48
();
printf
(
"x= %
d
\n
"
,
x
);
printf
(
"x= %
lf
\n
"
,
x
);
return
0
;
EXIT:
...
...
testsuites/unittest/libc/sys/smoke/sys_test_030.cpp
浏览文件 @
1b11caa4
...
...
@@ -42,18 +42,6 @@ static void sig_alarm(int signum)
static
UINT32
TestCase
(
VOID
)
{
#if 0
int alarm_time = 1;
int ret;
signal(SIGALRM, sig_alarm);
alarm(alarm_time);
ret = sigsetjmp(jmp_env, 1);
if (ret) {
ICUNIT_ASSERT_EQUAL(ret, val, ret);
}
sleep(3);
#endif
return
0
;
}
...
...
testsuites/unittest/libc/util/smoke/util_test_003.cpp
浏览文件 @
1b11caa4
...
...
@@ -48,6 +48,9 @@ static UINT32 TestCase(VOID)
NULL
};
CHAR
*
buf
=
(
char
*
)
malloc
(
TEST_BUF_SIZE
);
if
(
buf
==
NULL
)
{
return
-
1
;
}
CHAR
*
a
=
TEST_STR
;
CHAR
*
value
=
NULL
;
CHAR
*
subopts
=
NULL
;
...
...
testsuites/unittest/libc/util/smoke/util_test_007.cpp
浏览文件 @
1b11caa4
...
...
@@ -87,11 +87,13 @@ static UINT32 TestCase(VOID)
ptr
=
(
int
*
)
Xmalloc
(
sizeof
(
int
));
*
ptr
=
rand
()
&
0xff
;
val
=
tsearch
((
void
*
)
ptr
,
&
g_root
,
Compare
);
if
(
val
==
NULL
)
if
(
val
==
NULL
)
{
exit
(
EXIT_FAILURE
);
else
if
((
*
(
int
**
)
val
)
!=
ptr
)
}
else
if
((
*
(
int
**
)
val
)
!=
ptr
)
{
free
(
ptr
);
}
}
twalk
(
g_root
,
Action
);
tdestroy
(
g_root
,
free
);
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_003.cpp
浏览文件 @
1b11caa4
...
...
@@ -83,7 +83,7 @@ static int SampleTcpServer()
ICUNIT_ASSERT_NOT_EQUAL
(
sfd
,
-
1
,
sfd
);
/* send */
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
strcpy_s
(
gBuf
,
BUF_SIZE
-
1
,
SRV_MSG
);
...
...
@@ -94,7 +94,7 @@ static int SampleTcpServer()
ICUNIT_ASSERT_EQUAL
(
ret
,
strlen
(
SRV_MSG
),
ret
);
/* recv */
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
recv
(
sfd
,
gBuf
,
sizeof
(
gBuf
),
0
);
...
...
@@ -107,7 +107,7 @@ static int SampleTcpServer()
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
strcpy_s
(
gBuf
,
BUF_SIZE
-
1
,
SRV_MSG
);
...
...
@@ -128,7 +128,7 @@ static int SampleTcpServer()
Wait
();
/* recvmsg */
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
memset_s
(
&
msg
,
sizeof
(
msg
),
0
,
sizeof
(
msg
));
...
...
@@ -196,7 +196,7 @@ static int SampleTcpClient()
inet_addr
(
STACK_IP
),
((
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
.
s_addr
);
/* send */
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
strcpy_s
(
gBuf
,
BUF_SIZE
-
1
,
CLI_MSG
);
...
...
@@ -207,7 +207,7 @@ static int SampleTcpClient()
ICUNIT_ASSERT_EQUAL
(
ret
,
strlen
(
CLI_MSG
),
ret
);
/* recv */
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
recv
(
sfd
,
gBuf
,
sizeof
(
gBuf
),
0
);
...
...
@@ -220,7 +220,7 @@ static int SampleTcpClient()
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
strcpy_s
(
gBuf
,
BUF_SIZE
-
1
,
CLI_MSG
);
...
...
@@ -241,7 +241,7 @@ static int SampleTcpClient()
Wait
();
/* recvmsg */
ret
=
memset_s
(
gBuf
,
BUF_SIZE
-
1
,
0
,
BUF_SIZE
-
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gBuf
[
BUF_SIZE
-
1
]
=
'\0'
;
ret
=
memset_s
(
&
msg
,
sizeof
(
msg
),
0
,
sizeof
(
msg
));
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_007.cpp
浏览文件 @
1b11caa4
...
...
@@ -139,13 +139,17 @@ static int TcpTest()
}
else
{
printf
(
"malloc 20M success
\n
"
);
ret
=
memset_s
(
buf
,
bufSiz
,
0
,
bufSiz
);
ICUNIT_
ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_
GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ret
=
send
(
lsfd
,
buf
,
bufSiz
,
0
);
printf
(
"send ret = %d, errno :%d
\n
"
,
ret
,
errno
);
ICUNIT_
ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_
GOTO_EQUAL
(
ret
,
-
1
,
ret
,
EXIT
);
}
#endif
EXIT:
if
(
buf
!=
NULL
)
{
free
(
buf
);
}
#endif
close
(
lsfd
);
return
0
;
}
...
...
testsuites/unittest/process/basic/process/full/process_test_066.cpp
浏览文件 @
1b11caa4
...
...
@@ -149,6 +149,9 @@ static int TestSpawnAttr(short flag)
ICUNIT_GOTO_EQUAL
(
status
,
0
,
status
,
EXIT
);
fd
=
open
(
"/storage/testspawnattr.txt"
,
O_RDWR
|
O_CREAT
,
0644
);
// 0644, open config
if
(
fd
<
0
)
{
goto
EXIT
;
}
ret
=
read
(
fd
,
temp
,
NUMMAX
);
ICUNIT_GOTO_EQUAL
(
ret
,
NUMMAX
,
ret
,
EXIT1
);
...
...
testsuites/unittest/process/basic/process/smoke/process_test_046.cpp
浏览文件 @
1b11caa4
...
...
@@ -51,7 +51,6 @@ static int Testcase(void)
CPU_SET
(
1
,
&
cpuset
);
/* cpu1 unsupported operation */
ret
=
sched_setaffinity
(
getpid
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
ICUNIT_GOTO_EQUAL
(
ret
,
-
1
,
ret
,
ERROR_OUT
);
CPU_ZERO
(
&
cpuset
);
CPU_ZERO
(
&
cpuset
);
CPU_SET
(
0
,
&
cpuset
);
/* cpu0 */
...
...
testsuites/unittest/security/vid/smoke/vid_test_001.cpp
浏览文件 @
1b11caa4
...
...
@@ -55,7 +55,14 @@ static void ChildFunc()
ent
.
sigev_signo
=
SIGUSR1
;
tid2
=
(
timer_t
*
)
malloc
(
sizeof
(
UINTPTR
)
*
1024
);
if
(
tid2
==
NULL
)
{
return
;
}
ret1
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
1024
);
if
(
ret1
==
NULL
)
{
free
(
tid2
);
return
;
}
(
void
)
memset_s
(
tid2
,
sizeof
(
char
*
)
*
1024
,
0
,
sizeof
(
char
*
)
*
1024
);
(
void
)
memset_s
(
ret1
,
sizeof
(
int
)
*
1024
,
0xff
,
sizeof
(
int
)
*
1024
);
while
(
i
<
1024
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录