Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
6ed09bf1
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 2 年 前同步成功
通知
475
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看板
未验证
提交
6ed09bf1
编写于
9月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!993 Fix : 内核告警清理挑单
Merge pull request !993 from yinjiaming/cherry-pick-1663656326
上级
edd22230
96b2d557
变更
155
隐藏空白更改
内联
并排
Showing
155 changed file
with
532 addition
and
460 deletion
+532
-460
fs/proc/src/proc_file.c
fs/proc/src/proc_file.c
+4
-2
fs/vfs/vfs_cmd/vfs_shellcmd.c
fs/vfs/vfs_cmd/vfs_shellcmd.c
+2
-2
kernel/common/console.c
kernel/common/console.c
+1
-1
net/lwip-2.1/porting/include/arch/perf.h
net/lwip-2.1/porting/include/arch/perf.h
+2
-2
testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_027.c
...rnel/sample/kernel_base/ipc/event/full/It_los_event_027.c
+2
-1
testsuites/kernel/sample/kernel_base/ipc/sem/smp/It_smp_los_sem_026.c
...ernel/sample/kernel_base/ipc/sem/smp/It_smp_los_sem_026.c
+2
-2
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_035.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_035.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_080.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_080.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_081.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_081.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_082.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_082.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_083.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_083.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_084.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_084.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_085.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_085.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_088.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_088.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_089.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_089.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_138.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_138.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_215.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_215.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_233.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_233.c
+2
-1
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_238.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_238.c
+4
-2
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_239.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_239.c
+4
-2
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_240.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_240.c
+4
-2
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_246.c
...s/kernel/sample/posix/pthread/full/It_posix_pthread_246.c
+4
-2
testsuites/kernel/src/iCunit.c
testsuites/kernel/src/iCunit.c
+3
-2
testsuites/kernel/src/osTest.c
testsuites/kernel/src/osTest.c
+2
-1
testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp
testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp
+2
-2
testsuites/unittest/basic/mem/shm/full/it_test_mem_100.cpp
testsuites/unittest/basic/mem/shm/full/it_test_mem_100.cpp
+1
-1
testsuites/unittest/basic/mem/shm/full/shm_test_001.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_001.cpp
+1
-1
testsuites/unittest/basic/mem/shm/full/shm_test_005.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_005.cpp
+3
-3
testsuites/unittest/basic/mem/shm/full/shm_test_006.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_006.cpp
+2
-2
testsuites/unittest/basic/mem/shm/full/shm_test_007.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_007.cpp
+3
-3
testsuites/unittest/basic/mem/shm/full/shm_test_008.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_008.cpp
+2
-2
testsuites/unittest/basic/mem/shm/full/shm_test_009.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_009.cpp
+2
-2
testsuites/unittest/basic/mem/shm/full/shm_test_013.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_013.cpp
+2
-2
testsuites/unittest/basic/mem/shm/full/shm_test_014.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_014.cpp
+2
-2
testsuites/unittest/basic/mem/shm/smoke/shm_test_011.cpp
testsuites/unittest/basic/mem/shm/smoke/shm_test_011.cpp
+2
-2
testsuites/unittest/basic/mem/vm/smoke/mmap_test_002.cpp
testsuites/unittest/basic/mem/vm/smoke/mmap_test_002.cpp
+1
-1
testsuites/unittest/basic/mem/vm/smoke/mmap_test_006.cpp
testsuites/unittest/basic/mem/vm/smoke/mmap_test_006.cpp
+1
-1
testsuites/unittest/basic/mem/vm/smoke/user_copy_test_001.cpp
...suites/unittest/basic/mem/vm/smoke/user_copy_test_001.cpp
+7
-5
testsuites/unittest/drivers/hid/smoke/hid_test_001.cpp
testsuites/unittest/drivers/hid/smoke/hid_test_001.cpp
+1
-1
testsuites/unittest/drivers/storage/smoke/storage_test_001.cpp
...uites/unittest/drivers/storage/smoke/storage_test_001.cpp
+1
-1
testsuites/unittest/extended/liteipc/smoke/liteipc_test_001.cpp
...ites/unittest/extended/liteipc/smoke/liteipc_test_001.cpp
+7
-7
testsuites/unittest/extended/liteipc/smoke/liteipc_test_002.cpp
...ites/unittest/extended/liteipc/smoke/liteipc_test_002.cpp
+2
-2
testsuites/unittest/extended/signal/full/It_ipc_pipe_002.cpp
testsuites/unittest/extended/signal/full/It_ipc_pipe_002.cpp
+1
-1
testsuites/unittest/extended/signal/full/It_ipc_pipe_003.cpp
testsuites/unittest/extended/signal/full/It_ipc_pipe_003.cpp
+1
-1
testsuites/unittest/extended/signal/full/pipe_test_005.cpp
testsuites/unittest/extended/signal/full/pipe_test_005.cpp
+1
-1
testsuites/unittest/extended/signal/full/signal_test_026.cpp
testsuites/unittest/extended/signal/full/signal_test_026.cpp
+1
-1
testsuites/unittest/extended/signal/full/signal_test_029.cpp
testsuites/unittest/extended/signal/full/signal_test_029.cpp
+2
-2
testsuites/unittest/extended/signal/smoke/pipe_test_002.cpp
testsuites/unittest/extended/signal/smoke/pipe_test_002.cpp
+1
-1
testsuites/unittest/extended/signal/smoke/signal_test_002.cpp
...suites/unittest/extended/signal/smoke/signal_test_002.cpp
+3
-3
testsuites/unittest/extended/signal/smoke/signal_test_013.cpp
...suites/unittest/extended/signal/smoke/signal_test_013.cpp
+9
-9
testsuites/unittest/extended/signal/smoke/signal_test_037.cpp
...suites/unittest/extended/signal/smoke/signal_test_037.cpp
+1
-1
testsuites/unittest/extended/trace/smoke/trace_test_004.cpp
testsuites/unittest/extended/trace/smoke/trace_test_004.cpp
+1
-1
testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp
testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp
+1
-1
testsuites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp
...uites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp
+5
-5
testsuites/unittest/libc/io/full/It_stdio_hasmntopt_001.cpp
testsuites/unittest/libc/io/full/It_stdio_hasmntopt_001.cpp
+1
-1
testsuites/unittest/libc/misc/full/misc_test_006.cpp
testsuites/unittest/libc/misc/full/misc_test_006.cpp
+3
-3
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_145.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_145.cpp
+8
-8
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_146.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_146.cpp
+4
-4
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_162.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_162.cpp
+4
-4
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_010.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_010.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_023.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_023.cpp
+5
-4
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_025.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_025.cpp
+3
-3
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_026.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_026.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_027.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_027.cpp
+4
-4
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_028.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_028.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_029.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_029.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_030.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_030.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_031.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_031.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_034.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_034.cpp
+3
-3
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_035.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_035.cpp
+5
-4
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_039.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_039.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_040.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_040.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_042.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_042.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_044.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_044.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_045.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_045.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_046.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_046.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_051.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_051.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_052.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_052.cpp
+3
-3
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_053.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_053.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_054.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_054.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_055.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_055.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_059.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_059.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_060.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_060.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_061.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_061.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_062.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_062.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_063.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_063.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_064.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_064.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_066.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_066.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_080.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_080.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_081.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_081.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_082.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_082.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_083.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_083.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_084.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_084.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_085.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_085.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_087.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_087.cpp
+4
-4
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_088.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_088.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_089.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_089.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_090.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_090.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_091.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_091.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_092.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_092.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_094.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_094.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_095.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_095.cpp
+2
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_107.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_107.cpp
+7
-7
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_138.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_138.cpp
+2
-1
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_233.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_233.cpp
+4
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_238.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_238.cpp
+4
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_239.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_239.cpp
+4
-2
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_240.cpp
...unittest/libc/posix/pthread/full/It_posix_pthread_240.cpp
+4
-2
testsuites/unittest/libc/posix/pthread/posix_pthread_test.cpp
...suites/unittest/libc/posix/pthread/posix_pthread_test.cpp
+17
-17
testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_004.cpp
...nittest/libc/posix/pthread/smoke/It_posix_pthread_004.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_005.cpp
...nittest/libc/posix/pthread/smoke/It_posix_pthread_005.cpp
+1
-1
testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_006.cpp
...nittest/libc/posix/pthread/smoke/It_posix_pthread_006.cpp
+1
-1
testsuites/unittest/libc/sys/smoke/sys_test_008.cpp
testsuites/unittest/libc/sys/smoke/sys_test_008.cpp
+3
-3
testsuites/unittest/libc/sys/smoke/sys_test_009.cpp
testsuites/unittest/libc/sys/smoke/sys_test_009.cpp
+2
-2
testsuites/unittest/libc/sys/smoke/sys_test_010.cpp
testsuites/unittest/libc/sys/smoke/sys_test_010.cpp
+1
-1
testsuites/unittest/libc/sys/smoke/sys_test_012.cpp
testsuites/unittest/libc/sys/smoke/sys_test_012.cpp
+2
-2
testsuites/unittest/libc/sys/smoke/sys_test_013.cpp
testsuites/unittest/libc/sys/smoke/sys_test_013.cpp
+1
-1
testsuites/unittest/libc/sys/smoke/sys_test_016.cpp
testsuites/unittest/libc/sys/smoke/sys_test_016.cpp
+1
-1
testsuites/unittest/libc/time/clock/full/clock_test_010.cpp
testsuites/unittest/libc/time/clock/full/clock_test_010.cpp
+3
-3
testsuites/unittest/libc/time/timer/smoke/timer_test_003.cpp
testsuites/unittest/libc/time/timer/smoke/timer_test_003.cpp
+3
-2
testsuites/unittest/libc/time/timer/smoke/timer_test_004.cpp
testsuites/unittest/libc/time/timer/smoke/timer_test_004.cpp
+1
-1
testsuites/unittest/libc/time/timer/smoke/timer_test_005.cpp
testsuites/unittest/libc/time/timer/smoke/timer_test_005.cpp
+2
-2
testsuites/unittest/libc/time/timer/smoke/timer_test_tzset_002.cpp
...s/unittest/libc/time/timer/smoke/timer_test_tzset_002.cpp
+1
-1
testsuites/unittest/libc/util/smoke/util_test_007.cpp
testsuites/unittest/libc/util/smoke/util_test_007.cpp
+7
-5
testsuites/unittest/net/resolv/smoke/net_resolv_test_001.cpp
testsuites/unittest/net/resolv/smoke/net_resolv_test_001.cpp
+12
-12
testsuites/unittest/net/socket/smoke/net_socket_test_002.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_002.cpp
+4
-4
testsuites/unittest/net/socket/smoke/net_socket_test_003.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_003.cpp
+14
-12
testsuites/unittest/net/socket/smoke/net_socket_test_007.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_007.cpp
+42
-32
testsuites/unittest/net/socket/smoke/net_socket_test_008.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_008.cpp
+3
-3
testsuites/unittest/net/socket/smoke/net_socket_test_009.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_009.cpp
+3
-3
testsuites/unittest/net/socket/smoke/net_socket_test_010.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_010.cpp
+2
-2
testsuites/unittest/net/socket/smoke/net_socket_test_011.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_011.cpp
+2
-2
testsuites/unittest/net/socket/smoke/net_socket_test_012.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_012.cpp
+10
-10
testsuites/unittest/net/socket/smoke/net_socket_test_013.cpp
testsuites/unittest/net/socket/smoke/net_socket_test_013.cpp
+4
-4
testsuites/unittest/process/basic/process/full/process_test_042.cpp
.../unittest/process/basic/process/full/process_test_042.cpp
+5
-4
testsuites/unittest/process/basic/process/full/process_test_049.cpp
.../unittest/process/basic/process/full/process_test_049.cpp
+3
-3
testsuites/unittest/process/basic/process/full/process_test_050.cpp
.../unittest/process/basic/process/full/process_test_050.cpp
+2
-2
testsuites/unittest/process/basic/process/full/process_test_051.cpp
.../unittest/process/basic/process/full/process_test_051.cpp
+2
-2
testsuites/unittest/process/basic/process/full/process_test_052.cpp
.../unittest/process/basic/process/full/process_test_052.cpp
+3
-3
testsuites/unittest/process/basic/process/full/process_test_062.cpp
.../unittest/process/basic/process/full/process_test_062.cpp
+2
-2
testsuites/unittest/process/basic/process/full/process_test_063.cpp
.../unittest/process/basic/process/full/process_test_063.cpp
+9
-9
testsuites/unittest/process/basic/process/full/process_test_064.cpp
.../unittest/process/basic/process/full/process_test_064.cpp
+7
-7
testsuites/unittest/process/basic/process/it_test_process.h
testsuites/unittest/process/basic/process/it_test_process.h
+5
-5
testsuites/unittest/process/basic/process/smoke/process_test_023.cpp
...unittest/process/basic/process/smoke/process_test_023.cpp
+2
-2
testsuites/unittest/process/basic/pthread/full/pthread_test_001.cpp
.../unittest/process/basic/pthread/full/pthread_test_001.cpp
+3
-3
testsuites/unittest/process/basic/pthread/full/pthread_test_004.cpp
.../unittest/process/basic/pthread/full/pthread_test_004.cpp
+2
-2
testsuites/unittest/process/basic/pthread/it_pthread_test.h
testsuites/unittest/process/basic/pthread/it_pthread_test.h
+5
-5
testsuites/unittest/process/basic/pthread/smoke/pthread_once_test_001.cpp
...est/process/basic/pthread/smoke/pthread_once_test_001.cpp
+1
-1
testsuites/unittest/process/basic/pthread/smoke/pthread_test_019.cpp
...unittest/process/basic/pthread/smoke/pthread_test_019.cpp
+1
-1
testsuites/unittest/process/lock/rwlock/full/pthread_rwlock_test_002.cpp
...test/process/lock/rwlock/full/pthread_rwlock_test_002.cpp
+1
-1
testsuites/unittest/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp
...est/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp
+1
-1
testsuites/unittest/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp
...process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp
+1
-1
testsuites/unittest/security/reugid/smoke/reugid_test_001.cpp
...suites/unittest/security/reugid/smoke/reugid_test_001.cpp
+76
-68
testsuites/unittest/security/vid/smoke/vid_test_001.cpp
testsuites/unittest/security/vid/smoke/vid_test_001.cpp
+1
-1
tools/scripts/parse_exc/parse_excinfo.py
tools/scripts/parse_exc/parse_excinfo.py
+1
-1
未找到文件。
fs/proc/src/proc_file.c
浏览文件 @
6ed09bf1
...
@@ -62,8 +62,9 @@ static struct ProcDirEntry g_procRootDirEntry = {
...
@@ -62,8 +62,9 @@ static struct ProcDirEntry g_procRootDirEntry = {
int
ProcMatch
(
unsigned
int
len
,
const
char
*
name
,
struct
ProcDirEntry
*
pn
)
int
ProcMatch
(
unsigned
int
len
,
const
char
*
name
,
struct
ProcDirEntry
*
pn
)
{
{
if
(
len
!=
pn
->
nameLen
)
if
(
len
!=
pn
->
nameLen
)
{
return
0
;
return
0
;
}
return
!
strncmp
(
name
,
pn
->
name
,
len
);
return
!
strncmp
(
name
,
pn
->
name
,
len
);
}
}
...
@@ -387,8 +388,9 @@ static void FreeProcEntry(struct ProcDirEntry *entry)
...
@@ -387,8 +388,9 @@ static void FreeProcEntry(struct ProcDirEntry *entry)
void
ProcFreeEntry
(
struct
ProcDirEntry
*
pn
)
void
ProcFreeEntry
(
struct
ProcDirEntry
*
pn
)
{
{
if
(
atomic_dec_and_test
(
&
pn
->
count
))
if
(
atomic_dec_and_test
(
&
pn
->
count
))
{
FreeProcEntry
(
pn
);
FreeProcEntry
(
pn
);
}
}
}
static
void
RemoveProcEntryTravalsal
(
struct
ProcDirEntry
*
pn
)
static
void
RemoveProcEntryTravalsal
(
struct
ProcDirEntry
*
pn
)
...
...
fs/vfs/vfs_cmd/vfs_shellcmd.c
浏览文件 @
6ed09bf1
...
@@ -344,7 +344,7 @@ int osShellCmdMount(int argc, const char **argv)
...
@@ -344,7 +344,7 @@ int osShellCmdMount(int argc, const char **argv)
filessystemtype
=
(
argc
>=
4
)
?
(
char
*
)
argv
[
3
]
:
NULL
;
/* 4: specify fs type, 3: fs type */
filessystemtype
=
(
argc
>=
4
)
?
(
char
*
)
argv
[
3
]
:
NULL
;
/* 4: specify fs type, 3: fs type */
mountfalgs
=
(
argc
>=
5
)
?
get_mountflags
((
const
char
*
)
argv
[
4
])
:
0
;
/* 4: usr option */
mountfalgs
=
(
argc
>=
5
)
?
get_mountflags
((
const
char
*
)
argv
[
4
])
:
0
;
/* 4: usr option */
data
=
(
argc
>=
6
)
?
(
char
*
)
argv
[
5
]
:
NULL
;
/* 5: usr option data */
data
=
(
argc
>=
6
)
?
(
char
*
)
argv
[
5
]
:
NULL
;
/* 5: usr option data
, 6: six args needed for data
*/
if
(
strcmp
(
argv
[
1
],
"0"
)
==
0
)
{
if
(
strcmp
(
argv
[
1
],
"0"
)
==
0
)
{
ret
=
mount
((
const
char
*
)
NULL
,
fullpath
,
filessystemtype
,
mountfalgs
,
data
);
ret
=
mount
((
const
char
*
)
NULL
,
fullpath
,
filessystemtype
,
mountfalgs
,
data
);
...
@@ -384,7 +384,7 @@ int osShellCmdMount(int argc, const char **argv)
...
@@ -384,7 +384,7 @@ int osShellCmdMount(int argc, const char **argv)
}
}
mountfalgs
=
(
argc
>=
4
)
?
get_mountflags
((
const
char
*
)
argv
[
3
])
:
0
;
/* 3: usr option */
mountfalgs
=
(
argc
>=
4
)
?
get_mountflags
((
const
char
*
)
argv
[
3
])
:
0
;
/* 3: usr option */
data
=
(
argc
>=
5
)
?
(
char
*
)
argv
[
4
]
:
NULL
;
/* 4: usr option data */
data
=
(
argc
>=
5
)
?
(
char
*
)
argv
[
4
]
:
NULL
;
/* 4: usr option data
, 5: number of args needed for data
*/
if
(
strcmp
(
argv
[
0
],
"0"
)
==
0
)
{
if
(
strcmp
(
argv
[
0
],
"0"
)
==
0
)
{
ret
=
mount
((
const
char
*
)
NULL
,
fullpath
,
argv
[
2
],
mountfalgs
,
data
);
ret
=
mount
((
const
char
*
)
NULL
,
fullpath
,
argv
[
2
],
mountfalgs
,
data
);
...
...
kernel/common/console.c
浏览文件 @
6ed09bf1
...
@@ -404,7 +404,7 @@ STATIC VOID EchoToTerminal(CONSOLE_CB *consoleCB, struct file *filep, const stru
...
@@ -404,7 +404,7 @@ STATIC VOID EchoToTerminal(CONSOLE_CB *consoleCB, struct file *filep, const stru
{
{
if
(
consoleCB
->
consoleTermios
.
c_lflag
&
ECHO
)
{
if
(
consoleCB
->
consoleTermios
.
c_lflag
&
ECHO
)
{
if
(
ch
==
'\b'
)
{
if
(
ch
==
'\b'
)
{
(
VOID
)
fops
->
write
(
filep
,
"
\b
\b
"
,
3
);
(
VOID
)
fops
->
write
(
filep
,
"
\b
\b
"
,
3
);
// 3: length of "\b \b"
}
else
{
}
else
{
(
VOID
)
fops
->
write
(
filep
,
&
ch
,
EACH_CHAR
);
(
VOID
)
fops
->
write
(
filep
,
&
ch
,
EACH_CHAR
);
}
}
...
...
net/lwip-2.1/porting/include/arch/perf.h
浏览文件 @
6ed09bf1
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
#if LWIP_PERF
#if LWIP_PERF
#define PERF_START do {
/* something to do */
} while (0)
#define PERF_START do {
} while (0)
/* something to do */
#define PERF_STOP(x) do {
/* something to do */
} while (0)
#define PERF_STOP(x) do {
} while (0)
/* something to do */
#endif
#endif
...
...
testsuites/kernel/sample/kernel_base/ipc/event/full/It_los_event_027.c
浏览文件 @
6ed09bf1
...
@@ -48,8 +48,9 @@ static VOID SwtmrF01(VOID)
...
@@ -48,8 +48,9 @@ static VOID SwtmrF01(VOID)
g_eventMask
=
g_eventMask
|
(
1
<<
g_testCount
);
g_eventMask
=
g_eventMask
|
(
1
<<
g_testCount
);
if
(
g_testCount
>
17
)
// g_testCount > 17, do noting return
if
(
g_testCount
>
17
)
{
// g_testCount > 17, do noting return
return
;
return
;
}
ret
=
LOS_EventWrite
(
&
g_event
,
g_eventMask
);
ret
=
LOS_EventWrite
(
&
g_event
,
g_eventMask
);
ICUNIT_ASSERT_EQUAL_VOID
(
ret
,
LOS_OK
,
ret
);
ICUNIT_ASSERT_EQUAL_VOID
(
ret
,
LOS_OK
,
ret
);
...
...
testsuites/kernel/sample/kernel_base/ipc/sem/smp/It_smp_los_sem_026.c
浏览文件 @
6ed09bf1
...
@@ -104,9 +104,9 @@ static UINT32 Testcase(VOID)
...
@@ -104,9 +104,9 @@ static UINT32 Testcase(VOID)
TestAssertBusyTaskDelay
(
100
,
3
);
// 100, Set the timeout of runtime; 3, test running count
TestAssertBusyTaskDelay
(
100
,
3
);
// 100, Set the timeout of runtime; 3, test running count
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
// 3, Here, assert that g_testCount is equal to
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
// 3, Here, assert that g_testCount is equal to
if
((
g_ret1
+
g_ret2
==
0xff
)
&&
(
TestAbs
(
g_ret1
,
g_ret2
)
==
0xff
))
if
((
g_ret1
+
g_ret2
==
0xff
)
&&
(
TestAbs
(
g_ret1
,
g_ret2
)
==
0xff
))
{
ICUNIT_GOTO_EQUAL
(
1
,
1
,
g_ret1
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
1
,
1
,
g_ret1
,
EXIT
);
else
{
}
else
{
ICUNIT_GOTO_EQUAL
(
1
,
0
,
g_ret1
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
1
,
0
,
g_ret1
,
EXIT
);
}
}
PRINT_DEBUG
(
"ret1=0x%x,ret2=0x%x
\n
"
,
g_ret1
,
g_ret2
);
PRINT_DEBUG
(
"ret1=0x%x,ret2=0x%x
\n
"
,
g_ret1
,
g_ret2
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_035.c
浏览文件 @
6ed09bf1
...
@@ -105,8 +105,9 @@ static UINT32 Testcase(VOID)
...
@@ -105,8 +105,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh3
,
NULL
,
PthreadF03
,
NULL
);
ret
=
pthread_create
(
&
newTh3
,
NULL
,
PthreadF03
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
while
(
g_testCount
<
6
)
// 6, wait until g_testCount is equal to 6.
while
(
g_testCount
<
6
)
{
// 6, wait until g_testCount is equal to 6.
sleep
(
1
);
sleep
(
1
);
}
ICUNIT_ASSERT_EQUAL
(
g_testCount
,
6
,
g_testCount
);
// 6, here assert the result.
ICUNIT_ASSERT_EQUAL
(
g_testCount
,
6
,
g_testCount
);
// 6, here assert the result.
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_080.c
浏览文件 @
6ed09bf1
...
@@ -75,8 +75,9 @@ static UINT32 Testcase(VOID)
...
@@ -75,8 +75,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
100
);
// 100, delay for Timing control.
usleep
(
100
);
// 100, delay for Timing control.
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_081.c
浏览文件 @
6ed09bf1
...
@@ -80,8 +80,9 @@ static UINT32 Testcase(VOID)
...
@@ -80,8 +80,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
100
);
// 100, delay for Timing control.
usleep
(
100
);
// 100, delay for Timing control.
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_082.c
浏览文件 @
6ed09bf1
...
@@ -87,8 +87,9 @@ static UINT32 Testcase(VOID)
...
@@ -87,8 +87,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
100
);
// 100, delay for Timing control.
usleep
(
100
);
// 100, delay for Timing control.
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_083.c
浏览文件 @
6ed09bf1
...
@@ -76,8 +76,9 @@ static UINT32 Testcase(VOID)
...
@@ -76,8 +76,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
100
);
// 100, delay for Timing control.
usleep
(
100
);
// 100, delay for Timing control.
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_084.c
浏览文件 @
6ed09bf1
...
@@ -79,8 +79,9 @@ static UINT32 Testcase(VOID)
...
@@ -79,8 +79,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
100
);
// 100, delay for Timing control.
usleep
(
100
);
// 100, delay for Timing control.
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_085.c
浏览文件 @
6ed09bf1
...
@@ -75,8 +75,9 @@ static UINT32 Testcase(VOID)
...
@@ -75,8 +75,9 @@ static UINT32 Testcase(VOID)
rc
=
pthread_create
(
&
thread1
,
NULL
,
PthreadF01
,
NULL
);
rc
=
pthread_create
(
&
thread1
,
NULL
,
PthreadF01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
while
(
!
g_t1Start
)
/* wait for thread1 started */
while
(
!
g_t1Start
)
{
/* wait for thread1 started */
usleep
(
100
);
// 100, delay for Timing control.
usleep
(
100
);
// 100, delay for Timing control.
}
/* acquire the mutex released by pthread_cond_wait() within thread 1 */
/* acquire the mutex released by pthread_cond_wait() within thread 1 */
rc
=
pthread_mutex_lock
(
&
g_td
.
mutex
);
rc
=
pthread_mutex_lock
(
&
g_td
.
mutex
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_088.c
浏览文件 @
6ed09bf1
...
@@ -114,8 +114,9 @@ static void *PthreadF02(void *tmp)
...
@@ -114,8 +114,9 @@ static void *PthreadF02(void *tmp)
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
while
(
1
)
{
while
(
1
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
{
break
;
break
;
}
}
}
g_lowDone
=
1
;
g_lowDone
=
1
;
EXIT:
EXIT:
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_089.c
浏览文件 @
6ed09bf1
...
@@ -115,8 +115,9 @@ static void *PthreadF02(void *tmp)
...
@@ -115,8 +115,9 @@ static void *PthreadF02(void *tmp)
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
while
(
1
)
{
while
(
1
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
{
break
;
break
;
}
}
}
g_lowDone
=
1
;
g_lowDone
=
1
;
EXIT:
EXIT:
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_138.c
浏览文件 @
6ed09bf1
...
@@ -58,8 +58,9 @@ static UINT32 Testcase(VOID)
...
@@ -58,8 +58,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
/* Make sure the thread was created before we join it. */
/* Make sure the thread was created before we join it. */
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_join
(
newTh
,
&
valuePtr
);
ret
=
pthread_join
(
newTh
,
&
valuePtr
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_215.c
浏览文件 @
6ed09bf1
...
@@ -77,8 +77,9 @@ static UINT32 Testcase(VOID)
...
@@ -77,8 +77,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_testCount
==
0
)
while
(
g_testCount
==
0
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_233.c
浏览文件 @
6ed09bf1
...
@@ -76,8 +76,9 @@ static UINT32 Testcase(VOID)
...
@@ -76,8 +76,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
0
)
while
(
g_pthreadSem
==
0
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_238.c
浏览文件 @
6ed09bf1
...
@@ -51,8 +51,9 @@ static VOID *PthreadF01(VOID *argument)
...
@@ -51,8 +51,9 @@ static VOID *PthreadF01(VOID *argument)
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
pthread_testcancel
();
pthread_testcancel
();
...
@@ -73,8 +74,9 @@ static UINT32 Testcase(VOID)
...
@@ -73,8 +74,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_239.c
浏览文件 @
6ed09bf1
...
@@ -48,8 +48,9 @@ static VOID *PthreadF01(VOID *argument)
...
@@ -48,8 +48,9 @@ static VOID *PthreadF01(VOID *argument)
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
pthread_testcancel
();
pthread_testcancel
();
...
@@ -69,8 +70,9 @@ static UINT32 Testcase(VOID)
...
@@ -69,8 +70,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_240.c
浏览文件 @
6ed09bf1
...
@@ -48,8 +48,9 @@ static VOID *PthreadF01(VOID *argument)
...
@@ -48,8 +48,9 @@ static VOID *PthreadF01(VOID *argument)
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
pthread_testcancel
();
pthread_testcancel
();
...
@@ -70,8 +71,9 @@ static UINT32 Testcase(VOID)
...
@@ -70,8 +71,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_246.c
浏览文件 @
6ed09bf1
...
@@ -48,8 +48,9 @@ static VOID *PthreadF01(VOID *argument)
...
@@ -48,8 +48,9 @@ static VOID *PthreadF01(VOID *argument)
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
pthread_testcancel
();
pthread_testcancel
();
...
@@ -71,8 +72,9 @@ static UINT32 Testcase(VOID)
...
@@ -71,8 +72,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
PthreadF01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/kernel/src/iCunit.c
浏览文件 @
6ed09bf1
...
@@ -202,10 +202,11 @@ iUINT32 ICunitInit(void)
...
@@ -202,10 +202,11 @@ iUINT32 ICunitInit(void)
iUINT32
ICunitRunSingle
(
ICUNIT_CASE_S
*
psubCase
)
iUINT32
ICunitRunSingle
(
ICUNIT_CASE_S
*
psubCase
)
{
{
if
((
g_isSpinorInit
==
FALSE
)
&&
(
psubCase
->
testcase_module
==
TEST_JFFS
))
if
((
g_isSpinorInit
==
FALSE
)
&&
(
psubCase
->
testcase_module
==
TEST_JFFS
))
{
dprintf
(
"****** Jffs is not support ! ******
\n
"
);
dprintf
(
"****** Jffs is not support ! ******
\n
"
);
else
}
else
{
ICunitRunF
(
psubCase
);
ICunitRunF
(
psubCase
);
}
return
(
iUINT32
)
ICUNIT_SUCCESS
;
return
(
iUINT32
)
ICUNIT_SUCCESS
;
}
}
...
...
testsuites/kernel/src/osTest.c
浏览文件 @
6ed09bf1
...
@@ -315,8 +315,9 @@ VOID TestTestHwiDelete(unsigned int irq, VOID *devId)
...
@@ -315,8 +315,9 @@ VOID TestTestHwiDelete(unsigned int irq, VOID *devId)
{
{
HwiIrqParam
stuwIrqPara
;
HwiIrqParam
stuwIrqPara
;
if
(
OS_INT_ACTIVE
)
if
(
OS_INT_ACTIVE
)
{
return
;
return
;
}
stuwIrqPara
.
swIrq
=
irq
;
stuwIrqPara
.
swIrq
=
irq
;
stuwIrqPara
.
pDevId
=
devId
;
stuwIrqPara
.
pDevId
=
devId
;
...
...
testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp
浏览文件 @
6ed09bf1
...
@@ -55,7 +55,7 @@ static int Testcase(void)
...
@@ -55,7 +55,7 @@ static int Testcase(void)
handle
=
dlopen
(
LIBCSO_REAL_PATH
,
RTLD_NOW
);
handle
=
dlopen
(
LIBCSO_REAL_PATH
,
RTLD_NOW
);
ICUNIT_ASSERT_NOT_EQUAL
(
handle
,
NULL
,
handle
);
ICUNIT_ASSERT_NOT_EQUAL
(
handle
,
NULL
,
handle
);
func
=
(
int
(
*
)(
int
))
dlsym
(
handle
,
SYMBOL_TO_FIND
);
func
=
reinterpret_cast
<
int
(
*
)(
int
)
>
(
dlsym
(
handle
,
SYMBOL_TO_FIND
)
);
ICUNIT_GOTO_NOT_EQUAL
(
func
,
NULL
,
func
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
func
,
NULL
,
func
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
func
,
SYMBOL_TO_MATCH
,
func
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
func
,
SYMBOL_TO_MATCH
,
func
,
EXIT
);
...
@@ -65,7 +65,7 @@ static int Testcase(void)
...
@@ -65,7 +65,7 @@ static int Testcase(void)
handle
=
dlopen
(
LIBCSO_RELATIVE_PATH
,
RTLD_NOW
);
handle
=
dlopen
(
LIBCSO_RELATIVE_PATH
,
RTLD_NOW
);
ICUNIT_ASSERT_NOT_EQUAL
(
handle
,
NULL
,
handle
);
ICUNIT_ASSERT_NOT_EQUAL
(
handle
,
NULL
,
handle
);
func
=
(
int
(
*
)(
int
))
dlsym
(
handle
,
SYMBOL_TO_FIND
);
func
=
reinterpret_cast
<
int
(
*
)(
int
)
>
(
dlsym
(
handle
,
SYMBOL_TO_FIND
)
);
ICUNIT_GOTO_NOT_EQUAL
(
func
,
NULL
,
func
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
func
,
NULL
,
func
,
EXIT
);
ret
=
dlclose
(
handle
);
ret
=
dlclose
(
handle
);
...
...
testsuites/unittest/basic/mem/shm/full/it_test_mem_100.cpp
浏览文件 @
6ed09bf1
...
@@ -41,7 +41,7 @@ static int TestCase(void)
...
@@ -41,7 +41,7 @@ static int TestCase(void)
wchar_t
res2
[]
=
L"abcdmngh"
;
wchar_t
res2
[]
=
L"abcdmngh"
;
wchar_t
*
p
,
*
pnew
;
wchar_t
*
p
,
*
pnew
;
pnew
=
(
wchar_t
*
)
malloc
(
sizeof
(
wchar_t
)
*
(
wcslen
(
res
)
+
wcslen
(
res1
)));
pnew
=
static_cast
<
wchar_t
*>
(
malloc
(
sizeof
(
wchar_t
)
*
(
wcslen
(
res
)
+
wcslen
(
res1
)
)));
ICUNIT_ASSERT_NOT_EQUAL
(
pnew
,
NULL
,
pnew
);
ICUNIT_ASSERT_NOT_EQUAL
(
pnew
,
NULL
,
pnew
);
p
=
wmempcpy
(
pnew
,
res
,
wcslen
(
res
));
p
=
wmempcpy
(
pnew
,
res
,
wcslen
(
res
));
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -91,7 +91,7 @@ VOID *ShmWriteFunc(VOID *ptr)
...
@@ -91,7 +91,7 @@ VOID *ShmWriteFunc(VOID *ptr)
shmid
=
shmget
((
key_t
)
1234
,
sizeof
(
struct
shared_use_st
),
0666
|
IPC_CREAT
);
shmid
=
shmget
((
key_t
)
1234
,
sizeof
(
struct
shared_use_st
),
0666
|
IPC_CREAT
);
ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID
(
shmid
,
-
1
,
shmid
);
shm
=
shmat
(
shmid
,
(
void
*
)
0
,
0
);
shm
=
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID
(
shm
,
INVALID_PTR
,
shm
);
ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID
(
shm
,
INVALID_PTR
,
shm
);
printf
(
"Memory attached at %p
\n
"
,
shm
);
printf
(
"Memory attached at %p
\n
"
,
shm
);
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_005.cpp
浏览文件 @
6ed09bf1
...
@@ -49,13 +49,13 @@ static int Testcase(VOID)
...
@@ -49,13 +49,13 @@ static int Testcase(VOID)
shm
=
shmat
(
shmid
,
NULL
,
SHM_REMAP
);
shm
=
shmat
(
shmid
,
NULL
,
SHM_REMAP
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
shm
=
shmat
(
shmid
,
(
const
void
*
)
0x100
,
0
);
shm
=
shmat
(
shmid
,
reinterpret_cast
<
const
void
*>
(
0x100
)
,
0
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
shm
=
shmat
(
shmid
,
NULL
,
0
);
shm
=
shmat
(
shmid
,
NULL
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
shm
,
(
void
*
)
-
1
,
shm
);
ICUNIT_ASSERT_NOT_EQUAL
(
shm
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shm
);
ret
=
shmdt
(
(
const
void
*
)
0x100
);
ret
=
shmdt
(
reinterpret_cast
<
const
void
*>
(
0x100
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
shmid
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
shmid
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_006.cpp
浏览文件 @
6ed09bf1
...
@@ -42,14 +42,14 @@ static int Testcase(VOID)
...
@@ -42,14 +42,14 @@ static int Testcase(VOID)
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
shared
=
shmat
(
shmid
,
0
,
0
);
shared
=
shmat
(
shmid
,
0
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
ret
=
shmdt
(
shared
);
ret
=
shmdt
(
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
remap
=
shared
;
remap
=
shared
;
shared
=
shmat
(
shmid
,
remap
,
SHM_REMAP
);
shared
=
shmat
(
shmid
,
remap
,
SHM_REMAP
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
ret
=
shmdt
(
shared
);
ret
=
shmdt
(
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_007.cpp
浏览文件 @
6ed09bf1
...
@@ -47,7 +47,7 @@ static int Testcase(void)
...
@@ -47,7 +47,7 @@ static int Testcase(void)
ret
=
fork
();
ret
=
fork
();
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
usleep
(
100000
);
usleep
(
100000
);
if
((
shared
=
(
char
*
)
shmat
(
shmid
,
0
,
0
))
==
(
void
*
)
-
1
)
{
if
((
shared
=
static_cast
<
char
*>
(
shmat
(
shmid
,
0
,
0
)))
==
reinterpret_cast
<
void
*>
(
-
1
)
)
{
printf
(
"child : error: shmat()
\n
"
);
printf
(
"child : error: shmat()
\n
"
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -72,8 +72,8 @@ static int Testcase(void)
...
@@ -72,8 +72,8 @@ static int Testcase(void)
pid
=
ret
;
pid
=
ret
;
usleep
(
50000
);
usleep
(
50000
);
shared
=
(
char
*
)
shmat
(
shmid
,
0
,
0
);
shared
=
static_cast
<
char
*>
(
shmat
(
shmid
,
0
,
0
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
ret
=
strncpy_s
(
shared
,
memSize
,
testStr
,
sizeof
(
testStr
));
ret
=
strncpy_s
(
shared
,
memSize
,
testStr
,
sizeof
(
testStr
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_008.cpp
浏览文件 @
6ed09bf1
...
@@ -42,11 +42,11 @@ static int Testcase(void)
...
@@ -42,11 +42,11 @@ static int Testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
shared
=
shmat
(
shmid
,
0
,
0
);
shared
=
shmat
(
shmid
,
0
,
0
);
ICUNIT_ASSERT_EQUAL
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_EQUAL
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EACCES
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EACCES
,
errno
);
shared
=
shmat
(
shmid
,
0
,
SHM_RDONLY
);
shared
=
shmat
(
shmid
,
0
,
SHM_RDONLY
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
ret
=
shmdt
(
shared
);
ret
=
shmdt
(
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_009.cpp
浏览文件 @
6ed09bf1
...
@@ -88,14 +88,14 @@ static int Testcase(void)
...
@@ -88,14 +88,14 @@ static int Testcase(void)
int
ret
;
int
ret
;
int
pid
;
int
pid
;
void
*
ptr
=
(
void
*
)
signal
(
SIGTERM
,
ExitChildren
);
void
*
ptr
=
reinterpret_cast
<
void
*>
(
signal
(
SIGTERM
,
ExitChildren
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
ptr
,
NULL
,
ptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
ptr
,
NULL
,
ptr
);
shmid
=
shmget
(
IPC_PRIVATE
,
sizeof
(
int
),
IPC_CREAT
|
0600
);
shmid
=
shmget
(
IPC_PRIVATE
,
sizeof
(
int
),
IPC_CREAT
|
0600
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
0
,
0
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
0
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
(
int
*
)
-
1
,
g_shmptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
reinterpret_cast
<
int
*>
(
-
1
)
,
g_shmptr
);
*
g_shmptr
=
0
;
*
g_shmptr
=
0
;
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_013.cpp
浏览文件 @
6ed09bf1
...
@@ -43,9 +43,9 @@ static int testcase(void)
...
@@ -43,9 +43,9 @@ static int testcase(void)
shmfd
=
shm_open
(
"test_1"
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0644
);
shmfd
=
shm_open
(
"test_1"
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0644
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmfd
,
-
1
,
shmfd
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmfd
,
-
1
,
shmfd
);
writebuf
=
(
char
*
)
malloc
(
pageSize
);
writebuf
=
static_cast
<
char
*>
(
malloc
(
pageSize
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
writebuf
,
NULL
,
writebuf
);
ICUNIT_ASSERT_NOT_EQUAL
(
writebuf
,
NULL
,
writebuf
);
readbuf
=
(
char
*
)
malloc
(
pageSize
);
readbuf
=
static_cast
<
char
*>
(
malloc
(
pageSize
)
);
ICUNIT_GOTO_NOT_EQUAL
(
readbuf
,
NULL
,
readbuf
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
readbuf
,
NULL
,
readbuf
,
EXIT
);
(
void
)
memset_s
(
writebuf
,
pageSize
,
0xf
,
pageSize
);
(
void
)
memset_s
(
writebuf
,
pageSize
,
0xf
,
pageSize
);
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_014.cpp
浏览文件 @
6ed09bf1
...
@@ -49,9 +49,9 @@ static int testcase(void)
...
@@ -49,9 +49,9 @@ static int testcase(void)
shmfd
=
shm_open
(
"test_2"
,
O_RDONLY
|
O_CREAT
,
00664
);
shmfd
=
shm_open
(
"test_2"
,
O_RDONLY
|
O_CREAT
,
00664
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmfd
,
-
1
,
shmfd
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmfd
,
-
1
,
shmfd
);
writebuf
=
(
char
*
)
malloc
(
pageSize
);
writebuf
=
static_cast
<
char
*>
(
malloc
(
pageSize
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
writebuf
,
NULL
,
writebuf
);
ICUNIT_ASSERT_NOT_EQUAL
(
writebuf
,
NULL
,
writebuf
);
readbuf
=
(
char
*
)
malloc
(
pageSize
);
readbuf
=
static_cast
<
char
*>
(
malloc
(
pageSize
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
readbuf
,
NULL
,
readbuf
);
ICUNIT_ASSERT_NOT_EQUAL
(
readbuf
,
NULL
,
readbuf
);
(
void
)
memset_s
(
writebuf
,
pageSize
,
0xf
,
pageSize
);
(
void
)
memset_s
(
writebuf
,
pageSize
,
0xf
,
pageSize
);
...
...
testsuites/unittest/basic/mem/shm/smoke/shm_test_011.cpp
浏览文件 @
6ed09bf1
...
@@ -45,7 +45,7 @@ static int Testcase(void)
...
@@ -45,7 +45,7 @@ static int Testcase(void)
ret
=
fork
();
ret
=
fork
();
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
shared
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
shared
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
if
(
shared
==
(
int
*
)
-
1
)
{
if
(
shared
==
reinterpret_cast
<
int
*>
(
-
1
)
)
{
exit
(
1
);
exit
(
1
);
}
}
*
shared
=
2
;
*
shared
=
2
;
...
@@ -55,7 +55,7 @@ static int Testcase(void)
...
@@ -55,7 +55,7 @@ static int Testcase(void)
}
else
{
}
else
{
usleep
(
20000
);
usleep
(
20000
);
shared
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
shared
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
(
int
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
reinterpret_cast
<
int
*>
(
-
1
)
,
shared
);
ICUNIT_ASSERT_EQUAL
(
*
shared
,
2
,
*
shared
);
ICUNIT_ASSERT_EQUAL
(
*
shared
,
2
,
*
shared
);
...
...
testsuites/unittest/basic/mem/vm/smoke/mmap_test_002.cpp
浏览文件 @
6ed09bf1
...
@@ -71,7 +71,7 @@ static int Testcase(void)
...
@@ -71,7 +71,7 @@ static int Testcase(void)
printf
(
"err: malloc size invalid
\n
"
);
printf
(
"err: malloc size invalid
\n
"
);
return
-
1
;
return
-
1
;
}
}
buf
=
(
char
*
)
malloc
(
pageSize
);
buf
=
static_cast
<
char
*>
(
malloc
(
pageSize
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
buf
,
NULL
,
buf
);
ICUNIT_ASSERT_NOT_EQUAL
(
buf
,
NULL
,
buf
);
(
void
)
memset_s
(
buf
,
pageSize
,
0xf
,
pageSize
);
(
void
)
memset_s
(
buf
,
pageSize
,
0xf
,
pageSize
);
...
...
testsuites/unittest/basic/mem/vm/smoke/mmap_test_006.cpp
浏览文件 @
6ed09bf1
...
@@ -49,7 +49,7 @@ static int Testcase(void)
...
@@ -49,7 +49,7 @@ static int Testcase(void)
fd
=
open
(
file
,
O_CREAT
|
O_RDWR
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
fd
=
open
(
file
,
O_CREAT
|
O_RDWR
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
invalueAddr
=
(
void
*
)
(
VALIDE_ADDR
|
ADDR_OFFSET
);
invalueAddr
=
reinterpret_cast
<
void
*>
(
VALIDE_ADDR
|
ADDR_OFFSET
);
mem
=
mmap
(
invalueAddr
,
len
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
|
MAP_FIXED
,
fd
,
0
);
mem
=
mmap
(
invalueAddr
,
len
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
|
MAP_FIXED
,
fd
,
0
);
ICUNIT_GOTO_EQUAL
(
mem
,
MAP_FAILED
,
mem
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
mem
,
MAP_FAILED
,
mem
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
errno
,
EINVAL
,
errno
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
errno
,
EINVAL
,
errno
,
EXIT
);
...
...
testsuites/unittest/basic/mem/vm/smoke/user_copy_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -40,24 +40,26 @@ static int Testcase(void)
...
@@ -40,24 +40,26 @@ static int Testcase(void)
const
char
*
str
=
"Hi, OHOS."
;
const
char
*
str
=
"Hi, OHOS."
;
/* sigprocmask 内核系统调用接口通过arch_copy_from_user拷贝用户参数 */
/* sigprocmask 内核系统调用接口通过arch_copy_from_user拷贝用户参数 */
ret
=
sigprocmask
(
SIG_BLOCK
,
(
sigset_t
*
)
1
,
&
oldset
);
ret
=
sigprocmask
(
SIG_BLOCK
,
reinterpret_cast
<
sigset_t
*>
(
1
)
,
&
oldset
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ret
=
sigprocmask
(
SIG_BLOCK
,
(
sigset_t
*
)
INVALID_USER_VADDR
,
&
oldset
);
ret
=
sigprocmask
(
SIG_BLOCK
,
reinterpret_cast
<
sigset_t
*>
(
INVALID_USER_VADDR
)
,
&
oldset
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
/* sigprocmask 内核系统调用接口通过arch_copy_to_user将内核参数拷贝至用户 */
/* sigprocmask 内核系统调用接口通过arch_copy_to_user将内核参数拷贝至用户 */
ret
=
sigprocmask
(
SIG_BLOCK
,
(
sigset_t
*
)
INVALID_USER_VADDR
,
(
sigset_t
*
)
1
);
ret
=
sigprocmask
(
SIG_BLOCK
,
reinterpret_cast
<
sigset_t
*>
(
INVALID_USER_VADDR
),
reinterpret_cast
<
sigset_t
*>
(
1
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ret
=
sigprocmask
(
SIG_BLOCK
,
(
sigset_t
*
)
INVALID_USER_VADDR
,
(
sigset_t
*
)
INVALID_USER_VADDR
);
ret
=
sigprocmask
(
SIG_BLOCK
,
reinterpret_cast
<
sigset_t
*>
(
INVALID_USER_VADDR
),
reinterpret_cast
<
sigset_t
*>
(
INVALID_USER_VADDR
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ret
=
sigprocmask
(
SIG_BLOCK
,
(
sigset_t
*
)
INVALID_USER_VADDR
,
(
sigset_t
*
)
str
);
ret
=
sigprocmask
(
SIG_BLOCK
,
reinterpret_cast
<
sigset_t
*>
(
INVALID_USER_VADDR
),
reinterpret_cast
<
sigset_t
*>
(
const_cast
<
char
*>
(
str
)));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
...
...
testsuites/unittest/drivers/hid/smoke/hid_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -53,7 +53,7 @@ static int Testcase(VOID)
...
@@ -53,7 +53,7 @@ static int Testcase(VOID)
fd
=
open
(
MOUSE_DEV_PATH
,
O_RDWR
,
0666
);
fd
=
open
(
MOUSE_DEV_PATH
,
O_RDWR
,
0666
);
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
buf
=
(
char
*
)
malloc
(
MOUSE_DATA_LEN
);
buf
=
static_cast
<
char
*>
(
malloc
(
MOUSE_DATA_LEN
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
buf
,
NULL
,
buf
);
ICUNIT_ASSERT_NOT_EQUAL
(
buf
,
NULL
,
buf
);
ret
=
memset_s
(
buf
,
MOUSE_DATA_LEN
,
0
,
MOUSE_DATA_LEN
);
ret
=
memset_s
(
buf
,
MOUSE_DATA_LEN
,
0
,
MOUSE_DATA_LEN
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
...
testsuites/unittest/drivers/storage/smoke/storage_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -51,7 +51,7 @@ static int Testcase(VOID)
...
@@ -51,7 +51,7 @@ static int Testcase(VOID)
fd
=
open
(
STORAGE_DEV_PATH
,
O_RDWR
,
0666
);
fd
=
open
(
STORAGE_DEV_PATH
,
O_RDWR
,
0666
);
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
buf
=
(
char
*
)
malloc
(
STORAGE_DATA_LEN
);
buf
=
static_cast
<
char
*>
(
malloc
(
STORAGE_DATA_LEN
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
buf
,
NULL
,
buf
);
ICUNIT_ASSERT_NOT_EQUAL
(
buf
,
NULL
,
buf
);
ret
=
memset_s
(
buf
,
STORAGE_DATA_LEN
,
0
,
STORAGE_DATA_LEN
);
ret
=
memset_s
(
buf
,
STORAGE_DATA_LEN
,
0
,
STORAGE_DATA_LEN
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
...
testsuites/unittest/extended/liteipc/smoke/liteipc_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -62,20 +62,20 @@ static int LiteIpcTest(void)
...
@@ -62,20 +62,20 @@ static int LiteIpcTest(void)
/* testing mmap liteipc mem pool with different size and flag */
/* testing mmap liteipc mem pool with different size and flag */
retptr
=
mmap
(
nullptr
,
1024
*
4096
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
retptr
=
mmap
(
nullptr
,
1024
*
4096
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
ICUNIT_ASSERT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
ICUNIT_ASSERT_EQUAL
(
static_cast
<
int
>
(
static_cast
<
intptr_t
>
(
retptr
))
,
-
1
,
retptr
);
//retptr = mmap(nullptr, 0, PROT_READ, MAP_PRIVATE, fd, 0);
//retptr = mmap(nullptr, 0, PROT_READ, MAP_PRIVATE, fd, 0);
//ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr);
//ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr);
retptr
=
mmap
(
nullptr
,
-
1
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
retptr
=
mmap
(
nullptr
,
-
1
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
ICUNIT_ASSERT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
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
);
retptr
=
mmap
(
nullptr
,
4096
,
PROT_READ
|
PROT_WRITE
,
MAP_PRIVATE
,
fd
,
0
);
ICUNIT_ASSERT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
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
);
ICUNIT_ASSERT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
ICUNIT_ASSERT_EQUAL
(
static_cast
<
int
>
(
static_cast
<
intptr_t
>
(
retptr
))
,
-
1
,
retptr
);
retptr
=
mmap
(
nullptr
,
1
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
retptr
=
mmap
(
nullptr
,
1
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
static_cast
<
int
>
(
static_cast
<
intptr_t
>
(
retptr
))
,
-
1
,
retptr
);
retptr
=
mmap
(
nullptr
,
4095
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
retptr
=
mmap
(
nullptr
,
4095
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
ICUNIT_ASSERT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
ICUNIT_ASSERT_EQUAL
(
static_cast
<
int
>
(
static_cast
<
intptr_t
>
(
retptr
))
,
-
1
,
retptr
);
/* testing read/write api */
/* testing read/write api */
char
buf
[
10
]
=
{
0
};
char
buf
[
10
]
=
{
0
};
...
@@ -121,7 +121,7 @@ static int TestCase(void)
...
@@ -121,7 +121,7 @@ static int TestCase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
ICUNIT_ASSERT_NOT_EQUAL
(
fd
,
-
1
,
fd
);
retptr
=
mmap
(
nullptr
,
16
*
4096
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
retptr
=
mmap
(
nullptr
,
16
*
4096
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
static_cast
<
int
>
(
static_cast
<
intptr_t
>
(
retptr
))
,
-
1
,
retptr
);
ret
=
ioctl
(
fd
,
IPC_SET_CMS
,
0
);
ret
=
ioctl
(
fd
,
IPC_SET_CMS
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
ret
);
ret
=
ioctl
(
fd
,
IPC_SET_CMS
,
200
);
ret
=
ioctl
(
fd
,
IPC_SET_CMS
,
200
);
...
...
testsuites/unittest/extended/liteipc/smoke/liteipc_test_002.cpp
浏览文件 @
6ed09bf1
...
@@ -65,7 +65,7 @@ static int CallTestServiceLoop(uint32_t id)
...
@@ -65,7 +65,7 @@ static int CallTestServiceLoop(uint32_t id)
ret
=
GetService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ret
=
GetService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
ret
);
retptr
=
mmap
(
NULL
,
4096
,
PROT_READ
,
MAP_PRIVATE
,
g_ipcFd
,
0
);
retptr
=
mmap
(
NULL
,
4096
,
PROT_READ
,
MAP_PRIVATE
,
g_ipcFd
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
static_cast
<
int
>
(
static_cast
<
intptr_t
>
(
retptr
))
,
-
1
,
retptr
);
ret
=
GetService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ret
=
GetService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
@@ -141,7 +141,7 @@ static int TestServiceLoop(void)
...
@@ -141,7 +141,7 @@ static int TestServiceLoop(void)
ret
=
RegService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ret
=
RegService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
ret
);
retptr
=
mmap
(
NULL
,
4096
,
PROT_READ
,
MAP_PRIVATE
,
g_ipcFd
,
0
);
retptr
=
mmap
(
NULL
,
4096
,
PROT_READ
,
MAP_PRIVATE
,
g_ipcFd
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
(
int
)(
intptr_t
)
retptr
,
-
1
,
retptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
static_cast
<
int
>
(
static_cast
<
intptr_t
>
(
retptr
))
,
-
1
,
retptr
);
ret
=
RegService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ret
=
RegService
(
g_ipcFd
,
g_serviceName
,
sizeof
(
g_serviceName
),
&
serviceHandle
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
...
testsuites/unittest/extended/signal/full/It_ipc_pipe_002.cpp
浏览文件 @
6ed09bf1
...
@@ -40,7 +40,7 @@ static UINT32 Testcase(VOID)
...
@@ -40,7 +40,7 @@ static UINT32 Testcase(VOID)
ret
=
pipe
(
pipeFd
);
ret
=
pipe
(
pipeFd
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT1
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT1
);
shmid
=
shmget
(
(
key_t
)
IPC_PRIVATE
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
shmid
=
shmget
(
static_cast
<
key_t
>
(
IPC_PRIVATE
)
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
*
sharedflag
=
0
;
*
sharedflag
=
0
;
...
...
testsuites/unittest/extended/signal/full/It_ipc_pipe_003.cpp
浏览文件 @
6ed09bf1
...
@@ -42,7 +42,7 @@ static UINT32 Testcase(VOID)
...
@@ -42,7 +42,7 @@ static UINT32 Testcase(VOID)
ret
=
pipe
(
pipeFd
);
ret
=
pipe
(
pipeFd
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT1
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT1
);
shmid
=
shmget
(
(
key_t
)
IPC_PRIVATE
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
shmid
=
shmget
(
static_cast
<
key_t
>
(
IPC_PRIVATE
)
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
*
sharedflag
=
0
;
*
sharedflag
=
0
;
...
...
testsuites/unittest/extended/signal/full/pipe_test_005.cpp
浏览文件 @
6ed09bf1
...
@@ -56,7 +56,7 @@ static int PipecommonWrite()
...
@@ -56,7 +56,7 @@ static int PipecommonWrite()
printf
(
"signal error
\n
"
);
printf
(
"signal error
\n
"
);
}
}
shmid
=
shmget
(
(
key_t
)
IPC_PRIVATE
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
shmid
=
shmget
(
static_cast
<
key_t
>
(
IPC_PRIVATE
)
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
*
sharedflag
=
0
;
*
sharedflag
=
0
;
...
...
testsuites/unittest/extended/signal/full/signal_test_026.cpp
浏览文件 @
6ed09bf1
...
@@ -80,7 +80,7 @@ static UINT32 TestCase(VOID)
...
@@ -80,7 +80,7 @@ static UINT32 TestCase(VOID)
sigaddset
(
&
newset
,
SIGCHLD
);
sigaddset
(
&
newset
,
SIGCHLD
);
timeout
.
tv_nsec
=
1
;
timeout
.
tv_nsec
=
1
;
timeout
.
tv_sec
=
3
;
// 3, set the sec of timeout.
timeout
.
tv_sec
=
3
;
// 3, set the sec of timeout.
ret
=
sigtimedwait
(
&
newset
,
(
siginfo_t
*
)
2
,
&
timeout
);
// 2, wait for signal num
ret
=
sigtimedwait
(
&
newset
,
reinterpret_cast
<
siginfo_t
*>
(
2
)
,
&
timeout
);
// 2, wait for signal num
printf
(
"ret = %d errno = %d EFAULT = %d
\n
"
,
ret
,
errno
,
EFAULT
);
printf
(
"ret = %d errno = %d EFAULT = %d
\n
"
,
ret
,
errno
,
EFAULT
);
if
(
ret
!=
-
1
)
{
if
(
ret
!=
-
1
)
{
exit
(
ret
);
exit
(
ret
);
...
...
testsuites/unittest/extended/signal/full/signal_test_029.cpp
浏览文件 @
6ed09bf1
...
@@ -73,7 +73,7 @@ static UINT32 TestCase(VOID)
...
@@ -73,7 +73,7 @@ static UINT32 TestCase(VOID)
exit
(
errno
);
exit
(
errno
);
}
}
ret
=
sigsuspend
(
(
sigset_t
*
)
2
);
// 2, suspend signal num.
ret
=
sigsuspend
(
reinterpret_cast
<
sigset_t
*>
(
2
)
);
// 2, suspend signal num.
if
(
ret
!=
-
1
)
{
if
(
ret
!=
-
1
)
{
exit
(
ret
);
exit
(
ret
);
}
}
...
@@ -89,7 +89,7 @@ static UINT32 TestCase(VOID)
...
@@ -89,7 +89,7 @@ static UINT32 TestCase(VOID)
exit
(
errno
);
exit
(
errno
);
}
}
ret
=
sigpending
(
(
sigset_t
*
)
2
);
// 2, pending signal num.
ret
=
sigpending
(
reinterpret_cast
<
sigset_t
*>
(
2
)
);
// 2, pending signal num.
if
(
ret
!=
-
1
)
{
if
(
ret
!=
-
1
)
{
exit
(
ret
);
exit
(
ret
);
}
}
...
...
testsuites/unittest/extended/signal/smoke/pipe_test_002.cpp
浏览文件 @
6ed09bf1
...
@@ -51,7 +51,7 @@ static int TestPipeMultiProcess()
...
@@ -51,7 +51,7 @@ static int TestPipeMultiProcess()
int
flag
=
fcntl
(
*
readFd
,
F_GETFL
);
int
flag
=
fcntl
(
*
readFd
,
F_GETFL
);
fcntl
(
*
readFd
,
F_SETFL
,
flag
|
O_NONBLOCK
);
fcntl
(
*
readFd
,
F_SETFL
,
flag
|
O_NONBLOCK
);
shmid
=
shmget
(
(
key_t
)
IPC_PRIVATE
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
shmid
=
shmget
(
static_cast
<
key_t
>
(
IPC_PRIVATE
)
,
sizeof
(
int
),
0666
|
IPC_CREAT
);
// 0666 the authority of the shm
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
sharedflag
=
(
int
*
)
shmat
(
shmid
,
NULL
,
0
);
*
sharedflag
=
0
;
*
sharedflag
=
0
;
...
...
testsuites/unittest/extended/signal/smoke/signal_test_002.cpp
浏览文件 @
6ed09bf1
...
@@ -47,7 +47,7 @@ static int TestRaiseIgnore(void)
...
@@ -47,7 +47,7 @@ static int TestRaiseIgnore(void)
g_sigCount
=
0
;
g_sigCount
=
0
;
// trigger one
// trigger one
ret
=
(
void
*
)
signal
(
sig
,
SigPrint
);
ret
=
reinterpret_cast
<
void
*>
(
signal
(
sig
,
SigPrint
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
NULL
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
NULL
,
ret
);
retValue
=
raise
(
sig
);
retValue
=
raise
(
sig
);
...
@@ -55,13 +55,13 @@ static int TestRaiseIgnore(void)
...
@@ -55,13 +55,13 @@ static int TestRaiseIgnore(void)
usleep
(
1000
);
// 1000, Used to calculate the delay time.
usleep
(
1000
);
// 1000, Used to calculate the delay time.
// trigger ignore
// trigger ignore
ret
=
(
void
*
)
signal
(
sig
,
SIG_IGN
);
ret
=
reinterpret_cast
<
void
*>
(
signal
(
sig
,
SIG_IGN
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
NULL
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
NULL
,
ret
);
retValue
=
raise
(
sig
);
retValue
=
raise
(
sig
);
ICUNIT_ASSERT_EQUAL
(
retValue
,
0
,
retValue
);
ICUNIT_ASSERT_EQUAL
(
retValue
,
0
,
retValue
);
// trigger one
// trigger one
ret
=
(
void
*
)
signal
(
sig
,
SigPrint
);
ret
=
reinterpret_cast
<
void
*>
(
signal
(
sig
,
SigPrint
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
NULL
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
NULL
,
ret
);
retValue
=
raise
(
sig
);
retValue
=
raise
(
sig
);
ICUNIT_ASSERT_EQUAL
(
retValue
,
0
,
retValue
);
ICUNIT_ASSERT_EQUAL
(
retValue
,
0
,
retValue
);
...
...
testsuites/unittest/extended/signal/smoke/signal_test_013.cpp
浏览文件 @
6ed09bf1
...
@@ -63,8 +63,8 @@ static void *ThreadSetFunc2(void *arg)
...
@@ -63,8 +63,8 @@ static void *ThreadSetFunc2(void *arg)
pthread_exit
((
void
*
)
NULL
);
pthread_exit
((
void
*
)
NULL
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
-
1
);
pthread_exit
(
reinterpret_cast
<
void
*>
(
-
1
)
);
return
(
void
*
)
-
1
;
return
reinterpret_cast
<
void
*>
(
-
1
)
;
}
}
static
void
*
ThreadSetDfl
(
void
*
arg
)
static
void
*
ThreadSetDfl
(
void
*
arg
)
...
@@ -76,8 +76,8 @@ static void *ThreadSetDfl(void *arg)
...
@@ -76,8 +76,8 @@ static void *ThreadSetDfl(void *arg)
pthread_exit
((
void
*
)
NULL
);
pthread_exit
((
void
*
)
NULL
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
-
1
);
pthread_exit
(
reinterpret_cast
<
void
*>
(
-
1
)
);
return
(
void
*
)
-
1
;
return
reinterpret_cast
<
void
*>
(
-
1
)
;
}
}
static
void
*
ThreadKill
(
void
*
arg
)
static
void
*
ThreadKill
(
void
*
arg
)
...
@@ -90,8 +90,8 @@ static void *ThreadKill(void *arg)
...
@@ -90,8 +90,8 @@ static void *ThreadKill(void *arg)
pthread_exit
((
void
*
)
NULL
);
pthread_exit
((
void
*
)
NULL
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
-
1
);
pthread_exit
(
reinterpret_cast
<
void
*>
(
-
1
)
);
return
(
void
*
)
-
1
;
return
reinterpret_cast
<
void
*>
(
-
1
)
;
}
}
static
int
TestSigMultiPthread
(
void
)
static
int
TestSigMultiPthread
(
void
)
...
@@ -119,15 +119,15 @@ static int TestSigMultiPthread(void)
...
@@ -119,15 +119,15 @@ static int TestSigMultiPthread(void)
exit
(
ret
);
exit
(
ret
);
}
}
pthread_join
(
thread
,
(
void
**
)
&
status1
);
pthread_join
(
thread
,
reinterpret_cast
<
void
**>
(
&
status1
)
);
if
((
int
)(
intptr_t
)
status1
!=
0
)
{
if
((
int
)(
intptr_t
)
status1
!=
0
)
{
exit
(
-
1
);
exit
(
-
1
);
}
}
pthread_join
(
thread1
,
(
void
**
)
&
status1
);
pthread_join
(
thread1
,
reinterpret_cast
<
void
**>
(
&
status1
)
);
if
((
int
)(
intptr_t
)
status1
!=
0
)
{
if
((
int
)(
intptr_t
)
status1
!=
0
)
{
exit
(
-
1
);
exit
(
-
1
);
}
}
pthread_join
(
thread2
,
(
void
**
)
&
status1
);
pthread_join
(
thread2
,
reinterpret_cast
<
void
**>
(
&
status1
)
);
if
((
int
)(
intptr_t
)
status1
!=
0
)
{
if
((
int
)(
intptr_t
)
status1
!=
0
)
{
exit
(
-
1
);
exit
(
-
1
);
}
}
...
...
testsuites/unittest/extended/signal/smoke/signal_test_037.cpp
浏览文件 @
6ed09bf1
...
@@ -49,7 +49,7 @@ static UINT32 TestCase(VOID)
...
@@ -49,7 +49,7 @@ static UINT32 TestCase(VOID)
ICUNIT_ASSERT_EQUAL
(
retval
,
-
1
,
retval
);
ICUNIT_ASSERT_EQUAL
(
retval
,
-
1
,
retval
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EINVAL
,
errno
);
printf
(
"----------------------------------
\n
"
);
printf
(
"----------------------------------
\n
"
);
retval
=
sigprocmask
(
SIG_BLOCK
,
(
sigset_t
*
)
1
,
&
oldset
);
retval
=
sigprocmask
(
SIG_BLOCK
,
reinterpret_cast
<
sigset_t
*>
(
1
)
,
&
oldset
);
ICUNIT_ASSERT_EQUAL
(
retval
,
-
1
,
retval
);
ICUNIT_ASSERT_EQUAL
(
retval
,
-
1
,
retval
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EFAULT
,
errno
);
printf
(
"----------------------------------
\n
"
);
printf
(
"----------------------------------
\n
"
);
...
...
testsuites/unittest/extended/trace/smoke/trace_test_004.cpp
浏览文件 @
6ed09bf1
...
@@ -43,7 +43,7 @@ static UINT32 TestCase(VOID)
...
@@ -43,7 +43,7 @@ static UINT32 TestCase(VOID)
ioctl
(
fd
,
TRACE_STOP
,
NULL
);
ioctl
(
fd
,
TRACE_STOP
,
NULL
);
buffer
=
(
char
*
)
malloc
(
size
);
buffer
=
(
char
*
)
malloc
(
size
);
if
(
buffer
==
NULL
)
{
if
(
buffer
==
NULL
)
{
printf
(
"Read buffer malloc failed!
\n
"
);
printf
(
"Read buffer malloc failed!
\n
"
);
goto
EXIT
;
goto
EXIT
;
...
...
testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp
浏览文件 @
6ed09bf1
...
@@ -118,7 +118,7 @@ static UINT32 testcase(VOID)
...
@@ -118,7 +118,7 @@ static UINT32 testcase(VOID)
locale_t
newloc
=
nullptr
;
locale_t
newloc
=
nullptr
;
char
*
pathList
[]
=
{
"/storage/zh_CN.UTF-8"
};
char
*
pathList
[]
=
{
"/storage/zh_CN.UTF-8"
};
char
*
streamList
[]
=
{
(
char
*
)
fileWords
};
char
*
streamList
[]
=
{
reinterpret_cast
<
char
*>
(
fileWords
)
};
int
streamLen
[]
=
{
sizeof
(
fileWords
)
-
2
};
int
streamLen
[]
=
{
sizeof
(
fileWords
)
-
2
};
newloc
=
duplocale
(
oldloc
);
newloc
=
duplocale
(
oldloc
);
...
...
testsuites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp
浏览文件 @
6ed09bf1
...
@@ -41,8 +41,8 @@ static UINT32 testcase(VOID) {
...
@@ -41,8 +41,8 @@ static UINT32 testcase(VOID) {
setlocale
(
LC_NUMERIC
,
""
);
setlocale
(
LC_NUMERIC
,
""
);
/* echo the nl_langinfo_l */
/* echo the nl_langinfo_l */
printf
(
"%s
\n
"
,
nl_langinfo_l
(
CODESET
,
(
locale_t
)
"en_US.UTF-8"
));
printf
(
"%s
\n
"
,
nl_langinfo_l
(
CODESET
,
reinterpret_cast
<
locale_t
>
(
const_cast
<
char
*>
(
"en_US.UTF-8"
))
));
printf
(
"%s
\n
"
,
nl_langinfo_l
(
RADIXCHAR
,
(
locale_t
)
"en_US.UTF-8"
));
printf
(
"%s
\n
"
,
nl_langinfo_l
(
RADIXCHAR
,
reinterpret_cast
<
locale_t
>
(
const_cast
<
char
*>
(
"en_US.UTF-8"
))
));
/* set the locale info */
/* set the locale info */
setenv
(
"MUSL_LOCPATH"
,
"/storage"
,
1
);
setenv
(
"MUSL_LOCPATH"
,
"/storage"
,
1
);
...
@@ -53,10 +53,10 @@ static UINT32 testcase(VOID) {
...
@@ -53,10 +53,10 @@ static UINT32 testcase(VOID) {
setlocale
(
LC_NUMERIC
,
""
);
setlocale
(
LC_NUMERIC
,
""
);
/* echo the nl_langinfo */
/* echo the nl_langinfo */
printf
(
"%s
\n
"
,
nl_langinfo_l
(
CODESET
,
(
locale_t
)
"zh_CN.UTF-8"
));
printf
(
"%s
\n
"
,
nl_langinfo_l
(
CODESET
,
reinterpret_cast
<
locale_t
>
(
const_cast
<
char
*>
(
"zh_CN.UTF-8"
))
));
printf
(
"%s
\n
"
,
nl_langinfo_l
(
RADIXCHAR
,
(
locale_t
)
"zh_CN.UTF-8"
));
printf
(
"%s
\n
"
,
nl_langinfo_l
(
RADIXCHAR
,
reinterpret_cast
<
locale_t
>
(
const_cast
<
char
*>
(
"zh_CN.UTF-8"
))
));
char
*
string
=
nl_langinfo_l
(
CRNCYSTR
,
(
locale_t
)
"zh_CN.UTF-8"
);
char
*
string
=
nl_langinfo_l
(
CRNCYSTR
,
reinterpret_cast
<
locale_t
>
(
const_cast
<
char
*>
(
"zh_CN.UTF-8"
))
);
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
string
,
NULL
,
string
);
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
string
,
NULL
,
string
);
setlocale
(
LC_ALL
,
"C"
);
setlocale
(
LC_ALL
,
"C"
);
...
...
testsuites/unittest/libc/io/full/It_stdio_hasmntopt_001.cpp
浏览文件 @
6ed09bf1
...
@@ -44,7 +44,7 @@ static UINT32 testcase(VOID)
...
@@ -44,7 +44,7 @@ static UINT32 testcase(VOID)
char
fileWords
[]
=
"/dev/disk/by-uuid/c4992556-a86e-45e8-ba5f-190b16a9073x /usr1 ext3 errors=remount-ro,nofail 0 1"
;
char
fileWords
[]
=
"/dev/disk/by-uuid/c4992556-a86e-45e8-ba5f-190b16a9073x /usr1 ext3 errors=remount-ro,nofail 0 1"
;
char
*
pathList
[]
=
{
"/etc/fstab"
};
char
*
pathList
[]
=
{
"/etc/fstab"
};
char
*
streamList
[]
=
{
(
char
*
)
fileWords
};
char
*
streamList
[]
=
{
static_cast
<
char
*>
(
fileWords
)
};
int
streamLen
[]
=
{
sizeof
(
fileWords
)};
int
streamLen
[]
=
{
sizeof
(
fileWords
)};
int
flag
=
PrepareFileEnv
(
pathList
,
streamList
,
streamLen
,
1
);
int
flag
=
PrepareFileEnv
(
pathList
,
streamList
,
streamLen
,
1
);
...
...
testsuites/unittest/libc/misc/full/misc_test_006.cpp
浏览文件 @
6ed09bf1
...
@@ -31,9 +31,9 @@
...
@@ -31,9 +31,9 @@
#include "It_test_misc.h"
#include "It_test_misc.h"
#include "sys/utsname.h"
#include "sys/utsname.h"
#define INVALID_ADDR_FIRST_PAGE (
(struct utsname *)0x1200000
)
#define INVALID_ADDR_FIRST_PAGE (
reinterpret_cast<struct utsname *>(0x1200000)
)
#define INVALID_ADDR_USER_ADDR (
(struct utsname *)0x1000000
)
#define INVALID_ADDR_USER_ADDR (
reinterpret_cast<struct utsname *>(0x1000000)
)
#define INVALID_ADDR_KERNEL_READONLY_ADDR (
(struct utsname *)0x4016c75c
)
#define INVALID_ADDR_KERNEL_READONLY_ADDR (
reinterpret_cast<struct utsname *>(0x4016c75c)
)
static
UINT32
TestCase
(
VOID
)
static
UINT32
TestCase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_145.cpp
浏览文件 @
6ed09bf1
...
@@ -43,11 +43,11 @@ static VOID *PthreadF01(VOID *mq)
...
@@ -43,11 +43,11 @@ static VOID *PthreadF01(VOID *mq)
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
g_testCount
=
0
;
g_testCount
=
0
;
return
NULL
;
return
NULL
;
}
}
...
@@ -64,11 +64,11 @@ static VOID *PthreadF02(VOID *mq)
...
@@ -64,11 +64,11 @@ static VOID *PthreadF02(VOID *mq)
}
}
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
g_testCount
=
0
;
g_testCount
=
0
;
return
NULL
;
return
NULL
;
}
}
...
@@ -85,11 +85,11 @@ static VOID *PthreadF03(VOID *mq)
...
@@ -85,11 +85,11 @@ static VOID *PthreadF03(VOID *mq)
}
}
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
g_testCount
=
0
;
g_testCount
=
0
;
return
NULL
;
return
NULL
;
}
}
...
@@ -107,11 +107,11 @@ static VOID *PthreadF04(VOID *mq)
...
@@ -107,11 +107,11 @@ static VOID *PthreadF04(VOID *mq)
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
g_testCount
=
0
;
g_testCount
=
0
;
return
NULL
;
return
NULL
;
}
}
...
...
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_146.cpp
浏览文件 @
6ed09bf1
...
@@ -50,11 +50,11 @@ static VOID *PthreadF01(VOID *info)
...
@@ -50,11 +50,11 @@ static VOID *PthreadF01(VOID *info)
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
g_testCount
=
0
;
g_testCount
=
0
;
return
NULL
;
return
NULL
;
}
}
...
@@ -74,11 +74,11 @@ static VOID *PthreadF02(VOID *info)
...
@@ -74,11 +74,11 @@ static VOID *PthreadF02(VOID *info)
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
g_testCount
=
0
;
g_testCount
=
0
;
return
NULL
;
return
NULL
;
}
}
...
...
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_162.cpp
浏览文件 @
6ed09bf1
...
@@ -41,11 +41,11 @@ static VOID *PthreadF01(VOID *arg)
...
@@ -41,11 +41,11 @@ static VOID *PthreadF01(VOID *arg)
}
}
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
g_testCount
=
0
;
g_testCount
=
0
;
return
NULL
;
return
NULL
;
}
}
...
@@ -63,12 +63,12 @@ static VOID *PthreadF02(VOID *arg)
...
@@ -63,12 +63,12 @@ static VOID *PthreadF02(VOID *arg)
LOS_AtomicInc
(
&
g_testCount
);
LOS_AtomicInc
(
&
g_testCount
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
EXIT:
EXIT:
g_testCount
=
0
;
g_testCount
=
0
;
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
}
}
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_010.cpp
浏览文件 @
6ed09bf1
...
@@ -34,9 +34,9 @@ static VOID *pthread_f01(void *argument)
...
@@ -34,9 +34,9 @@ static VOID *pthread_f01(void *argument)
{
{
g_testCount
=
pthread_self
();
g_testCount
=
pthread_self
();
pthread_exit
(
(
void
*
)
8
);
pthread_exit
(
static_cast
<
void
*>
(
8
));
// 8: exit value for testing
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_023.cpp
浏览文件 @
6ed09bf1
...
@@ -42,12 +42,13 @@ static VOID *pthread_f01(void *argument)
...
@@ -42,12 +42,13 @@ static VOID *pthread_f01(void *argument)
{
{
g_testCount
++
;
g_testCount
++
;
pthread_cleanup_push
(
PthreadCleanF01
,
(
void
*
)
8
);
pthread_cleanup_push
(
PthreadCleanF01
,
static_cast
<
void
*>
(
8
));
// 8:arg that routine is called with
if
(
argument
)
if
(
argument
)
{
return
(
void
*
)
8
;
return
static_cast
<
void
*>
(
8
);
// 8: return value for testing if argument is not NULL
}
pthread_cleanup_pop
(
0
);
pthread_cleanup_pop
(
0
);
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_025.cpp
浏览文件 @
6ed09bf1
...
@@ -42,11 +42,11 @@ static VOID *pthread_f01(void *argument)
...
@@ -42,11 +42,11 @@ static VOID *pthread_f01(void *argument)
{
{
g_testCount
++
;
g_testCount
++
;
pthread_cleanup_push
(
PthreadCleanF01
,
(
void
*
)
8
);
pthread_cleanup_push
(
PthreadCleanF01
,
static_cast
<
void
*>
(
8
));
// 8: arg that routine is called with
pthread_exit
(
(
void
*
)
8
);
pthread_exit
(
static_cast
<
void
*>
(
8
));
// 8: exit value for testing
pthread_cleanup_pop
(
1
);
pthread_cleanup_pop
(
1
);
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_026.cpp
浏览文件 @
6ed09bf1
...
@@ -43,11 +43,11 @@ static VOID *pthread_f01(void *argument)
...
@@ -43,11 +43,11 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
LosTaskDelay
(
5
);
LosTaskDelay
(
5
);
pthread_cleanup_push
(
PthreadCleanF01
,
(
void
*
)
8
);
pthread_cleanup_push
(
PthreadCleanF01
,
static_cast
<
void
*>
(
8
));
// 8: arg that routine is called with
pthread_testcancel
();
pthread_testcancel
();
pthread_cleanup_pop
(
1
);
pthread_cleanup_pop
(
1
);
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_027.cpp
浏览文件 @
6ed09bf1
...
@@ -46,13 +46,13 @@ static VOID *pthread_f01(void *argument)
...
@@ -46,13 +46,13 @@ static VOID *pthread_f01(void *argument)
{
{
g_testCount
++
;
g_testCount
++
;
pthread_cleanup_push
(
PthreadCleanF01
,
(
void
*
)
9
);
pthread_cleanup_push
(
PthreadCleanF01
,
static_cast
<
void
*>
(
9
));
// 9: arg that routine is called with
pthread_cleanup_push
(
PthreadCleanF01
,
(
void
*
)
8
);
pthread_cleanup_push
(
PthreadCleanF01
,
static_cast
<
void
*>
(
8
));
// 8: arg that routine is called with
pthread_exit
(
(
void
*
)
8
);
pthread_exit
(
static_cast
<
void
*>
(
8
));
// 8: exit value for testing
pthread_cleanup_pop
(
1
);
pthread_cleanup_pop
(
1
);
pthread_cleanup_pop
(
1
);
pthread_cleanup_pop
(
1
);
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_028.cpp
浏览文件 @
6ed09bf1
...
@@ -34,7 +34,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -34,7 +34,7 @@ static VOID *pthread_f01(void *argument)
{
{
g_testCount
++
;
g_testCount
++
;
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_029.cpp
浏览文件 @
6ed09bf1
...
@@ -34,8 +34,8 @@ static VOID *pthread_f01(void *argument)
...
@@ -34,8 +34,8 @@ static VOID *pthread_f01(void *argument)
{
{
g_testCount
++
;
g_testCount
++
;
pthread_exit
(
(
void
*
)
8
);
pthread_exit
(
static_cast
<
void
*>
(
8
));
// 8: exit value for testing
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_030.cpp
浏览文件 @
6ed09bf1
...
@@ -37,7 +37,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -37,7 +37,7 @@ static VOID *pthread_f01(void *argument)
pthread_testcancel
();
pthread_testcancel
();
g_testCount
++
;
g_testCount
++
;
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_031.cpp
浏览文件 @
6ed09bf1
...
@@ -39,7 +39,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -39,7 +39,7 @@ static VOID *pthread_f01(void *argument)
ret
=
pthread_join
(
g_newTh
,
NULL
);
ret
=
pthread_join
(
g_newTh
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_034.cpp
浏览文件 @
6ed09bf1
...
@@ -43,7 +43,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -43,7 +43,7 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f02
(
void
*
argument
)
static
VOID
*
pthread_f02
(
void
*
argument
)
...
@@ -59,7 +59,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -59,7 +59,7 @@ static VOID *pthread_f02(void *argument)
g_testCount
++
;
g_testCount
++
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
8
;
return
static_cast
<
void
*>
(
8
);
// 8: return value for testing
}
}
static
VOID
*
PthreadF03
(
void
*
argument
)
static
VOID
*
PthreadF03
(
void
*
argument
)
...
@@ -76,7 +76,7 @@ static VOID *PthreadF03(void *argument)
...
@@ -76,7 +76,7 @@ static VOID *PthreadF03(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
7
;
return
static_cast
<
void
*>
(
7
);
// 7: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_035.cpp
浏览文件 @
6ed09bf1
...
@@ -47,7 +47,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -47,7 +47,7 @@ static VOID *pthread_f01(void *argument)
g_testCnt1
++
;
g_testCnt1
++
;
ICUNIT_GOTO_EQUAL
(
g_testCnt1
,
4
,
g_testCnt1
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCnt1
,
4
,
g_testCnt1
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
reinterpret_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f02
(
void
*
argument
)
static
VOID
*
pthread_f02
(
void
*
argument
)
...
@@ -67,7 +67,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -67,7 +67,7 @@ static VOID *pthread_f02(void *argument)
g_testCnt1
++
;
g_testCnt1
++
;
ICUNIT_GOTO_EQUAL
(
g_testCnt1
,
5
,
g_testCnt1
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCnt1
,
5
,
g_testCnt1
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
8
;
return
reinterpret_cast
<
void
*>
(
8
);
// 8:return value for testing
}
}
static
VOID
*
PthreadF03
(
void
*
argument
)
static
VOID
*
PthreadF03
(
void
*
argument
)
...
@@ -88,7 +88,7 @@ static VOID *PthreadF03(void *argument)
...
@@ -88,7 +88,7 @@ static VOID *PthreadF03(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCnt1
,
6
,
g_testCnt1
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCnt1
,
6
,
g_testCnt1
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
7
;
return
reinterpret_cast
<
void
*>
(
7
);
// 7: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
@@ -108,8 +108,9 @@ static UINT32 Testcase(VOID)
...
@@ -108,8 +108,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh3
,
NULL
,
PthreadF03
,
NULL
);
ret
=
pthread_create
(
&
newTh3
,
NULL
,
PthreadF03
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
while
(
g_testCnt1
<
6
)
while
(
g_testCnt1
<
6
)
{
// 6: threshold for calling sleep
sleep
(
1
);
sleep
(
1
);
}
ICUNIT_ASSERT_EQUAL
(
g_testCnt1
,
6
,
g_testCnt1
);
ICUNIT_ASSERT_EQUAL
(
g_testCnt1
,
6
,
g_testCnt1
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_039.cpp
浏览文件 @
6ed09bf1
...
@@ -36,7 +36,7 @@ static VOID *PthreadF01(void *argument)
...
@@ -36,7 +36,7 @@ static VOID *PthreadF01(void *argument)
LosTaskDelay
(
2
);
LosTaskDelay
(
2
);
pthread_testcancel
();
pthread_testcancel
();
g_testCount
++
;
g_testCount
++
;
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_040.cpp
浏览文件 @
6ed09bf1
...
@@ -36,7 +36,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -36,7 +36,7 @@ static VOID *pthread_f01(void *argument)
LosTaskDelay
(
2
);
LosTaskDelay
(
2
);
g_testCount
++
;
g_testCount
++
;
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_042.cpp
浏览文件 @
6ed09bf1
...
@@ -36,7 +36,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -36,7 +36,7 @@ static VOID *pthread_f01(void *argument)
LosTaskDelay
(
2
);
LosTaskDelay
(
2
);
g_testCount
++
;
g_testCount
++
;
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_044.cpp
浏览文件 @
6ed09bf1
...
@@ -47,7 +47,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -47,7 +47,7 @@ static VOID *pthread_f02(void *argument)
ICUNIT_GOTO_EQUAL
(
param
.
sched_priority
,
3
,
param
.
sched_priority
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
param
.
sched_priority
,
3
,
param
.
sched_priority
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f01
(
void
*
argument
)
static
VOID
*
pthread_f01
(
void
*
argument
)
...
@@ -89,7 +89,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -89,7 +89,7 @@ static VOID *pthread_f01(void *argument)
ret
=
pthread_attr_destroy
(
&
attr
);
ret
=
pthread_attr_destroy
(
&
attr
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_045.cpp
浏览文件 @
6ed09bf1
...
@@ -39,7 +39,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -39,7 +39,7 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_046.cpp
浏览文件 @
6ed09bf1
...
@@ -37,7 +37,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -37,7 +37,7 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_051.cpp
浏览文件 @
6ed09bf1
...
@@ -49,7 +49,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -49,7 +49,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
// not reachable
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
// not reachable
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_052.cpp
浏览文件 @
6ed09bf1
...
@@ -53,7 +53,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -53,7 +53,7 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f02
(
void
*
argument
)
static
VOID
*
pthread_f02
(
void
*
argument
)
...
@@ -79,7 +79,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -79,7 +79,7 @@ static VOID *pthread_f02(void *argument)
g_testCount
++
;
g_testCount
++
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
6
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
6
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
8
;
return
static_cast
<
void
*>
(
8
);
// 8: return value for testing
}
}
static
VOID
*
PthreadF03
(
void
*
argument
)
static
VOID
*
PthreadF03
(
void
*
argument
)
...
@@ -107,7 +107,7 @@ static VOID *PthreadF03(void *argument)
...
@@ -107,7 +107,7 @@ static VOID *PthreadF03(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
8
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
8
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
7
;
return
static_cast
<
void
*>
(
7
);
// 7: return value for testing
}
}
static
void
PthreadKeyF01
(
void
*
threadLog
)
static
void
PthreadKeyF01
(
void
*
threadLog
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_053.cpp
浏览文件 @
6ed09bf1
...
@@ -71,7 +71,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -71,7 +71,7 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f02
(
void
*
argument
)
static
VOID
*
pthread_f02
(
void
*
argument
)
...
@@ -115,7 +115,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -115,7 +115,7 @@ static VOID *pthread_f02(void *argument)
g_testCount
++
;
g_testCount
++
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
7
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
7
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
8
;
return
static_cast
<
void
*>
(
8
);
// 8: return value for testing
}
}
static
void
PthreadKeyF01
(
void
*
threadLog
)
static
void
PthreadKeyF01
(
void
*
threadLog
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_054.cpp
浏览文件 @
6ed09bf1
...
@@ -49,9 +49,9 @@ static VOID *pthread_f01(void *argument)
...
@@ -49,9 +49,9 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
pthread_exit
(
(
void
*
)
7
);
pthread_exit
(
static_cast
<
void
*>
(
7
));
// 7: exit value for testing
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
void
PthreadKeyF01
(
void
*
threadLog
)
static
void
PthreadKeyF01
(
void
*
threadLog
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_055.cpp
浏览文件 @
6ed09bf1
...
@@ -51,7 +51,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -51,7 +51,7 @@ static VOID *pthread_f01(void *argument)
pthread_testcancel
();
pthread_testcancel
();
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
void
PthreadKeyF01
(
void
*
threadLog
)
static
void
PthreadKeyF01
(
void
*
threadLog
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_059.cpp
浏览文件 @
6ed09bf1
...
@@ -41,7 +41,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -41,7 +41,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
// failed, =2
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
// failed, =2
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_060.cpp
浏览文件 @
6ed09bf1
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
static
VOID
*
pthread_f02
(
void
*
argument
)
static
VOID
*
pthread_f02
(
void
*
argument
)
{
{
g_testCount
++
;
g_testCount
++
;
return
(
void
*
)
8
;
return
static_cast
<
void
*>
(
8
);
// 8: return value for testing
}
}
static
VOID
*
pthread_f01
(
void
*
argument
)
static
VOID
*
pthread_f01
(
void
*
argument
)
{
{
...
@@ -54,7 +54,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -54,7 +54,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_061.cpp
浏览文件 @
6ed09bf1
...
@@ -50,7 +50,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -50,7 +50,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_062.cpp
浏览文件 @
6ed09bf1
...
@@ -45,7 +45,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -45,7 +45,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_063.cpp
浏览文件 @
6ed09bf1
...
@@ -51,7 +51,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -51,7 +51,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
0
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
0
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_064.cpp
浏览文件 @
6ed09bf1
...
@@ -52,7 +52,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -52,7 +52,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
reinterpret_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_066.cpp
浏览文件 @
6ed09bf1
...
@@ -44,7 +44,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -44,7 +44,7 @@ static VOID *pthread_f02(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f01
(
void
*
argument
)
static
VOID
*
pthread_f01
(
void
*
argument
)
...
@@ -86,7 +86,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -86,7 +86,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT
);
#endif
#endif
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_080.cpp
浏览文件 @
6ed09bf1
...
@@ -69,8 +69,9 @@ static UINT32 Testcase(VOID)
...
@@ -69,8 +69,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_081.cpp
浏览文件 @
6ed09bf1
...
@@ -74,8 +74,9 @@ static UINT32 Testcase(VOID)
...
@@ -74,8 +74,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
* blocked on pthread_cond_wait
* blocked on pthread_cond_wait
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_082.cpp
浏览文件 @
6ed09bf1
...
@@ -81,8 +81,9 @@ static UINT32 Testcase(VOID)
...
@@ -81,8 +81,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_083.cpp
浏览文件 @
6ed09bf1
...
@@ -70,8 +70,9 @@ static UINT32 Testcase(VOID)
...
@@ -70,8 +70,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_084.cpp
浏览文件 @
6ed09bf1
...
@@ -73,8 +73,9 @@ static UINT32 Testcase(VOID)
...
@@ -73,8 +73,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
while
(
g_startNum
<
THREAD_NUM
)
while
(
g_startNum
<
THREAD_NUM
)
{
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
/*
/*
* Acquire the mutex to make sure that all waiters are currently
* Acquire the mutex to make sure that all waiters are currently
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_085.cpp
浏览文件 @
6ed09bf1
...
@@ -68,8 +68,9 @@ static UINT32 Testcase(VOID)
...
@@ -68,8 +68,9 @@ static UINT32 Testcase(VOID)
rc
=
pthread_create
(
&
thread1
,
NULL
,
pthread_f01
,
NULL
);
rc
=
pthread_create
(
&
thread1
,
NULL
,
pthread_f01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
while
(
!
g_t1Start
)
/* wait for thread1 started */
while
(
!
g_t1Start
)
{
/* wait for thread1 started */
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
/* acquire the mutex released by pthread_cond_wait() within thread 1 */
/* acquire the mutex released by pthread_cond_wait() within thread 1 */
rc
=
pthread_mutex_lock
(
&
g_td
.
mutex
);
rc
=
pthread_mutex_lock
(
&
g_td
.
mutex
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_087.cpp
浏览文件 @
6ed09bf1
...
@@ -57,7 +57,7 @@ static void *pthread_f01(void *arg)
...
@@ -57,7 +57,7 @@ static void *pthread_f01(void *arg)
rc
=
pthread_mutex_unlock
(
&
g_td
.
mutex
);
rc
=
pthread_mutex_unlock
(
&
g_td
.
mutex
);
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
EXIT:
EXIT:
pthread_exit
(
(
void
*
)
5
);
pthread_exit
(
static_cast
<
void
*>
(
5
));
// 5: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
@@ -78,9 +78,9 @@ static UINT32 Testcase(VOID)
...
@@ -78,9 +78,9 @@ static UINT32 Testcase(VOID)
rc
=
pthread_create
(
&
thread1
,
NULL
,
pthread_f01
,
NULL
);
rc
=
pthread_create
(
&
thread1
,
NULL
,
pthread_f01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
while
(
!
g_t1Start
)
/* wait for thread1 started */
while
(
!
g_t1Start
)
{
/* wait for thread1 started */
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
/* acquire the mutex released by pthread_cond_wait() within thread 1 */
/* acquire the mutex released by pthread_cond_wait() within thread 1 */
rc
=
pthread_mutex_lock
(
&
g_td
.
mutex
);
rc
=
pthread_mutex_lock
(
&
g_td
.
mutex
);
...
@@ -92,7 +92,7 @@ static UINT32 Testcase(VOID)
...
@@ -92,7 +92,7 @@ static UINT32 Testcase(VOID)
g_signaled
=
1
;
g_signaled
=
1
;
rc
=
pthread_join
(
thread1
,
&
thRet
);
rc
=
pthread_join
(
thread1
,
&
thRet
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
(
long
)
thRet
,
5
,
(
long
)
thRet
);
ICUNIT_ASSERT_EQUAL
(
static_cast
<
long
>
(
thRet
),
5
,
static_cast
<
long
>
(
thRet
));
// 5: return value for testing
g_signaled
=
0
;
g_signaled
=
0
;
rc
=
pthread_cond_destroy
(
&
g_td
.
cond
);
rc
=
pthread_cond_destroy
(
&
g_td
.
cond
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_088.cpp
浏览文件 @
6ed09bf1
...
@@ -108,8 +108,9 @@ static void *pthread_f02(void *tmp)
...
@@ -108,8 +108,9 @@ static void *pthread_f02(void *tmp)
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
while
(
1
)
{
while
(
1
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
{
break
;
break
;
}
}
}
g_lowDone
=
1
;
g_lowDone
=
1
;
EXIT:
EXIT:
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_089.cpp
浏览文件 @
6ed09bf1
...
@@ -111,8 +111,9 @@ static void *pthread_f02(void *tmp)
...
@@ -111,8 +111,9 @@ static void *pthread_f02(void *tmp)
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
startTime
);
while
(
1
)
{
while
(
1
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
clock_gettime
(
CLOCK_REALTIME
,
&
currentTime
);
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
if
(
PthreadTimeF01
(
currentTime
,
startTime
)
>
RUNTIME
)
{
break
;
break
;
}
}
}
g_lowDone
=
1
;
g_lowDone
=
1
;
EXIT:
EXIT:
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_090.cpp
浏览文件 @
6ed09bf1
...
@@ -40,8 +40,9 @@ static void *pthread_f01(void *arg)
...
@@ -40,8 +40,9 @@ static void *pthread_f01(void *arg)
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
g_startNum
++
;
g_startNum
++
;
if
(
g_startNum
>
5
)
if
(
g_startNum
>
5
)
{
// 5: threshold for calling usleep
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
printf
(
"pthread start_num: %d
\n
"
,
g_startNum
);
printf
(
"pthread start_num: %d
\n
"
,
g_startNum
);
rc
=
pthread_cond_wait
(
&
g_td
.
cond
,
&
g_td
.
mutex
);
rc
=
pthread_cond_wait
(
&
g_td
.
cond
,
&
g_td
.
mutex
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_091.cpp
浏览文件 @
6ed09bf1
...
@@ -48,7 +48,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -48,7 +48,7 @@ static VOID *pthread_f01(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
EXIT:
EXIT:
return
(
void
*
)
9
;
return
reinterpret_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f02
(
void
*
argument
)
static
VOID
*
pthread_f02
(
void
*
argument
)
...
@@ -72,7 +72,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -72,7 +72,7 @@ static VOID *pthread_f02(void *argument)
printf
(
"11
\n
"
);
printf
(
"11
\n
"
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
// failed , =3
ICUNIT_GOTO_EQUAL
(
g_testCount
,
2
,
g_testCount
,
EXIT
);
// failed , =3
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
{
{
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_092.cpp
浏览文件 @
6ed09bf1
...
@@ -42,8 +42,9 @@ static void *pthread_f01(void *arg)
...
@@ -42,8 +42,9 @@ static void *pthread_f01(void *arg)
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
g_startNum
++
;
g_startNum
++
;
if
(
g_startNum
>
5
)
if
(
g_startNum
>
5
)
{
// 5: threshold for calling usleep
usleep
(
1000
*
10
*
2
);
usleep
(
1000
*
10
*
2
);
}
printf
(
"pthread start_num: %d
\n
"
,
g_startNum
);
printf
(
"pthread start_num: %d
\n
"
,
g_startNum
);
rc
=
pthread_cond_wait
(
&
g_td
.
cond
,
&
g_td
.
mutex
);
rc
=
pthread_cond_wait
(
&
g_td
.
cond
,
&
g_td
.
mutex
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_094.cpp
浏览文件 @
6ed09bf1
...
@@ -45,7 +45,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -45,7 +45,7 @@ static VOID *pthread_f02(void *argument)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
g_testCount
++
;
g_testCount
++
;
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f01
(
void
*
argument
)
static
VOID
*
pthread_f01
(
void
*
argument
)
...
@@ -75,7 +75,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -75,7 +75,7 @@ static VOID *pthread_f01(void *argument)
g_testCount
++
;
g_testCount
++
;
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_095.cpp
浏览文件 @
6ed09bf1
...
@@ -50,7 +50,7 @@ static VOID *pthread_f02(void *argument)
...
@@ -50,7 +50,7 @@ static VOID *pthread_f02(void *argument)
g_testCnt1
++
;
g_testCnt1
++
;
EXIT:
EXIT:
return
(
void
*
)
9
;
return
reinterpret_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
VOID
*
pthread_f01
(
void
*
argument
)
static
VOID
*
pthread_f01
(
void
*
argument
)
...
@@ -83,7 +83,7 @@ static VOID *pthread_f01(void *argument)
...
@@ -83,7 +83,7 @@ static VOID *pthread_f01(void *argument)
g_testCnt1
++
;
g_testCnt1
++
;
EXIT:
EXIT:
return
(
void
*
)
9
;
return
static_cast
<
void
*>
(
9
);
// 9: return value for testing
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_107.cpp
浏览文件 @
6ed09bf1
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
static
VOID
*
pthread_f01
(
void
*
t
)
static
VOID
*
pthread_f01
(
void
*
t
)
{
{
long
myId
=
(
long
)
t
;
long
myId
=
static_cast
<
long
>
(
t
)
;
int
rc
;
int
rc
;
rc
=
pthread_mutex_lock
(
&
g_pthreadMutexTest1
);
rc
=
pthread_mutex_lock
(
&
g_pthreadMutexTest1
);
...
@@ -58,7 +58,7 @@ EXIT:
...
@@ -58,7 +58,7 @@ EXIT:
static
VOID
*
pthread_f02
(
void
*
t
)
static
VOID
*
pthread_f02
(
void
*
t
)
{
{
int
i
;
int
i
;
long
myId
=
(
long
)
t
;
long
myId
=
static_cast
<
long
>
(
t
)
;
int
rc
;
int
rc
;
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT
);
...
@@ -74,7 +74,7 @@ static VOID *pthread_f02(void *t)
...
@@ -74,7 +74,7 @@ static VOID *pthread_f02(void *t)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT
);
g_testCount
++
;
g_testCount
++
;
rc
=
pthread_mutex_unlock
(
&
g_pthreadMutexTest1
);
/* 为
线程轮询互斥锁增加延
时 */
rc
=
pthread_mutex_unlock
(
&
g_pthreadMutexTest1
);
/* Ϊ
�߳���ѯ������������ʱ */
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
rc
,
0
,
rc
,
EXIT
);
LosTaskDelay
(
2
);
LosTaskDelay
(
2
);
...
@@ -87,11 +87,11 @@ static UINT32 Testcase(VOID)
...
@@ -87,11 +87,11 @@ static UINT32 Testcase(VOID)
long
t1
=
1
,
t2
=
2
,
t3
=
3
;
long
t1
=
1
,
t2
=
2
,
t3
=
3
;
int
rc
;
int
rc
;
pthread_t
threads
[
3
];
pthread_t
threads
[
3
];
pthread_attr_t
attr
;
/*
初始化互斥量和条件变量对象
*/
pthread_attr_t
attr
;
/*
��ʼ���������������������� */
g_testCount
=
0
;
g_testCount
=
0
;
pthread_mutex_init
(
&
g_pthreadMutexTest1
,
NULL
);
pthread_mutex_init
(
&
g_pthreadMutexTest1
,
NULL
);
pthread_cond_init
(
&
g_pthreadCondTest1
,
NULL
);
/*
创建线程时设为可连接状态,便于移
植 */
pthread_cond_init
(
&
g_pthreadCondTest1
,
NULL
);
/*
�����߳�ʱ��Ϊ������״̬��������ֲ */
pthread_attr_init
(
&
attr
);
pthread_attr_init
(
&
attr
);
rc
=
pthread_create
(
&
threads
[
0
],
&
attr
,
pthread_f01
,
(
void
*
)
t1
);
rc
=
pthread_create
(
&
threads
[
0
],
&
attr
,
pthread_f01
,
(
void
*
)
t1
);
...
@@ -101,13 +101,13 @@ static UINT32 Testcase(VOID)
...
@@ -101,13 +101,13 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
/*
等待所有线程完成
*/
/*
�ȴ������߳���� */
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
rc
=
pthread_join
(
threads
[
i
],
NULL
);
rc
=
pthread_join
(
threads
[
i
],
NULL
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
}
}
/*
清除并退出
*/
/*
������˳� */
rc
=
pthread_attr_destroy
(
&
attr
);
rc
=
pthread_attr_destroy
(
&
attr
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
ICUNIT_ASSERT_EQUAL
(
rc
,
0
,
rc
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_138.cpp
浏览文件 @
6ed09bf1
...
@@ -51,8 +51,9 @@ static UINT32 Testcase(VOID)
...
@@ -51,8 +51,9 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
/* Make sure the thread was created before we join it. */
/* Make sure the thread was created before we join it. */
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_join
(
newTh
,
&
valuePtr
);
ret
=
pthread_join
(
newTh
,
&
valuePtr
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_233.cpp
浏览文件 @
6ed09bf1
...
@@ -52,8 +52,9 @@ static VOID *pthread_f01(VOID *tmp)
...
@@ -52,8 +52,9 @@ static VOID *pthread_f01(VOID *tmp)
g_pthreadSem
=
1
;
g_pthreadSem
=
1
;
while
(
1
)
while
(
1
)
{
sleep
(
5
);
sleep
(
5
);
}
return
NULL
;
return
NULL
;
}
}
...
@@ -69,8 +70,9 @@ static UINT32 Testcase(VOID)
...
@@ -69,8 +70,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
0
)
while
(
g_pthreadSem
==
0
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_238.cpp
浏览文件 @
6ed09bf1
...
@@ -44,8 +44,9 @@ static VOID *pthread_f01(VOID *argument)
...
@@ -44,8 +44,9 @@ static VOID *pthread_f01(VOID *argument)
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
pthread_testcancel
();
pthread_testcancel
();
...
@@ -66,8 +67,9 @@ static UINT32 Testcase(VOID)
...
@@ -66,8 +67,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_239.cpp
浏览文件 @
6ed09bf1
...
@@ -41,8 +41,9 @@ static VOID *pthread_f01(VOID *argument)
...
@@ -41,8 +41,9 @@ static VOID *pthread_f01(VOID *argument)
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
pthread_testcancel
();
pthread_testcancel
();
...
@@ -62,8 +63,9 @@ static UINT32 Testcase(VOID)
...
@@ -62,8 +63,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_240.cpp
浏览文件 @
6ed09bf1
...
@@ -41,8 +41,9 @@ static VOID *pthread_f01(VOID *argument)
...
@@ -41,8 +41,9 @@ static VOID *pthread_f01(VOID *argument)
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
g_pthreadSem
=
PTHREAD_INMAIN_TEST
;
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INMAIN_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
pthread_testcancel
();
pthread_testcancel
();
...
@@ -63,8 +64,9 @@ static UINT32 Testcase(VOID)
...
@@ -63,8 +64,9 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ret
=
pthread_create
(
&
newTh
,
NULL
,
pthread_f01
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
while
(
g_pthreadSem
==
PTHREAD_INTHREAD_TEST
)
{
sleep
(
1
);
sleep
(
1
);
}
ret
=
pthread_cancel
(
newTh
);
ret
=
pthread_cancel
(
newTh
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
PTHREAD_NO_ERROR
,
ret
);
...
...
testsuites/unittest/libc/posix/pthread/posix_pthread_test.cpp
浏览文件 @
6ed09bf1
...
@@ -62,24 +62,24 @@ sem_t g_pthreadSem1;
...
@@ -62,24 +62,24 @@ sem_t g_pthreadSem1;
sem_t
g_pthreadSem2
;
sem_t
g_pthreadSem2
;
__scenario
g_scenarii
[]
=
{
__scenario
g_scenarii
[]
=
{
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
(
char
*
)
"default"
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
const_cast
<
char
*>
(
"default"
)
),
CASE_POS
(
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
(
char
*
)
"detached"
),
CASE_POS
(
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
const_cast
<
char
*>
(
"detached"
)
),
CASE_POS
(
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
(
char
*
)
"Explicit sched"
),
CASE_POS
(
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
const_cast
<
char
*>
(
"Explicit sched"
)
),
CASE_UNK
(
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
(
char
*
)
"FIFO Policy"
),
CASE_UNK
(
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
const_cast
<
char
*>
(
"FIFO Policy"
)
),
CASE_UNK
(
0
,
0
,
2
,
0
,
0
,
0
,
0
,
0
,
(
char
*
)
"RR Policy"
),
CASE_UNK
(
0
,
0
,
2
,
0
,
0
,
0
,
0
,
0
,
const_cast
<
char
*>
(
"RR Policy"
)
),
CASE_UNK
(
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
(
char
*
)
"Max sched param"
),
CASE_UNK
(
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
const_cast
<
char
*>
(
"Max sched param"
)
),
CASE_UNK
(
0
,
0
,
0
,
-
1
,
0
,
0
,
0
,
0
,
(
char
*
)
"Min sched param"
),
CASE_UNK
(
0
,
0
,
0
,
-
1
,
0
,
0
,
0
,
0
,
const_cast
<
char
>
(
"Min sched param"
)
),
CASE_POS
(
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
(
char
*
)
"Alternative contension scope"
),
CASE_POS
(
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
const_cast
<
char
*>
(
"Alternative contension scope"
)
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
(
char
*
)
"Alternative stack"
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
const_cast
<
char
*>
(
"Alternative stack"
)
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
(
char
*
)
"No guard size"
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
const_cast
<
char
*>
(
"No guard size"
)
),
CASE_UNK
(
0
,
0
,
0
,
0
,
0
,
0
,
2
,
0
,
(
char
*
)
"1p guard size"
),
CASE_UNK
(
0
,
0
,
0
,
0
,
0
,
0
,
2
,
0
,
const_cast
<
char
*>
(
"1p guard size"
)
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
(
char
*
)
"Min stack size"
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
const_cast
<
char
*>
(
"Min stack size"
)
),
/* Stack play */
/* Stack play */
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
(
char
*
)
"Min stack size, no guard"
),
CASE_POS
(
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
const_cast
<
char
*>
(
"Min stack size, no guard"
)
),
CASE_UNK
(
0
,
0
,
0
,
0
,
0
,
0
,
2
,
1
,
(
char
*
)
"Min stack size, 1p guard"
),
CASE_UNK
(
0
,
0
,
0
,
0
,
0
,
0
,
2
,
1
,
const_cast
<
char
*>
(
"Min stack size, 1p guard"
)
),
CASE_POS
(
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
(
char
*
)
"Detached, Alternative stack"
),
CASE_POS
(
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
const_cast
<
char
*>
(
"Detached, Alternative stack"
)
),
CASE_POS
(
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
(
char
*
)
"Detached, Min stack size, no guard"
),
CASE_POS
(
1
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
const_cast
<
char
*>
(
"Detached, Min stack size, no guard"
)
),
CASE_UNK
(
1
,
0
,
0
,
0
,
0
,
0
,
2
,
1
,
(
char
*
)
"Detached, Min stack size, 1p guard"
),
CASE_UNK
(
1
,
0
,
0
,
0
,
0
,
0
,
2
,
1
,
const_cast
<
char
*>
(
"Detached, Min stack size, 1p guard"
)
),
};
};
pthread_t
g_pthreadTestTh
;
pthread_t
g_pthreadTestTh
;
...
...
testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_004.cpp
浏览文件 @
6ed09bf1
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
static
void
*
ThreadF01
(
void
*
arg
)
static
void
*
ThreadF01
(
void
*
arg
)
{
{
pthread_exit
(
(
void
*
)
2
);
pthread_exit
(
static_cast
<
void
*>
(
2
));
// 2: return value for testing
return
NULL
;
return
NULL
;
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_005.cpp
浏览文件 @
6ed09bf1
...
@@ -38,7 +38,7 @@ static void *ThreadF01(void *arg)
...
@@ -38,7 +38,7 @@ static void *ThreadF01(void *arg)
* function did not succeed. */
* function did not succeed. */
// uart_printf_func("Could not send cancel request correctly\n");
// uart_printf_func("Could not send cancel request correctly\n");
// ICUNIT_TRACK_EQUAL(1, 0, errno);
// ICUNIT_TRACK_EQUAL(1, 0, errno);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
}
}
static
UINT32
Testcase
(
VOID
)
static
UINT32
Testcase
(
VOID
)
...
...
testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_006.cpp
浏览文件 @
6ed09bf1
...
@@ -37,7 +37,7 @@ static void *ThreadF01(void *arg)
...
@@ -37,7 +37,7 @@ static void *ThreadF01(void *arg)
// while (1)
// while (1)
sleep
(
1
);
sleep
(
1
);
pthread_exit
(
(
void
*
)
0
);
pthread_exit
(
nullptr
);
return
NULL
;
return
NULL
;
}
}
...
...
testsuites/unittest/libc/sys/smoke/sys_test_008.cpp
浏览文件 @
6ed09bf1
...
@@ -39,9 +39,9 @@ static UINT32 TestCase(VOID)
...
@@ -39,9 +39,9 @@ static UINT32 TestCase(VOID)
int
cflags
;
int
cflags
;
regex_t
reg
;
regex_t
reg
;
char
*
a
=
NULL
;
char
*
a
=
NULL
;
char
*
b
=
(
char
*
)
"No error"
;
char
*
b
=
const_cast
<
char
*>
(
"No error"
)
;
char
*
testStr
=
(
char
*
)
"Hello World"
;
char
*
testStr
=
const_cast
<
char
*>
(
"Hello World"
)
;
char
*
regStr
=
(
char
*
)
"H.*"
;
char
*
regStr
=
const_cast
<
char
*>
(
"H.*"
)
;
cflags
=
REG_EXTENDED
|
REG_ICASE
|
REG_NOSUB
;
cflags
=
REG_EXTENDED
|
REG_ICASE
|
REG_NOSUB
;
...
...
testsuites/unittest/libc/sys/smoke/sys_test_009.cpp
浏览文件 @
6ed09bf1
...
@@ -33,8 +33,8 @@
...
@@ -33,8 +33,8 @@
static
UINT32
TestCase
(
VOID
)
static
UINT32
TestCase
(
VOID
)
{
{
char
*
val
=
NULL
;
char
*
val
=
NULL
;
const
char
*
name
=
(
char
*
)
"ABC"
;
const
char
*
name
=
"ABC"
;
char
*
env
=
(
char
*
)
"test-test"
;
char
*
env
=
const_cast
<
char
*>
(
"test-test"
)
;
int
ret
;
int
ret
;
val
=
getenv
(
name
);
val
=
getenv
(
name
);
...
...
testsuites/unittest/libc/sys/smoke/sys_test_010.cpp
浏览文件 @
6ed09bf1
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
static
UINT32
TestCase
(
VOID
)
static
UINT32
TestCase
(
VOID
)
{
{
char
*
plocale
=
NULL
;
char
*
plocale
=
NULL
;
char
*
buffer
=
(
char
*
)
"C"
;
char
*
buffer
=
const_cast
<
char
*>
(
"C"
)
;
int
ret
;
int
ret
;
plocale
=
setlocale
(
LC_ALL
,
NULL
);
plocale
=
setlocale
(
LC_ALL
,
NULL
);
...
...
testsuites/unittest/libc/sys/smoke/sys_test_012.cpp
浏览文件 @
6ed09bf1
...
@@ -34,8 +34,8 @@ static UINT32 TestCase(VOID)
...
@@ -34,8 +34,8 @@ static UINT32 TestCase(VOID)
{
{
char
*
val
=
NULL
;
char
*
val
=
NULL
;
char
*
val2
=
NULL
;
char
*
val2
=
NULL
;
const
char
*
name
=
(
char
*
)
"ABC"
;
const
char
*
name
=
"ABC"
;
char
*
env
=
(
char
*
)
"test-test"
;
char
*
env
=
"test-test"
;
int
ret
;
int
ret
;
val
=
getenv
(
name
);
val
=
getenv
(
name
);
...
...
testsuites/unittest/libc/sys/smoke/sys_test_013.cpp
浏览文件 @
6ed09bf1
...
@@ -38,7 +38,7 @@ struct q {
...
@@ -38,7 +38,7 @@ struct q {
static
struct
q
*
New
(
int
i
)
static
struct
q
*
New
(
int
i
)
{
{
struct
q
*
q
=
(
struct
q
*
)
malloc
(
sizeof
*
q
);
struct
q
*
q
=
static_cast
<
struct
q
*>
(
malloc
(
sizeof
*
q
)
);
if
(
q
!=
NULL
)
{
if
(
q
!=
NULL
)
{
q
->
i
=
i
;
q
->
i
=
i
;
}
}
...
...
testsuites/unittest/libc/sys/smoke/sys_test_016.cpp
浏览文件 @
6ed09bf1
...
@@ -35,7 +35,7 @@ static UINT32 TestCase(VOID)
...
@@ -35,7 +35,7 @@ static UINT32 TestCase(VOID)
char
*
ptr
=
NULL
;
char
*
ptr
=
NULL
;
int
ret
;
int
ret
;
ptr
=
basename
(
(
char
*
)
"."
);
ptr
=
basename
(
const_cast
<
char
*>
(
"."
)
);
ret
=
strcmp
(
ptr
,
"."
);
ret
=
strcmp
(
ptr
,
"."
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
...
...
testsuites/unittest/libc/time/clock/full/clock_test_010.cpp
浏览文件 @
6ed09bf1
...
@@ -51,8 +51,8 @@ static int SleepTest(int64_t expectTime)
...
@@ -51,8 +51,8 @@ static int SleepTest(int64_t expectTime)
ret
=
clock_gettime
(
clk
,
&
oldtp
);
ret
=
clock_gettime
(
clk
,
&
oldtp
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
tp
.
tv_sec
=
expectTime
/
(
long
)
1e9
;
tp
.
tv_sec
=
expectTime
/
static_cast
<
long
>
(
1e9
)
;
tp
.
tv_nsec
=
expectTime
%
(
long
)
1e9
;
tp
.
tv_nsec
=
expectTime
%
static_cast
<
long
>
(
1e9
)
;
ret
=
clock_nanosleep
(
clk
,
0
,
&
tp
,
nullptr
);
ret
=
clock_nanosleep
(
clk
,
0
,
&
tp
,
nullptr
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
@@ -60,7 +60,7 @@ static int SleepTest(int64_t expectTime)
...
@@ -60,7 +60,7 @@ static int SleepTest(int64_t expectTime)
ret
=
clock_gettime
(
clk
,
&
tp
);
ret
=
clock_gettime
(
clk
,
&
tp
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
escapeTime
=
(
tp
.
tv_sec
-
oldtp
.
tv_sec
)
*
(
int64_t
)
1e9
+
(
tp
.
tv_nsec
-
oldtp
.
tv_nsec
);
escapeTime
=
(
tp
.
tv_sec
-
oldtp
.
tv_sec
)
*
static_cast
<
int64_t
>
(
1e9
)
+
(
tp
.
tv_nsec
-
oldtp
.
tv_nsec
);
LogPrintln
(
"slept time (expected --> actual): %"
PRId64
"ns --> %"
PRId64
"ns, delta: %"
PRId64
"ns
\n
"
,
expectTime
,
LogPrintln
(
"slept time (expected --> actual): %"
PRId64
"ns --> %"
PRId64
"ns, delta: %"
PRId64
"ns
\n
"
,
expectTime
,
escapeTime
,
escapeTime
-
expectTime
);
escapeTime
,
escapeTime
-
expectTime
);
...
...
testsuites/unittest/libc/time/timer/smoke/timer_test_003.cpp
浏览文件 @
6ed09bf1
...
@@ -94,8 +94,9 @@ static int SetTimerTest(void)
...
@@ -94,8 +94,9 @@ static int SetTimerTest(void)
ret
=
clock_gettime
(
CLOCKID
,
&
end
);
ret
=
clock_gettime
(
CLOCKID
,
&
end
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
expected
=
its
.
it_value
.
tv_sec
*
(
int64_t
)
1e9
+
its
.
it_value
.
tv_nsec
;
expected
=
its
.
it_value
.
tv_sec
*
static_cast
<
int64_t
>
(
1e9
)
+
its
.
it_value
.
tv_nsec
;
escaped
=
end
.
tv_sec
*
(
int64_t
)
1e9
+
end
.
tv_nsec
-
start
.
tv_sec
*
(
int64_t
)
1e9
-
start
.
tv_nsec
;
escaped
=
end
.
tv_sec
*
static_cast
<
int64_t
>
(
1e9
)
+
end
.
tv_nsec
-
start
.
tv_sec
*
static_cast
<
int64_t
>
(
1e9
)
-
start
.
tv_nsec
;
failed
+=
(
escaped
<
expected
||
(
escaped
-
expected
)
>=
20000000
);
// 20000000, 2 ticks.
failed
+=
(
escaped
<
expected
||
(
escaped
-
expected
)
>=
20000000
);
// 20000000, 2 ticks.
}
}
...
...
testsuites/unittest/libc/time/timer/smoke/timer_test_004.cpp
浏览文件 @
6ed09bf1
...
@@ -52,7 +52,7 @@ static void SigHandler(int sig, siginfo_t *si, void *uc)
...
@@ -52,7 +52,7 @@ static void SigHandler(int sig, siginfo_t *si, void *uc)
#ifdef TEST_ON_LINUX
#ifdef TEST_ON_LINUX
timer_t
timerid
=
*
(
timer_t
*
)
si
->
si_value
.
sival_ptr
;
timer_t
timerid
=
*
(
timer_t
*
)
si
->
si_value
.
sival_ptr
;
#else // SA_SIGINFO not compatible with POSIX on HMOS
#else // SA_SIGINFO not compatible with POSIX on HMOS
timer_t
timerid
=
*
(
timer_t
*
)
si
;
timer_t
timerid
=
*
reinterpret_cast
<
timer_t
*>
(
si
)
;
#endif
#endif
g_tmrOverrun
+=
timer_getoverrun
(
timerid
);
g_tmrOverrun
+=
timer_getoverrun
(
timerid
);
...
...
testsuites/unittest/libc/time/timer/smoke/timer_test_005.cpp
浏览文件 @
6ed09bf1
...
@@ -69,7 +69,7 @@ static int TimerTest(void)
...
@@ -69,7 +69,7 @@ static int TimerTest(void)
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
sev
.
sigev_notify
=
SIGEV_THREAD
;
sev
.
sigev_notify
=
SIGEV_THREAD
;
sev
.
sigev_notify_function
=
TempSigHandler
;
sev
.
sigev_notify_function
=
TempSigHandler
;
sev
.
sigev_value
.
sival_ptr
=
(
void
*
)
TempSigHandler01
;
sev
.
sigev_value
.
sival_ptr
=
reinterpret_cast
<
void
*>
(
TempSigHandler01
)
;
/* Start the timer */
/* Start the timer */
its
.
it_value
.
tv_sec
=
3
;
// 3, timer time 3 seconds.
its
.
it_value
.
tv_sec
=
3
;
// 3, timer time 3 seconds.
...
@@ -89,7 +89,7 @@ static int TimerTest(void)
...
@@ -89,7 +89,7 @@ static int TimerTest(void)
its
.
it_interval
.
tv_sec
=
its
.
it_value
.
tv_sec
;
its
.
it_interval
.
tv_sec
=
its
.
it_value
.
tv_sec
;
its
.
it_interval
.
tv_nsec
=
its
.
it_value
.
tv_nsec
;
its
.
it_interval
.
tv_nsec
=
its
.
it_value
.
tv_nsec
;
sev
.
sigev_value
.
sival_ptr
=
(
void
*
)
TempSigHandler02
;
sev
.
sigev_value
.
sival_ptr
=
reinterpret_cast
<
void
*>
(
TempSigHandler02
)
;
ret
=
timer_create
(
CLOCK_REALTIME
,
&
sev
,
&
timerid02
);
ret
=
timer_create
(
CLOCK_REALTIME
,
&
sev
,
&
timerid02
);
LogPrintln
(
"timer_settime %p: %d"
,
timerid02
,
ret
);
LogPrintln
(
"timer_settime %p: %d"
,
timerid02
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
...
testsuites/unittest/libc/time/timer/smoke/timer_test_tzset_002.cpp
浏览文件 @
6ed09bf1
...
@@ -42,7 +42,7 @@ static UINT32 testcase(VOID)
...
@@ -42,7 +42,7 @@ static UINT32 testcase(VOID)
int
ret
=
0
;
int
ret
=
0
;
errno
=
0
;
errno
=
0
;
ret
=
putenv
(
(
char
*
)
"TZ=GMT-100"
);
ret
=
putenv
(
const_cast
<
char
*>
(
"TZ=GMT-100"
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
tzset
();
tzset
();
...
...
testsuites/unittest/libc/util/smoke/util_test_007.cpp
浏览文件 @
6ed09bf1
...
@@ -49,10 +49,10 @@ static void *Xmalloc(unsigned n)
...
@@ -49,10 +49,10 @@ static void *Xmalloc(unsigned n)
static
int
Compare
(
const
void
*
pa
,
const
void
*
pb
)
static
int
Compare
(
const
void
*
pa
,
const
void
*
pb
)
{
{
if
(
*
(
int
*
)
pa
<
*
(
int
*
)
pb
)
{
if
(
*
static_cast
<
int
*>
(
const_cast
<
void
*>
(
pa
))
<
*
static_cast
<
int
*>
(
const_cast
<
void
*>
(
pb
))
)
{
return
-
1
;
return
-
1
;
}
}
if
(
*
(
int
*
)
pa
>
*
(
int
*
)
pb
)
{
if
(
*
static_cast
<
int
*>
(
const_cast
<
void
*>
(
pa
))
>
*
static_cast
<
int
*>
(
const_cast
<
void
*>
(
pb
))
)
{
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -66,12 +66,14 @@ static void Action(const void *nodep, VISIT which, int depth)
...
@@ -66,12 +66,14 @@ static void Action(const void *nodep, VISIT which, int depth)
case
preorder
:
case
preorder
:
break
;
break
;
case
postorder
:
case
postorder
:
datap
=
*
(
int
**
)
nodep
;
datap
=
*
static_cast
<
int
**>
(
const_cast
<
void
*>
(
nodep
))
;
break
;
break
;
case
endorder
:
case
endorder
:
break
;
break
;
case
leaf
:
case
leaf
:
datap
=
*
(
int
**
)
nodep
;
datap
=
*
static_cast
<
int
**>
(
const_cast
<
void
*>
(
nodep
));
break
;
default:
break
;
break
;
}
}
}
}
...
@@ -86,7 +88,7 @@ static UINT32 TestCase(VOID)
...
@@ -86,7 +88,7 @@ static UINT32 TestCase(VOID)
for
(
i
=
0
;
i
<
12
;
i
++
)
{
for
(
i
=
0
;
i
<
12
;
i
++
)
{
ptr
=
(
int
*
)
Xmalloc
(
sizeof
(
int
));
ptr
=
(
int
*
)
Xmalloc
(
sizeof
(
int
));
*
ptr
=
rand
()
&
0xff
;
*
ptr
=
rand
()
&
0xff
;
val
=
tsearch
(
(
void
*
)
ptr
,
&
g_root
,
Compare
);
val
=
tsearch
(
static_cast
<
void
*>
(
ptr
)
,
&
g_root
,
Compare
);
if
(
val
==
NULL
)
{
if
(
val
==
NULL
)
{
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
else
if
((
*
(
int
**
)
val
)
!=
ptr
)
{
}
else
if
((
*
(
int
**
)
val
)
!=
ptr
)
{
...
...
testsuites/unittest/net/resolv/smoke/net_resolv_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -47,32 +47,32 @@ static int DnCompTest(void)
...
@@ -47,32 +47,32 @@ static int DnCompTest(void)
unsigned
char
**
lastdnptr
=
&
dnptrs
[
6
];
unsigned
char
**
lastdnptr
=
&
dnptrs
[
6
];
int
offset
,
ret
;
int
offset
,
ret
;
offset
=
strlen
(
(
const
char
*
)
dnptrs
[
0
]
)
+
1
;
offset
=
strlen
(
reinterpret_cast
<
const
char
*>
(
dnptrs
[
0
])
)
+
1
;
ret
=
dn_comp
(
"x.y.z.example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
ret
=
dn_comp
(
"x.y.z.example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
dump
(
comp_dn
+
offset
,
ret
);
dump
(
comp_dn
+
offset
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
19
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
19
,
ret
);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
1
],
comp_dn
+
offset
,
dnptrs
[
1
]);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
1
],
comp_dn
+
offset
,
dnptrs
[
1
]);
offset
+=
ret
+
1
;
offset
+=
ret
+
1
;
ret
=
dn_comp
(
"zz.example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
ret
=
dn_comp
(
"zz.example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
dump
(
comp_dn
+
offset
,
ret
);
dump
(
comp_dn
+
offset
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
5
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
5
,
ret
);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
2
],
comp_dn
+
offset
,
dnptrs
[
2
]);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
2
],
comp_dn
+
offset
,
dnptrs
[
2
]);
offset
+=
ret
+
1
;
offset
+=
ret
+
1
;
ret
=
dn_comp
(
"a.example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
ret
=
dn_comp
(
"a.example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
dump
(
comp_dn
+
offset
,
ret
);
dump
(
comp_dn
+
offset
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
4
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
4
,
ret
);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
3
],
comp_dn
+
offset
,
dnptrs
[
3
]);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
3
],
comp_dn
+
offset
,
dnptrs
[
3
]);
offset
+=
ret
+
1
;
offset
+=
ret
+
1
;
ret
=
dn_comp
(
"example.com.cn"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
ret
=
dn_comp
(
"example.com.cn"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
dump
(
comp_dn
+
offset
,
ret
);
dump
(
comp_dn
+
offset
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
16
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
16
,
ret
);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
4
],
comp_dn
+
offset
,
dnptrs
[
4
]);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
4
],
comp_dn
+
offset
,
dnptrs
[
4
]);
offset
+=
ret
+
1
;
offset
+=
ret
+
1
;
ret
=
dn_comp
(
"2example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
ret
=
dn_comp
(
"2example.com"
,
comp_dn
+
offset
,
sizeof
(
comp_dn
)
-
offset
,
dnptrs
,
lastdnptr
);
dump
(
comp_dn
+
offset
,
ret
);
dump
(
comp_dn
+
offset
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
11
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
11
,
ret
);
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
5
],
/*comp_dn+offset*/
NULL
,
dnptrs
[
5
]);
//last one is always NULL
ICUNIT_ASSERT_EQUAL
(
dnptrs
[
5
],
/*comp_dn+offset*/
NULL
,
dnptrs
[
5
]);
//last one is always NULL
...
@@ -80,7 +80,7 @@ static int DnCompTest(void)
...
@@ -80,7 +80,7 @@ static int DnCompTest(void)
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
printf
(
"%p: %s
\n
"
,
dnptrs
[
i
],
dnptrs
[
i
]);
printf
(
"%p: %s
\n
"
,
dnptrs
[
i
],
dnptrs
[
i
]);
}
}
ICUNIT_ASSERT_EQUAL
(
offset
+
ret
<
100
,
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
offset
+
ret
<
100
,
1
,
ret
);
return
ICUNIT_SUCCESS
;
return
ICUNIT_SUCCESS
;
}
}
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_002.cpp
浏览文件 @
6ed09bf1
...
@@ -64,7 +64,7 @@ static int UdpTest(void)
...
@@ -64,7 +64,7 @@ static int UdpTest(void)
srvAddr
.
sin_family
=
AF_INET
;
srvAddr
.
sin_family
=
AF_INET
;
srvAddr
.
sin_addr
.
s_addr
=
inet_addr
(
STACK_IP
);
srvAddr
.
sin_addr
.
s_addr
=
inet_addr
(
STACK_IP
);
srvAddr
.
sin_port
=
htons
(
STACK_PORT
);
srvAddr
.
sin_port
=
htons
(
STACK_PORT
);
ret
=
bind
(
sfd
,
(
struct
sockaddr
*
)
&
srvAddr
,
sizeof
(
srvAddr
));
ret
=
bind
(
sfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
srvAddr
)
,
sizeof
(
srvAddr
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
/* send */
/* send */
...
@@ -75,14 +75,14 @@ static int UdpTest(void)
...
@@ -75,14 +75,14 @@ static int UdpTest(void)
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
strcpy_s
(
g_buf
,
BUF_SIZE
,
MSG
);
ret
=
strcpy_s
(
g_buf
,
BUF_SIZE
,
MSG
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
sendto
(
sfd
,
g_buf
,
strlen
(
MSG
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
ret
=
sendto
(
sfd
,
g_buf
,
strlen
(
MSG
),
0
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
clnAddr
)
,
(
socklen_t
)
sizeof
(
clnAddr
));
static_cast
<
socklen_t
>
(
sizeof
(
clnAddr
)
));
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
ret
);
/* recv */
/* recv */
ret
=
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
recvfrom
(
sfd
,
g_buf
,
sizeof
(
g_buf
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
ret
=
recvfrom
(
sfd
,
g_buf
,
sizeof
(
g_buf
),
0
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
clnAddr
)
,
&
clnAddrLen
);
&
clnAddrLen
);
ICUNIT_ASSERT_EQUAL
(
ret
,
strlen
(
MSG
),
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
strlen
(
MSG
),
ret
);
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_003.cpp
浏览文件 @
6ed09bf1
...
@@ -68,7 +68,7 @@ static int SampleTcpServer()
...
@@ -68,7 +68,7 @@ static int SampleTcpServer()
srvAddr
.
sin_family
=
AF_INET
;
srvAddr
.
sin_family
=
AF_INET
;
srvAddr
.
sin_addr
.
s_addr
=
inet_addr
(
STACK_IP
);
srvAddr
.
sin_addr
.
s_addr
=
inet_addr
(
STACK_IP
);
srvAddr
.
sin_port
=
htons
(
STACK_PORT
);
srvAddr
.
sin_port
=
htons
(
STACK_PORT
);
ret
=
bind
(
lsfd
,
(
struct
sockaddr
*
)
&
srvAddr
,
sizeof
(
srvAddr
));
ret
=
bind
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
srvAddr
)
,
sizeof
(
srvAddr
));
LogPrintln
(
"bind socket %d to %s:%d: %d"
,
lsfd
,
inet_ntoa
(
srvAddr
.
sin_addr
),
ntohs
(
srvAddr
.
sin_port
),
ret
);
LogPrintln
(
"bind socket %d to %s:%d: %d"
,
lsfd
,
inet_ntoa
(
srvAddr
.
sin_addr
),
ntohs
(
srvAddr
.
sin_port
),
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
Wait
()
+
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
Wait
()
+
ret
);
...
@@ -78,7 +78,7 @@ static int SampleTcpServer()
...
@@ -78,7 +78,7 @@ static int SampleTcpServer()
Wait
();
Wait
();
sfd
=
accept
(
lsfd
,
(
struct
sockaddr
*
)
&
clnAddr
,
&
clnAddrLen
);
sfd
=
accept
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
clnAddr
)
,
&
clnAddrLen
);
LogPrintln
(
"accept socket %d: %d <%s:%d>"
,
lsfd
,
sfd
,
inet_ntoa
(
clnAddr
.
sin_addr
),
ntohs
(
clnAddr
.
sin_port
));
LogPrintln
(
"accept socket %d: %d <%s:%d>"
,
lsfd
,
sfd
,
inet_ntoa
(
clnAddr
.
sin_addr
),
ntohs
(
clnAddr
.
sin_port
));
ICUNIT_ASSERT_NOT_EQUAL
(
sfd
,
-
1
,
sfd
);
ICUNIT_ASSERT_NOT_EQUAL
(
sfd
,
-
1
,
sfd
);
...
@@ -175,25 +175,27 @@ static int SampleTcpClient()
...
@@ -175,25 +175,27 @@ static int SampleTcpClient()
srvAddr
.
sin_family
=
AF_INET
;
srvAddr
.
sin_family
=
AF_INET
;
srvAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
srvAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
srvAddr
.
sin_port
=
htons
(
PEER_PORT
);
srvAddr
.
sin_port
=
htons
(
PEER_PORT
);
ret
=
connect
(
sfd
,
(
struct
sockaddr
*
)
&
srvAddr
,
sizeof
(
srvAddr
));
ret
=
connect
(
sfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
srvAddr
)
,
sizeof
(
srvAddr
));
LogPrintln
(
"connect socket %d to %s:%d: %d"
,
sfd
,
inet_ntoa
(
srvAddr
.
sin_addr
),
ntohs
(
srvAddr
.
sin_port
),
ret
);
LogPrintln
(
"connect socket %d to %s:%d: %d"
,
sfd
,
inet_ntoa
(
srvAddr
.
sin_addr
),
ntohs
(
srvAddr
.
sin_port
),
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
/* test getpeername */
/* test getpeername */
ret
=
getpeername
(
sfd
,
&
addr
,
&
addrLen
);
ret
=
getpeername
(
sfd
,
&
addr
,
&
addrLen
);
LogPrintln
(
"getpeername %d %s:%d: %d"
,
sfd
,
inet_ntoa
(((
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
),
ntohs
(((
struct
sockaddr_in
*
)
&
addr
)
->
sin_port
),
ret
);
LogPrintln
(
"getpeername %d %s:%d: %d"
,
sfd
,
inet_ntoa
((
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
addr
))
->
sin_addr
),
ntohs
((
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
addr
))
->
sin_port
),
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
addrLen
,
sizeof
(
struct
sockaddr_in
),
addrLen
);
ICUNIT_ASSERT_EQUAL
(
addrLen
,
sizeof
(
struct
sockaddr_in
),
addrLen
);
ICUNIT_ASSERT_EQUAL
((
(
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
.
s_addr
,
ICUNIT_ASSERT_EQUAL
((
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
addr
)
)
->
sin_addr
.
s_addr
,
inet_addr
(
PEER_IP
),
(
(
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
.
s_addr
);
inet_addr
(
PEER_IP
),
(
static_cast
<
struct
sockaddr_in
*>
(
&
addr
)
)
->
sin_addr
.
s_addr
);
/* test getsockname */
/* test getsockname */
ret
=
getsockname
(
sfd
,
&
addr
,
&
addrLen
);
ret
=
getsockname
(
sfd
,
&
addr
,
&
addrLen
);
LogPrintln
(
"getsockname %d %s:%d: %d"
,
sfd
,
inet_ntoa
(((
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
),
ntohs
(((
struct
sockaddr_in
*
)
&
addr
)
->
sin_port
),
ret
);
LogPrintln
(
"getsockname %d %s:%d: %d"
,
sfd
,
inet_ntoa
((
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
addr
))
->
sin_addr
),
ntohs
((
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
addr
))
->
sin_port
),
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
addrLen
,
sizeof
(
struct
sockaddr_in
),
addrLen
);
ICUNIT_ASSERT_EQUAL
(
addrLen
,
sizeof
(
struct
sockaddr_in
),
addrLen
);
ICUNIT_ASSERT_EQUAL
((
(
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
.
s_addr
,
ICUNIT_ASSERT_EQUAL
((
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
addr
)
)
->
sin_addr
.
s_addr
,
inet_addr
(
STACK_IP
),
(
(
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
.
s_addr
);
inet_addr
(
STACK_IP
),
(
static_cast
<
struct
sockaddr_in
*>
(
&
addr
)
)
->
sin_addr
.
s_addr
);
/* send */
/* send */
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
ret
=
memset_s
(
gBuf
,
BUF_SIZE
+
1
,
0
,
BUF_SIZE
+
1
);
...
@@ -267,13 +269,13 @@ static int SampleTcpClient()
...
@@ -267,13 +269,13 @@ static int SampleTcpClient()
static
void
*
TcpServerRoutine
(
void
*
p
)
static
void
*
TcpServerRoutine
(
void
*
p
)
{
{
int
ret
=
SampleTcpServer
();
int
ret
=
SampleTcpServer
();
return
(
void
*
)(
intptr_t
)
ret
;
return
reinterpret_cast
<
void
*>
(
ret
)
;
}
}
static
void
*
TcpClientRoutine
(
void
*
p
)
static
void
*
TcpClientRoutine
(
void
*
p
)
{
{
int
ret
=
SampleTcpClient
();
int
ret
=
SampleTcpClient
();
return
(
void
*
)(
intptr_t
)
ret
;
return
reinterpret_cast
<
void
*>
(
ret
)
;
}
}
static
int
TcpTest
()
static
int
TcpTest
()
...
@@ -312,7 +314,7 @@ static int TcpTest()
...
@@ -312,7 +314,7 @@ static int TcpTest()
ret
=
pthread_barrier_destroy
(
&
gBarrier
);
ret
=
pthread_barrier_destroy
(
&
gBarrier
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
return
(
int
)(
intptr_t
)(
sret
)
+
(
int
)(
intptr_t
)(
cret
);
return
static_cast
<
int
>
(
reinterpret_cast
<
intptr_t
>
(
sret
))
+
static_cast
<
int
>
(
reinterpret_cast
<
intptr_t
>
(
cret
)
);
}
}
void
NetSocketTest003
(
void
)
void
NetSocketTest003
(
void
)
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_007.cpp
浏览文件 @
6ed09bf1
...
@@ -45,90 +45,100 @@ static int TcpTest()
...
@@ -45,90 +45,100 @@ static int TcpTest()
lsfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
lsfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
lsfd
,
-
1
,
lsfd
);
ICUNIT_ASSERT_NOT_EQUAL
(
lsfd
,
-
1
,
lsfd
);
ret
=
bind
(
lsfd
,
(
const
struct
sockaddr
*
)
INVALID_USER_ADDR
,
sizeof
(
struct
sockaddr_in
));
ret
=
bind
(
lsfd
,
reinterpret_cast
<
const
struct
sockaddr
*>
(
INVALID_USER_ADDR
)
,
sizeof
(
struct
sockaddr_in
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
bind
(
lsfd
,
(
const
struct
sockaddr
*
)
INVALID_KERNEL_ADDR
,
sizeof
(
struct
sockaddr_in
));
ret
=
bind
(
lsfd
,
reinterpret_cast
<
const
struct
sockaddr
*>
(
INVALID_KERNEL_ADDR
)
,
sizeof
(
struct
sockaddr_in
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
connect
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_USER_ADDR
,
sizeof
(
struct
sockaddr_in
));
ret
=
connect
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_USER_ADDR
)
,
sizeof
(
struct
sockaddr_in
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
connect
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_KERNEL_ADDR
,
sizeof
(
struct
sockaddr_in
));
ret
=
connect
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_KERNEL_ADDR
)
,
sizeof
(
struct
sockaddr_in
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
accept
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_USER_ADDR
,
(
socklen_t
*
)
INVALID_USER_ADDR
);
ret
=
accept
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_USER_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_USER_ADDR
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
accept
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_KERNEL_ADDR
,
(
socklen_t
*
)
INVALID_KERNEL_ADDR
);
ret
=
accept
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_KERNEL_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_KERNEL_ADDR
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
getsockname
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_USER_ADDR
,
(
socklen_t
*
)
INVALID_USER_ADDR
);
ret
=
getsockname
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_USER_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_USER_ADDR
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
getsockname
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_KERNEL_ADDR
,
(
socklen_t
*
)
INVALID_KERNEL_ADDR
);
ret
=
getsockname
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_KERNEL_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_KERNEL_ADDR
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
getpeername
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_USER_ADDR
,
(
socklen_t
*
)
INVALID_USER_ADDR
);
ret
=
getpeername
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_USER_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_USER_ADDR
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
getpeername
(
lsfd
,
(
struct
sockaddr
*
)
INVALID_KERNEL_ADDR
,
(
socklen_t
*
)
INVALID_KERNEL_ADDR
);
ret
=
getpeername
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_KERNEL_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_KERNEL_ADDR
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
send
(
lsfd
,
(
char
*
)
INVALID_USER_ADDR
,
strlen
(
SRV_MSG
),
0
);
ret
=
send
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_USER_ADDR
)
,
strlen
(
SRV_MSG
),
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
send
(
lsfd
,
(
char
*
)
INVALID_KERNEL_ADDR
,
strlen
(
SRV_MSG
),
0
);
ret
=
send
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_KERNEL_ADDR
)
,
strlen
(
SRV_MSG
),
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
sendto
(
lsfd
,
(
char
*
)
INVALID_USER_ADDR
,
strlen
(
SRV_MSG
),
0
,
(
struct
sockaddr
*
)
INVALID_USER_ADDR
,
ret
=
sendto
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_USER_ADDR
),
strlen
(
SRV_MSG
),
0
,
(
socklen_t
)
sizeof
(
struct
sockaddr_in
));
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_USER_ADDR
),
static_cast
<
socklen_t
>
(
sizeof
(
struct
sockaddr_in
)
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
sendto
(
lsfd
,
(
char
*
)
INVALID_KERNEL_ADDR
,
strlen
(
SRV_MSG
),
0
,
(
struct
sockaddr
*
)
INVALID_KERNEL_ADDR
,
ret
=
sendto
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_KERNEL_ADDR
),
strlen
(
SRV_MSG
),
0
,
(
socklen_t
)
sizeof
(
struct
sockaddr_in
));
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_KERNEL_ADDR
),
static_cast
<
socklen_t
>
(
sizeof
(
struct
sockaddr_in
)
));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
recv
(
lsfd
,
(
char
*
)
INVALID_USER_ADDR
,
sizeof
(
SRV_MSG
),
0
);
ret
=
recv
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_USER_ADDR
)
,
sizeof
(
SRV_MSG
),
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
recv
(
lsfd
,
(
char
*
)
INVALID_KERNEL_ADDR
,
sizeof
(
SRV_MSG
),
0
);
ret
=
recv
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_KERNEL_ADDR
)
,
sizeof
(
SRV_MSG
),
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
recvfrom
(
lsfd
,
(
char
*
)
INVALID_USER_ADDR
,
sizeof
(
SRV_MSG
),
0
,
(
struct
sockaddr
*
)
INVALID_USER_ADDR
,
ret
=
recvfrom
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_USER_ADDR
),
sizeof
(
SRV_MSG
),
0
,
(
socklen_t
*
)
INVALID_USER_ADDR
);
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_USER_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_USER_ADDR
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
recvfrom
(
lsfd
,
(
char
*
)
INVALID_KERNEL_ADDR
,
sizeof
(
SRV_MSG
),
0
,
(
struct
sockaddr
*
)
INVALID_KERNEL_ADDR
,
ret
=
recvfrom
(
lsfd
,
reinterpret_cast
<
char
*>
(
INVALID_KERNEL_ADDR
),
sizeof
(
SRV_MSG
),
0
,
(
socklen_t
*
)
INVALID_KERNEL_ADDR
);
reinterpret_cast
<
struct
sockaddr
*>
(
INVALID_KERNEL_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
INVALID_KERNEL_ADDR
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
setsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
struct
timeval
*
)
INVALID_USER_ADDR
,
(
socklen_t
)
sizeof
(
struct
timeval
));
ret
=
setsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
reinterpret_cast
<
struct
timeval
*>
(
INVALID_USER_ADDR
),
static_cast
<
socklen_t
>
(
sizeof
(
struct
timeval
)));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
setsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
struct
timeval
*
)
INVALID_KERNEL_ADDR
,
(
socklen_t
)
sizeof
(
struct
timeval
));
ret
=
setsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
reinterpret_cast
<
struct
timeval
*>
(
INVALID_KERNEL_ADDR
),
static_cast
<
socklen_t
>
(
sizeof
(
struct
timeval
)));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
getsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
struct
timeval
*
)
INVALID_USER_ADDR
,
(
socklen_t
*
)
sizeof
(
struct
timeval
));
ret
=
getsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
reinterpret_cast
<
struct
timeval
*>
(
INVALID_USER_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
sizeof
(
struct
timeval
)));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
getsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
struct
timeval
*
)
INVALID_KERNEL_ADDR
,
(
socklen_t
*
)
sizeof
(
struct
timeval
));
ret
=
getsockopt
(
lsfd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
reinterpret_cast
<
struct
timeval
*>
(
INVALID_KERNEL_ADDR
),
reinterpret_cast
<
socklen_t
*>
(
sizeof
(
struct
timeval
)));
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
sendmsg
(
lsfd
,
(
struct
msghdr
*
)
INVALID_USER_ADDR
,
0
);
ret
=
sendmsg
(
lsfd
,
reinterpret_cast
<
struct
msghdr
*>
(
INVALID_USER_ADDR
)
,
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
sendmsg
(
lsfd
,
(
struct
msghdr
*
)
INVALID_KERNEL_ADDR
,
0
);
ret
=
sendmsg
(
lsfd
,
reinterpret_cast
<
struct
msghdr
*>
(
INVALID_KERNEL_ADDR
)
,
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
msg
.
msg_name
=
(
char
*
)
INVALID_USER_ADDR
;
msg
.
msg_name
=
reinterpret_cast
<
char
*>
(
INVALID_USER_ADDR
)
;
msg
.
msg_namelen
=
sizeof
(
struct
sockaddr_in
);
msg
.
msg_namelen
=
sizeof
(
struct
sockaddr_in
);
msg
.
msg_iov
=
(
struct
iovec
*
)
INVALID_KERNEL_ADDR
;
msg
.
msg_iov
=
reinterpret_cast
<
struct
iovec
*>
(
INVALID_KERNEL_ADDR
)
;
msg
.
msg_iovlen
=
2
;
msg
.
msg_iovlen
=
2
;
ret
=
recvmsg
(
lsfd
,
(
struct
msghdr
*
)
&
msg
,
0
);
ret
=
recvmsg
(
lsfd
,
static_cast
<
struct
msghdr
*>
(
&
msg
)
,
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ret
=
recvmsg
(
lsfd
,
(
struct
msghdr
*
)
&
msg
,
0
);
ret
=
recvmsg
(
lsfd
,
static_cast
<
struct
msghdr
*>
(
&
msg
)
,
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
#ifdef TEST_BIG_MEM
#ifdef TEST_BIG_MEM
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_008.cpp
浏览文件 @
6ed09bf1
...
@@ -121,7 +121,7 @@ static int HandleAccept(int lsfd)
...
@@ -121,7 +121,7 @@ static int HandleAccept(int lsfd)
{
{
struct
sockaddr_in
sa
;
struct
sockaddr_in
sa
;
int
saLen
=
sizeof
(
sa
);
int
saLen
=
sizeof
(
sa
);
int
fd
=
accept
(
lsfd
,
(
struct
sockaddr
*
)
&
sa
,
(
socklen_t
*
)
&
saLen
);
int
fd
=
accept
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
),
reinterpret_cast
<
socklen_t
*>
(
&
saLen
)
);
if
(
fd
==
INVALID_SOCKET
)
{
if
(
fd
==
INVALID_SOCKET
)
{
perror
(
"accept"
);
perror
(
"accept"
);
return
-
1
;
return
-
1
;
...
@@ -168,7 +168,7 @@ static void *ClientsThread(void *param)
...
@@ -168,7 +168,7 @@ static void *ClientsThread(void *param)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
if
(
connect
(
fd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
))
==
-
1
)
{
if
(
connect
(
fd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
))
==
-
1
)
{
perror
(
"connect"
);
perror
(
"connect"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -224,7 +224,7 @@ static int SelectTest(void)
...
@@ -224,7 +224,7 @@ static int SelectTest(void)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
ret
=
bind
(
lsfd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
));
ret
=
bind
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
));
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
ret
=
listen
(
lsfd
,
BACKLOG
);
ret
=
listen
(
lsfd
,
BACKLOG
);
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_009.cpp
浏览文件 @
6ed09bf1
...
@@ -120,7 +120,7 @@ static int HandleAccept(int lsfd)
...
@@ -120,7 +120,7 @@ static int HandleAccept(int lsfd)
{
{
struct
sockaddr_in
sa
;
struct
sockaddr_in
sa
;
int
saLen
=
sizeof
(
sa
);
int
saLen
=
sizeof
(
sa
);
int
fd
=
accept
(
lsfd
,
(
struct
sockaddr
*
)
&
sa
,
(
socklen_t
*
)
&
saLen
);
int
fd
=
accept
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
),
reinterpret_cast
<
socklen_t
*>
(
&
saLen
)
);
if
(
fd
==
INVALID_SOCKET
)
{
if
(
fd
==
INVALID_SOCKET
)
{
perror
(
"accept"
);
perror
(
"accept"
);
return
-
1
;
return
-
1
;
...
@@ -168,7 +168,7 @@ static void *ClientsThread(void *param)
...
@@ -168,7 +168,7 @@ static void *ClientsThread(void *param)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
if
(
connect
(
fd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
))
==
-
1
)
{
if
(
connect
(
fd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
))
==
-
1
)
{
perror
(
"connect"
);
perror
(
"connect"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -224,7 +224,7 @@ static int PollTest(void)
...
@@ -224,7 +224,7 @@ static int PollTest(void)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
ret
=
bind
(
lsfd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
));
ret
=
bind
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
));
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
ret
=
listen
(
lsfd
,
BACKLOG
);
ret
=
listen
(
lsfd
,
BACKLOG
);
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_010.cpp
浏览文件 @
6ed09bf1
...
@@ -117,11 +117,11 @@ static int IoctlTestInternal(int sfd)
...
@@ -117,11 +117,11 @@ static int IoctlTestInternal(int sfd)
LogPrintln
(
"ifindex %u: %s"
,
lanIndex
,
p
);
LogPrintln
(
"ifindex %u: %s"
,
lanIndex
,
p
);
ICUNIT_ASSERT_NOT_EQUAL
(
p
,
NULL
,
errno
);
ICUNIT_ASSERT_NOT_EQUAL
(
p
,
NULL
,
errno
);
ret
=
strncpy_s
(
gDefaultNetif
,
sizeof
(
gDefaultNetif
)
-
1
,
p
,
sizeof
(
gDefaultNetif
)
-
1
);
ret
=
strncpy_s
(
gDefaultNetif
,
sizeof
(
gDefaultNetif
)
-
1
,
p
,
sizeof
(
gDefaultNetif
)
-
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
gDefaultNetif
[
sizeof
(
gDefaultNetif
)
-
1
]
=
'\0'
;
gDefaultNetif
[
sizeof
(
gDefaultNetif
)
-
1
]
=
'\0'
;
ret
=
(
int
)
IfName2Index
(
sfd
,
p
);
ret
=
static_cast
<
int
>
(
IfName2Index
(
sfd
,
p
)
);
LogPrintln
(
"index of %s: %d"
,
p
,
ret
);
LogPrintln
(
"index of %s: %d"
,
p
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
errno
);
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
0
,
errno
);
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_011.cpp
浏览文件 @
6ed09bf1
...
@@ -143,7 +143,7 @@ static void *ClientsThread(void *param)
...
@@ -143,7 +143,7 @@ static void *ClientsThread(void *param)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
if
(
connect
(
fd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
))
==
-
1
)
{
if
(
connect
(
fd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
))
==
-
1
)
{
perror
(
"connect"
);
perror
(
"connect"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -204,7 +204,7 @@ static int UdpSelectTest(void)
...
@@ -204,7 +204,7 @@ static int UdpSelectTest(void)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
ret
=
bind
(
lsfd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
));
ret
=
bind
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
));
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
InitFds
();
InitFds
();
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_012.cpp
浏览文件 @
6ed09bf1
...
@@ -43,11 +43,11 @@ static int SocketNullTestInternal(int sfd)
...
@@ -43,11 +43,11 @@ static int SocketNullTestInternal(int sfd)
{
{
int
ret
;
int
ret
;
struct
sockaddr
addr
=
{
0
};
struct
sockaddr
addr
=
{
0
};
struct
sockaddr
*
bad
=
(
struct
sockaddr
*
)
0xbad
;
struct
sockaddr
*
bad
=
reinterpret_cast
<
struct
sockaddr
*>
(
0xbad
)
;
socklen_t
addrlen
=
sizeof
(
addr
);
socklen_t
addrlen
=
sizeof
(
addr
);
socklen_t
zero
=
0
;
socklen_t
zero
=
0
;
struct
msghdr
message
=
{
0
};
struct
msghdr
message
=
{
0
};
void
*
badUserAddr
=
(
void
*
)
0x3effffff
;
void
*
badUserAddr
=
reinterpret_cast
<
void
*>
(
0x3effffff
)
;
/**
/**
* accept
* accept
...
@@ -216,13 +216,13 @@ static int SocketNullTestInternal(int sfd)
...
@@ -216,13 +216,13 @@ static int SocketNullTestInternal(int sfd)
LogPrintln
(
"recvmsg: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"recvmsg: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
message
.
msg_iov
=
(
struct
iovec
*
)((
void
*
)
0xbad
);
message
.
msg_iov
=
reinterpret_cast
<
struct
iovec
*>
(
0xbad
);
message
.
msg_iovlen
=
1
;
message
.
msg_iovlen
=
1
;
ret
=
recvmsg
(
sfd
,
&
message
,
MSG_DONTWAIT
);
ret
=
recvmsg
(
sfd
,
&
message
,
MSG_DONTWAIT
);
LogPrintln
(
"recvmsg: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"recvmsg: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
message
.
msg_iov
=
(
struct
iovec
*
)((
void
*
)
0xbad
);
message
.
msg_iov
=
reinterpret_cast
<
struct
iovec
*>
(
0xbad
);
message
.
msg_iovlen
=
0
;
message
.
msg_iovlen
=
0
;
ret
=
recvmsg
(
sfd
,
&
message
,
MSG_DONTWAIT
);
ret
=
recvmsg
(
sfd
,
&
message
,
MSG_DONTWAIT
);
LogPrintln
(
"recvmsg: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"recvmsg: %d, errno=%d"
,
ret
,
errno
);
...
@@ -264,13 +264,13 @@ static int SocketNullTestInternal(int sfd)
...
@@ -264,13 +264,13 @@ static int SocketNullTestInternal(int sfd)
LogPrintln
(
"sendmsg: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"sendmsg: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
message
.
msg_iov
=
(
struct
iovec
*
)
0xbad
;
message
.
msg_iov
=
reinterpret_cast
<
struct
iovec
*>
(
0xbad
)
;
message
.
msg_iovlen
=
1
;
message
.
msg_iovlen
=
1
;
ret
=
sendmsg
(
sfd
,
&
message
,
MSG_NOSIGNAL
);
ret
=
sendmsg
(
sfd
,
&
message
,
MSG_NOSIGNAL
);
LogPrintln
(
"sendmsg: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"sendmsg: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
message
.
msg_iov
=
(
struct
iovec
*
)
0xbad
;
message
.
msg_iov
=
reinterpret_cast
<
struct
iovec
*>
(
0xbad
)
;
message
.
msg_iovlen
=
0
;
message
.
msg_iovlen
=
0
;
ret
=
sendmsg
(
sfd
,
&
message
,
MSG_NOSIGNAL
);
ret
=
sendmsg
(
sfd
,
&
message
,
MSG_NOSIGNAL
);
LogPrintln
(
"sendmsg: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"sendmsg: %d, errno=%d"
,
ret
,
errno
);
...
@@ -326,11 +326,11 @@ static int SocketNullTestInternal(int sfd)
...
@@ -326,11 +326,11 @@ static int SocketNullTestInternal(int sfd)
LogPrintln
(
"read: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"read: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ret
=
readv
(
sfd
,
(
struct
iovec
*
)
bad
,
0
);
ret
=
readv
(
sfd
,
reinterpret_cast
<
struct
iovec
*>
(
bad
)
,
0
);
LogPrintln
(
"readv: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"readv: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ret
=
readv
(
sfd
,
(
struct
iovec
*
)
bad
,
1
);
ret
=
readv
(
sfd
,
reinterpret_cast
<
struct
iovec
*>
(
bad
)
,
1
);
LogPrintln
(
"readv: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"readv: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
...
@@ -377,11 +377,11 @@ static int SocketNullTestInternal(int sfd)
...
@@ -377,11 +377,11 @@ static int SocketNullTestInternal(int sfd)
LogPrintln
(
"write: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"write: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ret
=
writev
(
sfd
,
(
struct
iovec
*
)
bad
,
0
);
ret
=
writev
(
sfd
,
reinterpret_cast
<
struct
iovec
*>
(
bad
)
,
0
);
LogPrintln
(
"writev: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"writev: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ICUNIT_ASSERT_EQUAL
((
ret
==
0
||
ret
==
-
1
),
1
,
errno
);
ret
=
writev
(
sfd
,
(
struct
iovec
*
)
bad
,
1
);
ret
=
writev
(
sfd
,
reinterpret_cast
<
struct
iovec
*>
(
bad
)
,
1
);
LogPrintln
(
"writev: %d, errno=%d"
,
ret
,
errno
);
LogPrintln
(
"writev: %d, errno=%d"
,
ret
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
errno
);
...
...
testsuites/unittest/net/socket/smoke/net_socket_test_013.cpp
浏览文件 @
6ed09bf1
...
@@ -140,7 +140,7 @@ static unsigned int GetIp(int sfd, const char *ifname)
...
@@ -140,7 +140,7 @@ static unsigned int GetIp(int sfd, const char *ifname)
ifr
.
ifr_name
[
sizeof
(
ifr
.
ifr_name
)
-
1
]
=
'\0'
;
ifr
.
ifr_name
[
sizeof
(
ifr
.
ifr_name
)
-
1
]
=
'\0'
;
ret
=
ioctl
(
sfd
,
SIOCGIFADDR
,
&
ifr
);
ret
=
ioctl
(
sfd
,
SIOCGIFADDR
,
&
ifr
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
ip
=
(
(
struct
sockaddr_in
*
)
&
(
ifr
.
ifr_addr
))
->
sin_addr
.
s_addr
;
ip
=
(
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
(
ifr
.
ifr_addr
)
))
->
sin_addr
.
s_addr
;
}
}
return
ip
;
return
ip
;
}
}
...
@@ -156,7 +156,7 @@ static unsigned int GetNetmask(int sfd, const char *ifname)
...
@@ -156,7 +156,7 @@ static unsigned int GetNetmask(int sfd, const char *ifname)
ifr
.
ifr_name
[
sizeof
(
ifr
.
ifr_name
)
-
1
]
=
'\0'
;
ifr
.
ifr_name
[
sizeof
(
ifr
.
ifr_name
)
-
1
]
=
'\0'
;
ret
=
ioctl
(
sfd
,
SIOCGIFNETMASK
,
&
ifr
);
ret
=
ioctl
(
sfd
,
SIOCGIFNETMASK
,
&
ifr
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
msk
=
(
(
struct
sockaddr_in
*
)
&
(
ifr
.
ifr_addr
))
->
sin_addr
.
s_addr
;
msk
=
(
reinterpret_cast
<
struct
sockaddr_in
*>
(
&
(
ifr
.
ifr_addr
)
))
->
sin_addr
.
s_addr
;
}
}
return
msk
;
return
msk
;
}
}
...
@@ -207,7 +207,7 @@ static void *ClientsThread(void *param)
...
@@ -207,7 +207,7 @@ static void *ClientsThread(void *param)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
brdcast
;
sa
.
sin_addr
.
s_addr
=
brdcast
;
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
if
(
connect
(
fd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
))
==
-
1
)
{
if
(
connect
(
fd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
))
==
-
1
)
{
perror
(
"connect"
);
perror
(
"connect"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -263,7 +263,7 @@ static int UdpBrdcastSelectTest(void)
...
@@ -263,7 +263,7 @@ static int UdpBrdcastSelectTest(void)
sa
.
sin_family
=
AF_INET
;
sa
.
sin_family
=
AF_INET
;
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
sa
.
sin_port
=
htons
(
SERVER_PORT
);
ret
=
bind
(
lsfd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
));
ret
=
bind
(
lsfd
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
sa
)
,
sizeof
(
sa
));
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
ICUNIT_ASSERT_NOT_EQUAL
(
ret
,
-
1
,
errno
+
CloseAllFd
());
int
broadcast
=
1
;
int
broadcast
=
1
;
...
...
testsuites/unittest/process/basic/process/full/process_test_042.cpp
浏览文件 @
6ed09bf1
...
@@ -38,7 +38,7 @@ static void Child2(int shmid)
...
@@ -38,7 +38,7 @@ static void Child2(int shmid)
{
{
int
count
=
2
;
// 2, Set the calculation number to determine the cycle status.
int
count
=
2
;
// 2, Set the calculation number to determine the cycle status.
int
*
shared
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
int
*
shared
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL_VOID
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL_VOID
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
while
((
*
shared
)
<
(
TEST_LOOP
+
2
))
{
// 2, Set the cycle number.
while
((
*
shared
)
<
(
TEST_LOOP
+
2
))
{
// 2, Set the cycle number.
ICUNIT_ASSERT_EQUAL_VOID
(
*
shared
,
count
,
*
shared
);
ICUNIT_ASSERT_EQUAL_VOID
(
*
shared
,
count
,
*
shared
);
...
@@ -55,7 +55,7 @@ static void Child1(int shmid)
...
@@ -55,7 +55,7 @@ static void Child1(int shmid)
{
{
int
count
=
1
;
int
count
=
1
;
int
*
shared
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
int
*
shared
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL_VOID
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL_VOID
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
while
((
*
shared
)
<
(
TEST_LOOP
+
1
))
{
while
((
*
shared
)
<
(
TEST_LOOP
+
1
))
{
ICUNIT_ASSERT_EQUAL_VOID
(
*
shared
,
count
,
*
shared
);
ICUNIT_ASSERT_EQUAL_VOID
(
*
shared
,
count
,
*
shared
);
...
@@ -92,7 +92,8 @@ static int GroupProcess(void)
...
@@ -92,7 +92,8 @@ static int GroupProcess(void)
ret
=
pthread_setschedparam
(
pthread_self
(),
SCHED_FIFO
,
&
param
);
ret
=
pthread_setschedparam
(
pthread_self
(),
SCHED_FIFO
,
&
param
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
shmid
=
shmget
((
key_t
)
1234
,
memSize
,
0666
|
IPC_CREAT
);
// 1234, Sets the shmget key; 0666 config of shmget
/* 1234, Sets the shmget key; 0666 config of shmget */
shmid
=
shmget
(
static_cast
<
key_t
>
(
1234
),
memSize
,
0666
|
IPC_CREAT
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
pid
=
fork
();
pid
=
fork
();
...
@@ -112,7 +113,7 @@ static int GroupProcess(void)
...
@@ -112,7 +113,7 @@ static int GroupProcess(void)
}
}
shared
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
shared
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
(
void
*
)
-
1
,
shared
);
ICUNIT_ASSERT_NOT_EQUAL
(
shared
,
reinterpret_cast
<
void
*>
(
-
1
)
,
shared
);
(
*
shared
)
=
0
;
(
*
shared
)
=
0
;
...
...
testsuites/unittest/process/basic/process/full/process_test_049.cpp
浏览文件 @
6ed09bf1
...
@@ -88,14 +88,14 @@ static int Testcase(void)
...
@@ -88,14 +88,14 @@ static int Testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
(
int
*
)
-
1
,
g_shmptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
reinterpret_cast
<
int
*>
(
-
1
)
,
g_shmptr
);
*
g_shmptr
=
0
;
*
g_shmptr
=
0
;
stack
=
(
char
*
)
malloc
(
arg
);
stack
=
static_cast
<
char
*>
(
malloc
(
arg
)
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
stackTop
=
(
char
*
)((
unsigned
long
)
stack
+
arg
);
stackTop
=
reinterpret_cast
<
char
*>
(
reinterpret_cast
<
unsigned
long
>
(
stack
)
+
arg
);
pid
=
clone
(
TestThread
,
(
void
*
)
stackTop
,
CLONE_VFORK
,
&
arg
);
pid
=
clone
(
TestThread
,
(
void
*
)
stackTop
,
CLONE_VFORK
,
&
arg
);
ICUNIT_GOTO_EQUAL
(
*
g_shmptr
,
arg
,
*
g_shmptr
,
EXIT2
);
ICUNIT_GOTO_EQUAL
(
*
g_shmptr
,
arg
,
*
g_shmptr
,
EXIT2
);
...
...
testsuites/unittest/process/basic/process/full/process_test_050.cpp
浏览文件 @
6ed09bf1
...
@@ -60,7 +60,7 @@ static int Testcase(void)
...
@@ -60,7 +60,7 @@ static int Testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
(
int
*
)
-
1
,
g_shmptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
reinterpret_cast
<
int
*>
(
-
1
)
,
g_shmptr
);
*
g_shmptr
=
0
;
*
g_shmptr
=
0
;
...
@@ -70,7 +70,7 @@ static int Testcase(void)
...
@@ -70,7 +70,7 @@ static int Testcase(void)
stack
=
malloc
(
arg
);
stack
=
malloc
(
arg
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
stackTop
=
(
char
*
)((
unsigned
long
)
stack
+
arg
);
stackTop
=
reinterpret_cast
<
char
*>
(
reinterpret_cast
<
unsigned
long
>
(
stack
)
+
arg
);
pid
=
clone
(
TestThread
,
(
void
*
)
stackTop
,
CLONE_PARENT
,
&
arg
);
pid
=
clone
(
TestThread
,
(
void
*
)
stackTop
,
CLONE_PARENT
,
&
arg
);
ret
=
waitpid
(
pid
,
&
status
,
NULL
);
ret
=
waitpid
(
pid
,
&
status
,
NULL
);
...
...
testsuites/unittest/process/basic/process/full/process_test_051.cpp
浏览文件 @
6ed09bf1
...
@@ -75,7 +75,7 @@ static int Testcase(void)
...
@@ -75,7 +75,7 @@ static int Testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
(
int
*
)
-
1
,
g_shmptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
reinterpret_cast
<
int
*>
(
-
1
)
,
g_shmptr
);
*
g_shmptr
=
0
;
*
g_shmptr
=
0
;
...
@@ -85,7 +85,7 @@ static int Testcase(void)
...
@@ -85,7 +85,7 @@ static int Testcase(void)
stack
=
malloc
(
arg
);
stack
=
malloc
(
arg
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
stackTop
=
(
char
*
)((
unsigned
long
)
stack
+
arg
);
stackTop
=
reinterpret_cast
<
char
*>
(
reinterpret_cast
<
unsigned
long
>
(
stack
)
+
arg
);
pid
=
clone
(
TestThread
,
(
void
*
)
stackTop
,
CLONE_PARENT
|
CLONE_VFORK
,
&
arg
);
pid
=
clone
(
TestThread
,
(
void
*
)
stackTop
,
CLONE_PARENT
|
CLONE_VFORK
,
&
arg
);
ICUNIT_GOTO_EQUAL
(
*
g_shmptr
,
100
,
*
g_shmptr
,
EXIT2
);
// 100, assert g_shmptr equal to this.
ICUNIT_GOTO_EQUAL
(
*
g_shmptr
,
100
,
*
g_shmptr
,
EXIT2
);
// 100, assert g_shmptr equal to this.
...
...
testsuites/unittest/process/basic/process/full/process_test_052.cpp
浏览文件 @
6ed09bf1
...
@@ -58,17 +58,17 @@ static int Testcase(void)
...
@@ -58,17 +58,17 @@ static int Testcase(void)
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
,
-
1
,
shmid
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
g_shmptr
=
(
int
*
)
shmat
(
shmid
,
nullptr
,
0
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
(
int
*
)
-
1
,
g_shmptr
);
ICUNIT_ASSERT_NOT_EQUAL
(
g_shmptr
,
static_cast
<
int
*>
(
-
1
)
,
g_shmptr
);
*
g_shmptr
=
0
;
*
g_shmptr
=
0
;
g_ppid
=
getppid
();
g_ppid
=
getppid
();
printf
(
"testcase ppid : %d
\n
"
,
g_ppid
);
printf
(
"testcase ppid : %d
\n
"
,
g_ppid
);
void
*
stack
=
(
void
*
)
malloc
(
arg
);
void
*
stack
=
malloc
(
arg
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
ICUNIT_GOTO_NOT_EQUAL
(
stack
,
NULL
,
stack
,
EXIT1
);
char
*
stackTop
=
(
char
*
)((
unsigned
long
)
stack
+
arg
);
char
*
stackTop
=
static_cast
<
char
*>
(
static_cast
<
unsigned
long
>
(
stack
)
+
arg
);
pid_t
pid
=
clone
(
TestThread
,
(
char
*
)
stackTop
,
CLONE_PARENT
|
CLONE_VFORK
|
CLONE_FILES
,
&
arg
);
pid_t
pid
=
clone
(
TestThread
,
(
char
*
)
stackTop
,
CLONE_PARENT
|
CLONE_VFORK
|
CLONE_FILES
,
&
arg
);
ICUNIT_GOTO_EQUAL
(
*
g_shmptr
,
100
,
*
g_shmptr
,
EXIT2
);
// 100, assert g_shmptr equal to this.
ICUNIT_GOTO_EQUAL
(
*
g_shmptr
,
100
,
*
g_shmptr
,
EXIT2
);
// 100, assert g_shmptr equal to this.
...
...
testsuites/unittest/process/basic/process/full/process_test_062.cpp
浏览文件 @
6ed09bf1
...
@@ -95,12 +95,12 @@ static int TestCase(void)
...
@@ -95,12 +95,12 @@ static int TestCase(void)
status
=
WEXITSTATUS
(
status
);
status
=
WEXITSTATUS
(
status
);
ICUNIT_GOTO_EQUAL
(
status
,
10
,
status
,
EXIT
);
// 10, assert that function Result is equal to this.
ICUNIT_GOTO_EQUAL
(
status
,
10
,
status
,
EXIT
);
// 10, assert that function Result is equal to this.
shmdt
(
(
void
*
)
g_shmptr
);
shmdt
(
static_cast
<
void
*>
(
const_cast
<
int
*>
(
g_shmptr
))
);
shmctl
(
shmid
,
IPC_RMID
,
NULL
);
shmctl
(
shmid
,
IPC_RMID
,
NULL
);
return
0
;
return
0
;
EXIT:
EXIT:
shmdt
(
(
void
*
)
g_shmptr
);
shmdt
(
static_cast
<
void
*>
(
const_cast
<
int
*>
(
g_shmptr
))
);
shmctl
(
shmid
,
IPC_RMID
,
NULL
);
shmctl
(
shmid
,
IPC_RMID
,
NULL
);
return
1
;
return
1
;
}
}
...
...
testsuites/unittest/process/basic/process/full/process_test_063.cpp
浏览文件 @
6ed09bf1
...
@@ -52,12 +52,12 @@ static void GetRandomData(char **buf, int bufSize)
...
@@ -52,12 +52,12 @@ static void GetRandomData(char **buf, int bufSize)
char
*
p
=
*
buf
;
char
*
p
=
*
buf
;
int
i
;
int
i
;
srand
(
(
unsigned
)
time
(
0
));
srand
(
static_cast
<
unsigned
>
(
time
(
0
)
));
for
(
i
=
0
;
i
<
bufSize
-
1
;
++
i
)
{
for
(
i
=
0
;
i
<
bufSize
-
1
;
++
i
)
{
int
r
=
GetRandomNumber
(
RANDOM_MAX
);
int
r
=
GetRandomNumber
(
RANDOM_MAX
);
*
(
p
+
i
)
=
(
char
)
r
;
*
(
p
+
i
)
=
static_cast
<
char
>
(
r
)
;
}
}
*
(
p
+
i
)
=
(
char
)
0
;
*
(
p
+
i
)
=
static_cast
<
char
>
(
0
)
;
}
}
static
int
TestCase
(
VOID
)
static
int
TestCase
(
VOID
)
...
@@ -73,36 +73,36 @@ static int TestCase(VOID)
...
@@ -73,36 +73,36 @@ static int TestCase(VOID)
ret
=
posix_spawn
(
&
pid
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawn
(
&
pid
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
childFileName
=
(
char
*
)
1
;
childFileName
=
reinterpret_cast
<
char
*>
(
1
)
;
ret
=
posix_spawn
(
&
pid
,
childFileName
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawn
(
&
pid
,
childFileName
,
NULL
,
NULL
,
NULL
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
childArgv
=
(
char
**
)
1
;
childArgv
=
reinterpret_cast
<
char
**>
(
1
)
;
ret
=
posix_spawn
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
childArgv
,
NULL
);
ret
=
posix_spawn
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
childArgv
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
childEnvp
=
(
char
**
)
1
;
childEnvp
=
reinterpret_cast
<
char
**>
(
1
)
;
ret
=
posix_spawn
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
NULL
,
childEnvp
);
ret
=
posix_spawn
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
NULL
,
childEnvp
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ret
=
posix_spawn
(
&
pid
,
"/bin"
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawn
(
&
pid
,
"/bin"
,
NULL
,
NULL
,
NULL
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
fileName
=
(
char
*
)
malloc
(
FILE_NAME_BYTES
);
fileName
=
static_cast
<
char
*>
(
malloc
(
FILE_NAME_BYTES
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
GetRandomData
(
&
fileName
,
FILE_NAME_BYTES
);
GetRandomData
(
&
fileName
,
FILE_NAME_BYTES
);
ret
=
posix_spawn
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawn
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
free
(
fileName
);
free
(
fileName
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
fileName
=
(
char
*
)
malloc
(
LONG_FILE_NAME_BYTES
);
fileName
=
static_cast
<
char
*>
(
malloc
(
LONG_FILE_NAME_BYTES
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
GetRandomData
(
&
fileName
,
LONG_FILE_NAME_BYTES
);
GetRandomData
(
&
fileName
,
LONG_FILE_NAME_BYTES
);
ret
=
posix_spawn
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawn
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
free
(
fileName
);
free
(
fileName
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENAMETOOLONG
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENAMETOOLONG
,
ret
);
ret
=
posix_spawn
(
&
pid
,
(
char
*
)
INVALID_USER_VADDR
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawn
(
&
pid
,
reinterpret_cast
<
char
*>
(
INVALID_USER_VADDR
),
nullptr
,
nullptr
,
nullptr
,
nullptr
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EFAULT
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EFAULT
,
ret
);
return
0
;
return
0
;
...
...
testsuites/unittest/process/basic/process/full/process_test_064.cpp
浏览文件 @
6ed09bf1
...
@@ -52,12 +52,12 @@ static void GetRandomData(char **buf, int bufSize)
...
@@ -52,12 +52,12 @@ static void GetRandomData(char **buf, int bufSize)
char
*
p
=
*
buf
;
char
*
p
=
*
buf
;
int
i
;
int
i
;
srand
(
(
unsigned
)
time
(
0
));
srand
(
static_cast
<
unsigned
>
(
time
(
0
)
));
for
(
i
=
0
;
i
<
bufSize
-
1
;
++
i
)
{
for
(
i
=
0
;
i
<
bufSize
-
1
;
++
i
)
{
int
r
=
GetRandomNumber
(
RANDOM_MAX
);
int
r
=
GetRandomNumber
(
RANDOM_MAX
);
*
(
p
+
i
)
=
(
char
)
r
;
*
(
p
+
i
)
=
static_cast
<
char
>
(
r
)
;
}
}
*
(
p
+
i
)
=
(
char
)
0
;
*
(
p
+
i
)
=
static_cast
<
char
>
(
0
)
;
}
}
static
int
TestCase
(
VOID
)
static
int
TestCase
(
VOID
)
...
@@ -70,25 +70,25 @@ static int TestCase(VOID)
...
@@ -70,25 +70,25 @@ static int TestCase(VOID)
char
**
childArgv
=
NULL
;
char
**
childArgv
=
NULL
;
char
**
childEnvp
=
NULL
;
char
**
childEnvp
=
NULL
;
childArgv
=
(
char
**
)
1
;
childArgv
=
reinterpret_cast
<
char
**>
(
1
)
;
ret
=
posix_spawnp
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
childArgv
,
NULL
);
ret
=
posix_spawnp
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
childArgv
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
childEnvp
=
(
char
**
)
1
;
childEnvp
=
reinterpret_cast
<
char
**>
(
1
)
;
ret
=
posix_spawnp
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
NULL
,
childEnvp
);
ret
=
posix_spawnp
(
&
pid
,
"/usr/bin/testsuits_app"
,
NULL
,
NULL
,
NULL
,
childEnvp
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
EINVAL
,
ret
);
ret
=
posix_spawnp
(
&
pid
,
"/bin"
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawnp
(
&
pid
,
"/bin"
,
NULL
,
NULL
,
NULL
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
fileName
=
(
char
*
)
malloc
(
FILE_NAME_BYTES
);
fileName
=
static_cast
<
char
*>
(
malloc
(
FILE_NAME_BYTES
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
GetRandomData
(
&
fileName
,
FILE_NAME_BYTES
);
GetRandomData
(
&
fileName
,
FILE_NAME_BYTES
);
ret
=
posix_spawnp
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawnp
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
free
(
fileName
);
free
(
fileName
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
ENOENT
,
ret
);
fileName
=
(
char
*
)
malloc
(
LONG_FILE_NAME_BYTES
);
fileName
=
static_cast
<
char
*>
(
malloc
(
LONG_FILE_NAME_BYTES
)
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
ICUNIT_ASSERT_NOT_EQUAL
(
fileName
,
NULL
,
fileName
);
GetRandomData
(
&
fileName
,
LONG_FILE_NAME_BYTES
);
GetRandomData
(
&
fileName
,
LONG_FILE_NAME_BYTES
);
ret
=
posix_spawnp
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
posix_spawnp
(
&
pid
,
fileName
,
NULL
,
NULL
,
NULL
,
NULL
);
...
...
testsuites/unittest/process/basic/process/it_test_process.h
浏览文件 @
6ed09bf1
...
@@ -40,11 +40,11 @@
...
@@ -40,11 +40,11 @@
static
inline
int
Syscall
(
int
nbr
,
int
parm1
,
int
parm2
,
int
parm3
,
int
parm4
)
static
inline
int
Syscall
(
int
nbr
,
int
parm1
,
int
parm2
,
int
parm3
,
int
parm4
)
{
{
register
int
reg7
__asm__
(
"r7"
)
=
(
int
)(
nbr
)
;
register
int
reg7
__asm__
(
"r7"
)
=
nbr
;
register
int
reg3
__asm__
(
"r3"
)
=
(
int
)(
parm4
)
;
register
int
reg3
__asm__
(
"r3"
)
=
parm4
;
register
int
reg2
__asm__
(
"r2"
)
=
(
int
)(
parm3
)
;
register
int
reg2
__asm__
(
"r2"
)
=
parm3
;
register
int
reg1
__asm__
(
"r1"
)
=
(
int
)(
parm2
)
;
register
int
reg1
__asm__
(
"r1"
)
=
parm2
;
register
int
reg0
__asm__
(
"r0"
)
=
(
int
)(
parm1
)
;
register
int
reg0
__asm__
(
"r0"
)
=
parm1
;
__asm__
__volatile__
(
"svc 0"
:
"=r"
(
reg0
)
:
"r"
(
reg7
),
"r"
(
reg0
),
"r"
(
reg1
),
"r"
(
reg2
),
"r"
(
reg3
)
:
"memory"
);
__asm__
__volatile__
(
"svc 0"
:
"=r"
(
reg0
)
:
"r"
(
reg7
),
"r"
(
reg0
),
"r"
(
reg1
),
"r"
(
reg2
),
"r"
(
reg3
)
:
"memory"
);
...
...
testsuites/unittest/process/basic/process/smoke/process_test_023.cpp
浏览文件 @
6ed09bf1
...
@@ -46,7 +46,7 @@ static void *ThreadFunc(void *arg)
...
@@ -46,7 +46,7 @@ static void *ThreadFunc(void *arg)
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
g_thread002
,
0
,
g_thread002
);
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
g_thread002
,
0
,
g_thread002
);
g_thread001
++
;
g_thread001
++
;
return
(
void
*
)
9
;
// 9, set thread return value.
return
reinterpret_cast
<
void
*>
(
9
)
;
// 9, set thread return value.
EXIT:
EXIT:
return
NULL
;
return
NULL
;
}
}
...
@@ -61,7 +61,7 @@ static void *ThreadFunc2(void *arg)
...
@@ -61,7 +61,7 @@ static void *ThreadFunc2(void *arg)
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
g_thread001
,
0
,
g_thread001
);
ICUNIT_ASSERT_NOT_EQUAL_NULL
(
g_thread001
,
0
,
g_thread001
);
return
(
void
*
)
9
;
// 9, set thread return value.
return
reinterpret_cast
<
void
*>
(
9
)
;
// 9, set thread return value.
EXIT:
EXIT:
return
NULL
;
return
NULL
;
}
}
...
...
testsuites/unittest/process/basic/pthread/full/pthread_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -71,7 +71,7 @@ static void *ThreadFunc4(void *arg)
...
@@ -71,7 +71,7 @@ static void *ThreadFunc4(void *arg)
ret
=
pthread_cancel
(
pthread
);
ret
=
pthread_cancel
(
pthread
);
}
}
}
}
return
(
void
*
)
i
;
return
reinterpret_cast
<
void
*>
(
i
)
;
EXIT:
EXIT:
return
NULL
;
return
NULL
;
...
@@ -100,7 +100,7 @@ static void *ThreadFunc3(void *arg)
...
@@ -100,7 +100,7 @@ static void *ThreadFunc3(void *arg)
}
}
ICUNIT_GOTO_EQUAL
(
i
,
10
,
i
,
EXIT
);
// 10, here assert the result.
ICUNIT_GOTO_EQUAL
(
i
,
10
,
i
,
EXIT
);
// 10, here assert the result.
return
(
void
*
)
i
;
return
reinterpret_cast
<
void
*>
(
i
)
;
EXIT:
EXIT:
return
NULL
;
return
NULL
;
}
}
...
@@ -132,7 +132,7 @@ static void *ThreadFunc6(void *arg)
...
@@ -132,7 +132,7 @@ static void *ThreadFunc6(void *arg)
ICUNIT_GOTO_EQUAL
(
g_pthreadTestCount
,
12
,
g_pthreadTestCount
,
EXIT
);
// 12, here assert the result.
ICUNIT_GOTO_EQUAL
(
g_pthreadTestCount
,
12
,
g_pthreadTestCount
,
EXIT
);
// 12, here assert the result.
g_pthreadTestCount
++
;
// 13
g_pthreadTestCount
++
;
// 13
return
(
void
*
)
pthread_self
(
);
return
reinterpret_cast
<
void
*>
(
pthread_self
()
);
EXIT:
EXIT:
return
NULL
;
return
NULL
;
...
...
testsuites/unittest/process/basic/pthread/full/pthread_test_004.cpp
浏览文件 @
6ed09bf1
...
@@ -163,7 +163,7 @@ static void *ThreadFunc4(void *arg)
...
@@ -163,7 +163,7 @@ static void *ThreadFunc4(void *arg)
ret
=
pthread_cancel
(
pthread
);
ret
=
pthread_cancel
(
pthread
);
}
}
}
}
return
(
void
*
)
i
;
return
reinterpret_cast
<
void
*>
(
i
)
;
EXIT:
EXIT:
return
NULL
;
return
NULL
;
...
@@ -196,7 +196,7 @@ static void *ThreadFunc3(void *arg)
...
@@ -196,7 +196,7 @@ static void *ThreadFunc3(void *arg)
}
}
ICUNIT_GOTO_EQUAL
(
i
,
10
,
i
,
EXIT
);
// 10, here assert the result.
ICUNIT_GOTO_EQUAL
(
i
,
10
,
i
,
EXIT
);
// 10, here assert the result.
return
(
void
*
)
i
;
return
reinterpret_cast
<
void
*>
(
i
)
;
EXIT:
EXIT:
return
NULL
;
return
NULL
;
...
...
testsuites/unittest/process/basic/pthread/it_pthread_test.h
浏览文件 @
6ed09bf1
...
@@ -42,11 +42,11 @@
...
@@ -42,11 +42,11 @@
static
inline
int
Syscall
(
int
nbr
,
int
parm1
,
int
parm2
,
int
parm3
,
int
parm4
)
static
inline
int
Syscall
(
int
nbr
,
int
parm1
,
int
parm2
,
int
parm3
,
int
parm4
)
{
{
register
int
reg7
__asm__
(
"r7"
)
=
(
int
)(
nbr
)
;
register
int
reg7
__asm__
(
"r7"
)
=
nbr
;
register
int
reg3
__asm__
(
"r3"
)
=
(
int
)(
parm4
)
;
register
int
reg3
__asm__
(
"r3"
)
=
parm4
;
register
int
reg2
__asm__
(
"r2"
)
=
(
int
)(
parm3
)
;
register
int
reg2
__asm__
(
"r2"
)
=
parm3
;
register
int
reg1
__asm__
(
"r1"
)
=
(
int
)(
parm2
)
;
register
int
reg1
__asm__
(
"r1"
)
=
parm2
;
register
int
reg0
__asm__
(
"r0"
)
=
(
int
)(
parm1
)
;
register
int
reg0
__asm__
(
"r0"
)
=
parm1
;
__asm__
__volatile__
(
"svc 0"
:
"=r"
(
reg0
)
:
"r"
(
reg7
),
"r"
(
reg0
),
"r"
(
reg1
),
"r"
(
reg2
),
"r"
(
reg3
)
:
"memory"
);
__asm__
__volatile__
(
"svc 0"
:
"=r"
(
reg0
)
:
"r"
(
reg7
),
"r"
(
reg0
),
"r"
(
reg1
),
"r"
(
reg2
),
"r"
(
reg3
)
:
"memory"
);
...
...
testsuites/unittest/process/basic/pthread/smoke/pthread_once_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -44,7 +44,7 @@ static void *Threadfunc(void *parm)
...
@@ -44,7 +44,7 @@ static void *Threadfunc(void *parm)
int
err
;
int
err
;
err
=
pthread_once
(
&
g_onceCtrl
,
InitRoutine
);
err
=
pthread_once
(
&
g_onceCtrl
,
InitRoutine
);
ICUNIT_GOTO_EQUAL
(
err
,
0
,
err
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
err
,
0
,
err
,
EXIT
);
return
(
void
*
)
g_okStatus
;
return
reinterpret_cast
<
void
*>
(
g_okStatus
)
;
EXIT:
EXIT:
return
NULL
;
return
NULL
;
}
}
...
...
testsuites/unittest/process/basic/pthread/smoke/pthread_test_019.cpp
浏览文件 @
6ed09bf1
...
@@ -77,7 +77,7 @@ static int GroupProcess(void)
...
@@ -77,7 +77,7 @@ static int GroupProcess(void)
stackSize
=
3000
;
// 3000, change stackSize, test again.
stackSize
=
3000
;
// 3000, change stackSize, test again.
pthread_attr_init
(
&
attr
);
pthread_attr_init
(
&
attr
);
stack
=
(
void
*
)
0x1000
;
stack
=
reinterpret_cast
<
void
*>
(
0x1000
)
;
ret
=
pthread_attr_setstack
(
&
attr
,
stack
,
stackSize
);
ret
=
pthread_attr_setstack
(
&
attr
,
stack
,
stackSize
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
...
testsuites/unittest/process/lock/rwlock/full/pthread_rwlock_test_002.cpp
浏览文件 @
6ed09bf1
...
@@ -227,7 +227,7 @@ static int PthreadRwlockTest(void)
...
@@ -227,7 +227,7 @@ static int PthreadRwlockTest(void)
int
index
=
0
;
int
index
=
0
;
int
curThreadPri
,
curThreadPolicy
;
int
curThreadPri
,
curThreadPolicy
;
ret
=
memset_s
(
(
void
*
)
g_rwlockData
,
sizeof
(
int
)
*
TEST_DATA_SIZE
,
0
,
sizeof
(
int
)
*
TEST_DATA_SIZE
);
ret
=
memset_s
(
static_cast
<
void
*>
(
g_rwlockData
)
,
sizeof
(
int
)
*
TEST_DATA_SIZE
,
0
,
sizeof
(
int
)
*
TEST_DATA_SIZE
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
g_rwlockMask
=
0
;
g_rwlockMask
=
0
;
...
...
testsuites/unittest/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -227,7 +227,7 @@ static int Testcase(void)
...
@@ -227,7 +227,7 @@ static int Testcase(void)
int
index
=
0
;
int
index
=
0
;
int
curThreadPri
,
curThreadPolicy
;
int
curThreadPri
,
curThreadPolicy
;
ret
=
memset_s
(
(
void
*
)
g_rwlockData
,
sizeof
(
int
)
*
TEST_DATA_SIZE
,
0
,
sizeof
(
int
)
*
TEST_DATA_SIZE
);
ret
=
memset_s
(
static_cast
<
void
*>
(
g_rwlockData
)
,
sizeof
(
int
)
*
TEST_DATA_SIZE
,
0
,
sizeof
(
int
)
*
TEST_DATA_SIZE
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
g_rwlockMask
=
0
;
g_rwlockMask
=
0
;
...
...
testsuites/unittest/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -134,7 +134,7 @@ static int Testcase(void)
...
@@ -134,7 +134,7 @@ static int Testcase(void)
int
index
=
0
;
int
index
=
0
;
int
curThreadPri
,
curThreadPolicy
;
int
curThreadPri
,
curThreadPolicy
;
ret
=
memset_s
(
(
void
*
)
g_spinlockData
,
sizeof
(
int
)
*
TEST_DATA_SIZE
,
0
,
sizeof
(
int
)
*
TEST_DATA_SIZE
);
ret
=
memset_s
(
static_cast
<
void
*>
(
g_spinlockData
)
,
sizeof
(
int
)
*
TEST_DATA_SIZE
,
0
,
sizeof
(
int
)
*
TEST_DATA_SIZE
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
g_spinlockMask
=
0
;
g_spinlockMask
=
0
;
...
...
testsuites/unittest/security/reugid/smoke/reugid_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -51,10 +51,11 @@ static int Child1(int *list, int listSize)
...
@@ -51,10 +51,11 @@ static int Child1(int *list, int listSize)
egid
=
getegid
();
egid
=
getegid
();
ICUNIT_ASSERT_EQUAL
(
egid
,
300
,
egid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
300
,
egid
);
ret
=
getresgid
((
gid_t
*
)
&
ruid
,
(
gid_t
*
)
&
euid
,
(
gid_t
*
)
&
suid
);
ret
=
getresgid
(
reinterpret_cast
<
gid_t
*>
(
&
ruid
),
reinterpret_cast
<
gid_t
*>
(
&
euid
),
reinterpret_cast
<
gid_t
*>
(
&
suid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
300
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
300
,
ruid
);
// 300: expected ruid
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
// 300: expected euid
ICUNIT_ASSERT_EQUAL
(
suid
,
300
,
suid
);
ICUNIT_ASSERT_EQUAL
(
suid
,
300
,
suid
);
ruid
=
getuid
();
ruid
=
getuid
();
...
@@ -62,29 +63,30 @@ static int Child1(int *list, int listSize)
...
@@ -62,29 +63,30 @@ static int Child1(int *list, int listSize)
euid
=
geteuid
();
euid
=
geteuid
();
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
ret
=
getresuid
((
gid_t
*
)
&
ruid
,
(
gid_t
*
)
&
euid
,
(
gid_t
*
)
&
suid
);
ret
=
getresuid
(
reinterpret_cast
<
gid_t
*>
(
&
ruid
),
reinterpret_cast
<
gid_t
*>
(
&
euid
),
reinterpret_cast
<
gid_t
*>
(
&
suid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
300
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
300
,
ruid
);
// 300: expected ruid
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
ICUNIT_ASSERT_EQUAL
(
suid
,
300
,
suid
);
ICUNIT_ASSERT_EQUAL
(
suid
,
300
,
suid
);
int
size
=
getgroups
(
0
,
(
gid_t
*
)
getList
);
int
size
=
getgroups
(
0
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
size
,
listSize
,
size
);
ICUNIT_ASSERT_EQUAL
(
size
,
listSize
,
size
);
size
=
getgroups
(
size
,
(
gid_t
*
)
getList
);
size
=
getgroups
(
size
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
size
,
listSize
,
size
);
ICUNIT_ASSERT_EQUAL
(
size
,
listSize
,
size
);
for
(
int
i
=
0
;
i
<
size
-
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
size
-
1
;
i
++
)
{
ICUNIT_ASSERT_EQUAL
(
getList
[
i
],
list
[
i
],
getList
[
i
]);
ICUNIT_ASSERT_EQUAL
(
getList
[
i
],
list
[
i
],
getList
[
i
]);
}
}
getList
[
size
-
1
]
=
500
;
getList
[
size
-
1
]
=
500
;
ret
=
setgroups
(
0
,
(
gid_t
*
)
getList
);
ret
=
setgroups
(
0
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getgroups
(
0
,
NULL
);
ret
=
getgroups
(
0
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ret
=
getgroups
(
ret
,
(
gid_t
*
)
getList
);
ret
=
getgroups
(
ret
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
getList
[
0
],
getgid
(),
getList
[
0
]);
ICUNIT_ASSERT_EQUAL
(
getList
[
0
],
getgid
(),
getList
[
0
]);
...
@@ -109,7 +111,7 @@ static int Child(void)
...
@@ -109,7 +111,7 @@ static int Child(void)
ret
=
getgid
();
ret
=
getgid
();
ICUNIT_ASSERT_EQUAL
(
ret
,
3000
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
3000
,
ret
);
ret
=
getegid
();
ret
=
getegid
();
ICUNIT_ASSERT_EQUAL
(
ret
,
3000
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
3000
,
ret
);
// 3000: expected egid
ret
=
setegid
(
3000
);
ret
=
setegid
(
3000
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
@@ -125,50 +127,50 @@ static int Child(void)
...
@@ -125,50 +127,50 @@ static int Child(void)
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
list
[
0
]
=
1000
;
list
[
0
]
=
1000
;
// 1000: preset value of list[0]
list
[
1
]
=
2000
;
list
[
1
]
=
2000
;
// 2000: preset value of list[1]
list
[
2
]
=
3000
;
list
[
2
]
=
3000
;
// 3000: preset value of list[2]
list
[
3
]
=
4000
;
list
[
3
]
=
4000
;
// 4000: preset value of list[3]
list
[
4
]
=
5000
;
list
[
4
]
=
5000
;
// 5000: preset value of list[4]
ret
=
setgroups
(
5
,
(
gid_t
*
)
list
);
ret
=
setgroups
(
5
,
reinterpret_cast
<
gid_t
*>
(
list
));
// 5: set groupid for testing
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
size
=
getgroups
(
0
,
(
gid_t
*
)
getList
);
size
=
getgroups
(
0
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
size
,
5
,
size
);
ICUNIT_ASSERT_EQUAL
(
size
,
5
,
size
);
size
=
getgroups
(
size
,
(
gid_t
*
)
getList
);
size
=
getgroups
(
size
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
size
,
5
,
size
);
ICUNIT_ASSERT_EQUAL
(
size
,
5
,
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
ICUNIT_ASSERT_EQUAL
(
getList
[
i
],
list
[
i
],
getList
[
i
]);
ICUNIT_ASSERT_EQUAL
(
getList
[
i
],
list
[
i
],
getList
[
i
]);
}
}
list
[
0
]
=
1000
;
list
[
0
]
=
1000
;
// 1000: preset value of list[0]
list
[
1
]
=
2000
;
list
[
1
]
=
2000
;
// 2000: preset value of list[1]
list
[
2
]
=
6000
;
list
[
2
]
=
6000
;
// 6000: preset value of list[2]
list
[
3
]
=
4000
;
list
[
3
]
=
4000
;
// 4000: preset value of list[3]
list
[
4
]
=
5000
;
list
[
4
]
=
5000
;
// 5000: preset value of list[4]
list
[
5
]
=
-
1
;
list
[
5
]
=
-
1
;
ret
=
setgroups
(
6
,
(
gid_t
*
)
list
);
ret
=
setgroups
(
6
,
reinterpret_cast
<
gid_t
*>
(
list
));
// 6: set groupid for testing
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
list
[
0
]
=
1000
;
list
[
0
]
=
1000
;
// 1000: preset value of list[0]
list
[
1
]
=
2000
;
list
[
1
]
=
2000
;
// 2000: preset value of list[1]
list
[
2
]
=
6000
;
list
[
2
]
=
6000
;
// 6000: preset value of list[2]
list
[
3
]
=
4000
;
list
[
3
]
=
4000
;
// 4000: preset value of list[3]
list
[
4
]
=
5000
;
list
[
4
]
=
5000
;
// 5000: preset value of list[4]
list
[
5
]
=
7000
;
list
[
5
]
=
7000
;
ret
=
setgroups
(
6
,
(
gid_t
*
)
list
);
ret
=
setgroups
(
6
,
reinterpret_cast
<
gid_t
*>
(
list
));
// 6: set groupid for testing
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
size
=
getgroups
(
0
,
(
gid_t
*
)
getList
);
size
=
getgroups
(
0
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
size
,
7
,
size
);
ICUNIT_ASSERT_EQUAL
(
size
,
7
,
size
);
size
=
getgroups
(
0
,
NULL
);
size
=
getgroups
(
0
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
size
,
7
,
size
);
ICUNIT_ASSERT_EQUAL
(
size
,
7
,
size
);
size
=
getgroups
(
size
,
(
gid_t
*
)
getList
);
size
=
getgroups
(
size
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
size
,
7
,
size
);
ICUNIT_ASSERT_EQUAL
(
size
,
7
,
size
);
for
(
int
i
=
0
;
i
<
size
-
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
size
-
1
;
i
++
)
{
ICUNIT_ASSERT_EQUAL
(
getList
[
i
],
list
[
i
],
getList
[
i
]);
ICUNIT_ASSERT_EQUAL
(
getList
[
i
],
list
[
i
],
getList
[
i
]);
...
@@ -180,7 +182,7 @@ static int Child(void)
...
@@ -180,7 +182,7 @@ static int Child(void)
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
geteuid
();
ret
=
geteuid
();
ICUNIT_ASSERT_EQUAL
(
ret
,
8000
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
8000
,
ret
);
// 8000: expected value of euid
ret
=
setuid
(
2000
);
ret
=
setuid
(
2000
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
...
@@ -203,16 +205,16 @@ static int Child(void)
...
@@ -203,16 +205,16 @@ static int Child(void)
ret
=
setregid
(
5000
,
5000
);
ret
=
setregid
(
5000
,
5000
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getgid
();
ret
=
getgid
();
ICUNIT_ASSERT_EQUAL
(
ret
,
5000
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
5000
,
ret
);
// 5000: expected value of gid
egid
=
getegid
();
egid
=
getegid
();
ICUNIT_ASSERT_EQUAL
(
egid
,
5000
,
egid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
5000
,
egid
);
// 5000: expected value of egid
ret
=
setregid
(
5000
,
-
1
);
ret
=
setregid
(
5000
,
-
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getgid
();
ret
=
getgid
();
ICUNIT_ASSERT_EQUAL
(
ret
,
5000
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
5000
,
ret
);
// 5000: expected value of gid
egid
=
getegid
();
egid
=
getegid
();
ICUNIT_ASSERT_EQUAL
(
egid
,
5000
,
egid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
5000
,
egid
);
// 5000: expected value of egid
ret
=
setregid
(
3000
,
-
2
);
ret
=
setregid
(
3000
,
-
2
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
...
@@ -225,9 +227,9 @@ static int Child(void)
...
@@ -225,9 +227,9 @@ static int Child(void)
ret
=
setregid
(
3000
,
-
1
);
ret
=
setregid
(
3000
,
-
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getgid
();
ret
=
getgid
();
ICUNIT_ASSERT_EQUAL
(
ret
,
3000
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
3000
,
ret
);
// 3000: expected value of gid
egid
=
getegid
();
egid
=
getegid
();
ICUNIT_ASSERT_EQUAL
(
egid
,
3000
,
egid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
3000
,
egid
);
// 3000: expected value of egid
ret
=
setreuid
(
1000
,
3000
);
ret
=
setreuid
(
1000
,
3000
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
...
@@ -244,23 +246,24 @@ static int Child(void)
...
@@ -244,23 +246,24 @@ static int Child(void)
ret
=
setreuid
(
-
1
,
3000
);
ret
=
setreuid
(
-
1
,
3000
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ruid
=
getuid
();
ruid
=
getuid
();
ICUNIT_ASSERT_EQUAL
(
ruid
,
3000
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
3000
,
ruid
);
// 3000: expected value of ruid
euid
=
geteuid
();
euid
=
geteuid
();
ICUNIT_ASSERT_EQUAL
(
euid
,
3000
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
3000
,
euid
);
// 3000: expected value of euid
ret
=
setreuid
(
1000
,
-
1
);
ret
=
setreuid
(
1000
,
-
1
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ruid
=
getuid
();
ruid
=
getuid
();
ICUNIT_ASSERT_EQUAL
(
ruid
,
1000
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
1000
,
ruid
);
// 1000: expected value of ruid
euid
=
geteuid
();
euid
=
geteuid
();
ICUNIT_ASSERT_EQUAL
(
euid
,
1000
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
1000
,
euid
);
// 1000: expected value of euid
ret
=
setresuid
(
100
,
100
,
100
);
ret
=
setresuid
(
100
,
100
,
100
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getresuid
((
uid_t
*
)
&
ruid
,
(
uid_t
*
)
&
euid
,
(
uid_t
*
)
&
suid
);
ret
=
getresuid
(
reinterpret_cast
<
uid_t
*>
(
&
ruid
),
reinterpret_cast
<
uid_t
*>
(
&
euid
),
reinterpret_cast
<
uid_t
*>
(
&
suid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
100
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
100
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
100
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
100
,
euid
);
// 100: expected value of euid
ICUNIT_ASSERT_EQUAL
(
suid
,
100
,
suid
);
ICUNIT_ASSERT_EQUAL
(
suid
,
100
,
suid
);
ret
=
setresuid
(
200
,
100
,
100
);
ret
=
setresuid
(
200
,
100
,
100
);
...
@@ -277,18 +280,20 @@ static int Child(void)
...
@@ -277,18 +280,20 @@ static int Child(void)
ret
=
setresuid
(
-
1
,
200
,
200
);
ret
=
setresuid
(
-
1
,
200
,
200
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getresuid
((
uid_t
*
)
&
ruid
,
(
uid_t
*
)
&
euid
,
(
uid_t
*
)
&
suid
);
ret
=
getresuid
(
reinterpret_cast
<
uid_t
*>
(
&
ruid
),
reinterpret_cast
<
uid_t
*>
(
&
euid
),
reinterpret_cast
<
uid_t
*>
(
&
suid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
200
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
200
,
ruid
);
// 200: expected value of ruid
ICUNIT_ASSERT_EQUAL
(
euid
,
200
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
200
,
euid
);
ICUNIT_ASSERT_EQUAL
(
suid
,
200
,
suid
);
ICUNIT_ASSERT_EQUAL
(
suid
,
200
,
suid
);
ret
=
setresuid
(
-
1
,
-
1
,
300
);
ret
=
setresuid
(
-
1
,
-
1
,
300
);
// set saved-set user id to 300
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getresuid
((
uid_t
*
)
&
ruid
,
(
uid_t
*
)
&
euid
,
(
uid_t
*
)
&
suid
);
ret
=
getresuid
(
reinterpret_cast
<
uid_t
*>
(
&
ruid
),
reinterpret_cast
<
uid_t
*>
(
&
euid
),
reinterpret_cast
<
uid_t
*>
(
&
suid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
300
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
ruid
,
300
,
ruid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
ICUNIT_ASSERT_EQUAL
(
euid
,
300
,
euid
);
// 300: expected value of euid
ICUNIT_ASSERT_EQUAL
(
suid
,
300
,
suid
);
ICUNIT_ASSERT_EQUAL
(
suid
,
300
,
suid
);
ret
=
setresuid
(
-
1
,
200
,
300
);
ret
=
setresuid
(
-
1
,
200
,
300
);
...
@@ -309,13 +314,14 @@ static int Child(void)
...
@@ -309,13 +314,14 @@ static int Child(void)
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ret
=
setresgid
(
100
,
100
,
100
);
ret
=
setresgid
(
100
,
100
,
100
);
// 100: value of rgid, egid and sgid
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getresgid
((
gid_t
*
)
&
rgid
,
(
gid_t
*
)
&
egid
,
(
gid_t
*
)
&
sgid
);
ret
=
getresgid
(
reinterpret_cast
<
gid_t
*>
(
&
rgid
),
reinterpret_cast
<
gid_t
*>
(
&
egid
),
reinterpret_cast
<
gid_t
*>
(
&
sgid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
rgid
,
100
,
rgid
);
ICUNIT_ASSERT_EQUAL
(
rgid
,
100
,
rgid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
100
,
egid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
100
,
egid
);
ICUNIT_ASSERT_EQUAL
(
sgid
,
100
,
sgid
);
ICUNIT_ASSERT_EQUAL
(
sgid
,
100
,
sgid
);
// 100: expected value of sgid
ret
=
setresgid
(
200
,
100
,
100
);
ret
=
setresgid
(
200
,
100
,
100
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
...
@@ -329,29 +335,31 @@ static int Child(void)
...
@@ -329,29 +335,31 @@ static int Child(void)
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EPERM
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EPERM
,
errno
,
errno
);
ret
=
setresgid
(
-
2
,
100
,
200
);
ret
=
setresgid
(
-
2
,
100
,
200
);
// set rgid to -2, egid to 100, sgid to 200
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ret
=
setresgid
(
100
,
-
2
,
200
);
ret
=
setresgid
(
100
,
-
2
,
200
);
// set rgid to 100, egid to -2, sgid to 200
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ret
=
setresgid
(
100
,
100
,
-
2
);
ret
=
setresgid
(
100
,
100
,
-
2
);
// set rgid and egid to 100, rgid to -2
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ret
=
setresgid
(
100
,
-
1
,
-
2
);
ret
=
setresgid
(
100
,
-
1
,
-
2
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EINVAL
,
errno
,
errno
);
ret
=
setresgid
(
-
1
,
200
,
200
);
ret
=
setresgid
(
-
1
,
200
,
200
);
// 200: value of egid and sgid
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getresgid
((
gid_t
*
)
&
rgid
,
(
gid_t
*
)
&
egid
,
(
gid_t
*
)
&
sgid
);
ret
=
getresgid
(
reinterpret_cast
<
gid_t
*>
(
&
rgid
),
reinterpret_cast
<
gid_t
*>
(
&
egid
),
reinterpret_cast
<
gid_t
*>
(
&
sgid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
rgid
,
200
,
rgid
);
ICUNIT_ASSERT_EQUAL
(
rgid
,
200
,
rgid
);
// 200: expected value of rgid
ICUNIT_ASSERT_EQUAL
(
egid
,
200
,
egid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
200
,
egid
);
// 200: expected value of egid
ICUNIT_ASSERT_EQUAL
(
sgid
,
200
,
sgid
);
ICUNIT_ASSERT_EQUAL
(
sgid
,
200
,
sgid
);
// 200: expected value of sgid
ret
=
setresgid
(
-
1
,
-
1
,
300
);
ret
=
setresgid
(
-
1
,
-
1
,
300
);
// set sgid to 300
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getresgid
((
gid_t
*
)
&
rgid
,
(
gid_t
*
)
&
egid
,
(
gid_t
*
)
&
sgid
);
ret
=
getresgid
(
reinterpret_cast
<
gid_t
*>
(
&
rgid
),
reinterpret_cast
<
gid_t
*>
(
&
egid
),
reinterpret_cast
<
gid_t
*>
(
&
sgid
));
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
rgid
,
300
,
rgid
);
ICUNIT_ASSERT_EQUAL
(
rgid
,
300
,
rgid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
300
,
egid
);
ICUNIT_ASSERT_EQUAL
(
egid
,
300
,
egid
);
...
@@ -361,8 +369,8 @@ static int Child(void)
...
@@ -361,8 +369,8 @@ static int Child(void)
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
EPERM
,
errno
,
errno
);
ICUNIT_ASSERT_EQUAL
(
EPERM
,
errno
,
errno
);
size
=
getgroups
(
0
,
(
gid_t
*
)
getList
);
size
=
getgroups
(
0
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
size
=
getgroups
(
size
,
(
gid_t
*
)
getList
);
size
=
getgroups
(
size
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
pid_t
pid
=
fork
();
pid_t
pid
=
fork
();
if
(
pid
==
0
)
{
if
(
pid
==
0
)
{
Child1
(
getList
,
size
);
Child1
(
getList
,
size
);
...
@@ -378,10 +386,10 @@ static int Child(void)
...
@@ -378,10 +386,10 @@ static int Child(void)
ret
=
setgroups
(
0
,
NULL
);
ret
=
setgroups
(
0
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
ret
=
getgroups
(
0
,
(
gid_t
*
)
getList
);
ret
=
getgroups
(
0
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ret
=
getgroups
(
1
,
(
gid_t
*
)
getList
);
ret
=
getgroups
(
1
,
reinterpret_cast
<
gid_t
*>
(
getList
)
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
ret
,
1
,
ret
);
ICUNIT_ASSERT_EQUAL
(
getList
[
0
],
getgid
(),
getList
[
0
]);
ICUNIT_ASSERT_EQUAL
(
getList
[
0
],
getgid
(),
getList
[
0
]);
...
@@ -411,7 +419,7 @@ static int TestCase(VOID)
...
@@ -411,7 +419,7 @@ static int TestCase(VOID)
int
ret
;
int
ret
;
int
status
=
0
;
int
status
=
0
;
pid_t
pid
=
fork
();
pid_t
pid
=
fork
();
ICUNIT_GOTO_WITHIN_EQUAL
(
pid
,
0
,
100000
,
pid
,
EXIT
);
ICUNIT_GOTO_WITHIN_EQUAL
(
pid
,
0
,
100000
,
pid
,
EXIT
);
// assume pid is between 0 and 100000
if
(
pid
==
0
)
{
if
(
pid
==
0
)
{
ret
=
Child
();
ret
=
Child
();
exit
(
__LINE__
);
exit
(
__LINE__
);
...
...
testsuites/unittest/security/vid/smoke/vid_test_001.cpp
浏览文件 @
6ed09bf1
...
@@ -122,7 +122,7 @@ static void ChildFunc()
...
@@ -122,7 +122,7 @@ static void ChildFunc()
ret1
=
(
INT32
*
)
timer_delete
(
tid
);
ret1
=
(
INT32
*
)
timer_delete
(
tid
);
ICUNIT_ASSERT_EQUAL_VOID
(
ret1
,
0
,
ret1
);
ICUNIT_ASSERT_EQUAL_VOID
(
ret1
,
0
,
ret1
);
exit
(
(
int
)(
intptr_t
)
tid
);
exit
(
static_cast
<
int
>
(
reinterpret_cast
<
intptr_t
>
(
tid
))
);
}
}
static
UINT32
TestCase
(
VOID
)
static
UINT32
TestCase
(
VOID
)
...
...
tools/scripts/parse_exc/parse_excinfo.py
浏览文件 @
6ed09bf1
...
@@ -33,8 +33,8 @@
...
@@ -33,8 +33,8 @@
import
sys
import
sys
import
os
import
os
import
argparse
import
argparse
import
commands
import
io
import
io
import
commands
def
find_string
(
excinfo_file
,
string
):
def
find_string
(
excinfo_file
,
string
):
res
=
''
res
=
''
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录