Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
271263b1
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
271263b1
编写于
7月 26, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 26, 2021
浏览文件
操作
浏览文件
下载
差异文件
!352 【kernel_lite】【master】clear security alarm
Merge pull request !352 from 南先森/kernel_lite
上级
3a50aac4
4f1a8443
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
88 addition
and
33 deletion
+88
-33
kernel_lite/fs_posix/src/FsDirentTest.cpp
kernel_lite/fs_posix/src/FsDirentTest.cpp
+8
-2
kernel_lite/fs_posix/src/FsFcntlTest.cpp
kernel_lite/fs_posix/src/FsFcntlTest.cpp
+2
-1
kernel_lite/fs_posix/src/FsStdlibTest.cpp
kernel_lite/fs_posix/src/FsStdlibTest.cpp
+1
-2
kernel_lite/ipc_posix/pipe_fifo/FifoTest.cpp
kernel_lite/ipc_posix/pipe_fifo/FifoTest.cpp
+1
-1
kernel_lite/ipc_posix/shared_memory/ShmTest.cpp
kernel_lite/ipc_posix/shared_memory/ShmTest.cpp
+46
-13
kernel_lite/ipc_posix/signal/SignalTest.cpp
kernel_lite/ipc_posix/signal/SignalTest.cpp
+4
-1
kernel_lite/net_posix/src/ActsNetTest.cpp
kernel_lite/net_posix/src/ActsNetTest.cpp
+10
-4
kernel_lite/time_posix/src/TimeUtilsTest.cpp
kernel_lite/time_posix/src/TimeUtilsTest.cpp
+4
-1
kernel_lite/utils/mt_utils.cpp
kernel_lite/utils/mt_utils.cpp
+12
-8
未找到文件。
kernel_lite/fs_posix/src/FsDirentTest.cpp
浏览文件 @
271263b1
...
...
@@ -231,7 +231,10 @@ HWTEST_F(FileSystemTest, testOpendir, Function | MediumTest | Level2)
errno
=
0
;
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
ASSERT_NE
(
dirp
,
nullptr
);
if
(
dirp
==
nullptr
)
{
LOG
(
"OPENDIR ERRNO +++"
);
ADD_FAILURE
();
}
EXPECT_EQ
(
errno
,
0
);
EXPECT_EQ
(
closedir
(
dirp
),
0
)
<<
"> closedir errno = "
<<
errno
;
}
...
...
@@ -326,6 +329,9 @@ HWTEST_F(FileSystemTest, testClosedir, Function | MediumTest | Level3)
CreateTestFolder
();
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
ASSERT_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
if
(
dirp
==
nullptr
)
{
LOG
(
"opendir errno ++"
);
ADD_FAILURE
();
}
EXPECT_EQ
(
closedir
(
dirp
),
0
)
<<
"> closedir errno = "
<<
errno
;
}
kernel_lite/fs_posix/src/FsFcntlTest.cpp
浏览文件 @
271263b1
...
...
@@ -328,9 +328,10 @@ HWTEST_F(FileSystemTest, testOpenEisdir, Function | MediumTest | Level2)
CreateTestFolder
();
fd
=
open
(
DIR0
,
O_RDWR
,
0777
);
EXPECT_EQ
(
fd
,
-
1
)
<<
"> Should open failed"
;
if
(
fd
!=
-
1
)
{
EXPECT_EQ
(
errno
,
EISDIR
);
close
(
fd
);
}
}
/**
...
...
kernel_lite/fs_posix/src/FsStdlibTest.cpp
浏览文件 @
271263b1
...
...
@@ -119,12 +119,11 @@ HWTEST_F(FileSystemTest, testRealpath, Function | MediumTest | Level3)
// get Absolute Path
const
char
*
realPathStandard
=
TOP_DIR
"/"
FILE0
;
char
*
realPath
=
(
char
*
)
malloc
(
256
);
char
*
realPath
=
(
char
*
)
malloc
(
256
);
if
(
realpath
(
FILE0
,
realPath
)
==
nullptr
)
{
LOG
(
"> realpath errno == %d"
,
errno
);
free
(
realPath
);
ASSERT_TRUE
(
false
);
}
else
{
...
...
kernel_lite/ipc_posix/pipe_fifo/FifoTest.cpp
浏览文件 @
271263b1
...
...
@@ -165,7 +165,7 @@ HWTEST_F(FifoTest, testFifoNonblack, Function | MediumTest | Level1)
HWTEST_F
(
FifoTest
,
testFifoBlock
,
Function
|
MediumTest
|
Level1
)
{
const
int
arrSize
=
MAX_PIPE_BUFFER
+
1000
;
int
fd
;
int
fd
=
-
1
;
int
tmpInt
;
char
testBuffer
[
arrSize
];
memset_s
(
testBuffer
,
sizeof
(
testBuffer
),
'1'
,
sizeof
(
testBuffer
));
...
...
kernel_lite/ipc_posix/shared_memory/ShmTest.cpp
浏览文件 @
271263b1
...
...
@@ -26,7 +26,8 @@
using
namespace
testing
::
ext
;
class
ShmTest
:
public
::
testing
::
Test
{
class
ShmTest
:
public
::
testing
::
Test
{
public:
static
const
char
SHM_TEST_STR
[];
static
const
int
SHM_TEST_STR_LEN
;
...
...
@@ -47,10 +48,15 @@ HWTEST_F(ShmTest, testShmBasic, Function | MediumTest | Level0)
char
*
shared
=
nullptr
;
shmid
=
shmget
(
static_cast
<
key_t
>
IPC_PRIVATE
,
memSize
,
0666
|
IPC_CREAT
);
ASSERT_NE
(
shmid
,
-
1
)
<<
"> parent: shmid errno = "
<<
errno
;
if
(
shmid
==
-
1
)
{
LOG
(
"shmget errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
pid_t
pid
=
fork
();
ASSERT_TRUE
(
pid
>=
0
)
<<
"> parent: fork errno = "
<<
errno
;
if
(
pid
<
0
)
{
LOG
(
"fork errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
if
(
pid
==
0
)
{
int
exitCode
=
0
;
Msleep
(
40
);
...
...
@@ -75,10 +81,15 @@ HWTEST_F(ShmTest, testShmBasic, Function | MediumTest | Level0)
}
// parent
shared
=
static_cast
<
char
*>
(
shmat
(
shmid
,
nullptr
,
0
));
ASSERT_NE
(
shared
,
(
void
*
)
-
1
)
<<
"> parent : error: shmat"
;
if
(
shared
==
(
void
*
)
-
1
)
{
LOG
(
"shmat errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
strncpy
(
shared
,
SHM_TEST_STR
,
SHM_TEST_STR_LEN
);
ASSERT_NE
(
shmdt
(
shared
),
-
1
)
<<
"> parent: error : shmdt"
;
if
(
shmdt
(
shared
)
==
-
1
)
{
LOG
(
"shmdt errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
Msleep
(
50
);
WaitProcExitedOK
(
pid
);
}
...
...
@@ -94,7 +105,10 @@ HWTEST_F(ShmTest, testShmSingleProcess, Function | MediumTest | Level1)
char
*
shared
=
nullptr
;
int
shmid
=
shmget
(
static_cast
<
key_t
>
IPC_PRIVATE
,
memSize
,
0666
|
IPC_CREAT
);
ASSERT_NE
(
shmid
,
-
1
)
<<
"> shmget errno = "
<<
errno
;
if
(
shmid
==
-
1
)
{
LOG
(
"shmget errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
shared
=
static_cast
<
char
*>
(
shmat
(
shmid
,
nullptr
,
0
));
ASSERT_NE
(
shared
,
(
void
*
)
-
1
)
<<
"> shmat errno = "
<<
errno
;
...
...
@@ -167,10 +181,16 @@ HWTEST_F(ShmTest, testShmatSHM_REMAP, Function | MediumTest | Level1)
char
*
shared
=
nullptr
;
shmid
=
shmget
(
static_cast
<
key_t
>
IPC_PRIVATE
,
memSize
,
0666
|
IPC_CREAT
);
ASSERT_NE
(
shmid
,
-
1
)
<<
"> parent: error : shmget"
;
if
(
shmid
==
-
1
)
{
LOG
(
"shmget errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
pid_t
pid
=
fork
();
ASSERT_TRUE
(
pid
>=
0
)
<<
"> parent: error : fork"
;
if
(
shmid
<
0
)
{
LOG
(
"fork errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
if
(
pid
==
0
)
{
Msleep
(
10
);
int
exitCode
=
0
;
...
...
@@ -225,9 +245,15 @@ HWTEST_F(ShmTest, testShmatSHM_RDONLY, Function | MediumTest | Level0)
char
*
shared
=
nullptr
;
shmid
=
shmget
(
IPC_PRIVATE
,
memSize
,
0666
|
IPC_CREAT
);
EXPECT_NE
(
shmid
,
-
1
)
<<
"> parent: shmget errno = "
<<
errno
;
if
(
shmid
==
-
1
)
{
LOG
(
"shmget errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
pid_t
pid
=
fork
();
ASSERT_TRUE
(
pid
>=
0
)
<<
"> parent: fork errno = "
<<
errno
;
if
(
pid
<
0
)
{
LOG
(
"fork errno ,errno = %d"
,
errno
);
ADD_FAILURE
();
}
if
(
pid
==
0
)
{
int
exitCode
=
0
;
Msleep
(
10
);
...
...
@@ -274,6 +300,10 @@ HWTEST_F(ShmTest, testShmatSHM_RND, Function | MediumTest | Level0)
Msleep
(
10
);
shmid
=
shmget
(
IPC_PRIVATE
,
memSize
,
0666
|
IPC_CREAT
);
if
(
shmid
==
-
1
)
{
LOG
(
"shmget failed+++"
);
ADD_FAILURE
();
}
EXPECT_NE
(
shmid
,
-
1
)
<<
"shmget : errno = "
<<
errno
;
shared
=
shmat
(
shmid
,
nullptr
,
0
);
...
...
@@ -310,7 +340,10 @@ HWTEST_F(ShmTest, testShmctl, Function | MediumTest | Level1)
Msleep
(
10
);
shmid
=
shmget
(
IPC_PRIVATE
,
memSize
,
0666
|
IPC_CREAT
);
ASSERT_NE
(
shmid
,
-
1
)
<<
"> shmget : errno = "
<<
errno
;
if
(
shmid
==
-
1
)
{
LOG
(
"shmget errno = %d
\n
"
,
errno
);
ADD_FAILURE
();
}
tmp
=
shmctl
(
shmid
,
IPC_STAT
,
&
shmPerm
);
EXPECT_NE
(
tmp
,
-
1
)
<<
"> shmctl : IPC_STAT1 :erron = "
<<
errno
;
...
...
kernel_lite/ipc_posix/signal/SignalTest.cpp
浏览文件 @
271263b1
...
...
@@ -262,7 +262,10 @@ HWTEST_F(IpcSignalTest, testAbortHandler, Function | MediumTest | Level1)
{
const
int
memSize
=
32
;
mShmid
=
shmget
(
IPC_PRIVATE
,
memSize
,
0666
|
IPC_CREAT
);
ASSERT_NE
(
mShmid
,
-
1
)
<<
"> parent: get share mem if fail, errno = "
<<
errno
;
if
(
mShmid
==
-
1
){
LOG
(
"shmget errno = %d
\n
"
,
errno
);
ADD_FAILURE
();
}
pid_t
pid
=
fork
();
ASSERT_TRUE
(
pid
>=
0
)
<<
"======== Fork Error! ========="
;
...
...
kernel_lite/net_posix/src/ActsNetTest.cpp
浏览文件 @
271263b1
...
...
@@ -356,16 +356,22 @@ static void* SampleTcpClientTask(void *p)
return
nullptr
;
}
static
void
*
TcpServerLoopTask
(
void
*
p
)
static
void
*
TcpServerLoopTask
(
void
*
p
)
{
int
srvFd
=
CommInitTcpServer
(
STACK_PORT
);
EXPECT_NE
(
-
1
,
srvFd
);
if
(
srvFd
==
-
1
)
{
LOG
(
"CommInitTcpServer errno = %d
\n
"
,
errno
);
ADD_FAILURE
();
}
int
i
=
0
;
int
clientFds
[
36
];
struct
sockaddr_in
clnAddr
=
{
0
};
socklen_t
clnAddrLen
=
sizeof
(
clnAddr
);
while
(
i
<
30
)
{
clientFds
[
i
]
=
accept
(
srvFd
,
(
struct
sockaddr
*
)
&
clnAddr
,
&
clnAddrLen
);
while
(
i
<
30
)
{
clientFds
[
i
]
=
accept
(
srvFd
,
(
struct
sockaddr
*
)
&
clnAddr
,
&
clnAddrLen
);
printf
(
"[***---][tcp server loop]accept <%s:%d>, fd[%d]i[%d]
\n
"
,
inet_ntoa
(
clnAddr
.
sin_addr
),
ntohs
(
clnAddr
.
sin_port
),
clientFds
[
i
],
i
);
EXPECT_NE
(
-
1
,
clientFds
[
i
]);
...
...
kernel_lite/time_posix/src/TimeUtilsTest.cpp
浏览文件 @
271263b1
...
...
@@ -253,7 +253,10 @@ HWTEST_F(TimeUtilsTest, testStrftime, Function | MediumTest | Level3)
char
buffer
[
80
]
=
{
0
};
time_t
mtime
=
18880
;
struct
tm
*
localTime
=
localtime
(
&
mtime
);
ASSERT_NE
(
nullptr
,
localTime
);
if
(
localTime
==
nullptr
)
{
LOG
(
"localtime errno "
);
ADD_FAILURE
();
}
size_t
ftime
=
strftime
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%Ex %EX %A"
,
localTime
);
EXPECT_GT
(
ftime
,
g_zero
)
<<
"strftime return error!"
;
EXPECT_STREQ
(
buffer
,
"01/01/70 05:14:40 Thursday"
)
<<
"buffer return error!"
;
...
...
kernel_lite/utils/mt_utils.cpp
浏览文件 @
271263b1
...
...
@@ -35,6 +35,8 @@ uint64_t CheckStep(int value)
shmctl
(
g_shmidCheckStep
,
IPC_RMID
,
nullptr
);
g_shmidCheckStep
=
shmget
(
IPC_PRIVATE
,
1024
,
0666
|
IPC_CREAT
);
}
if
(
g_shmidCheckStep
!=
-
1
)
{
uint64_t
*
shared
=
(
uint64_t
*
)
shmat
(
g_shmidCheckStep
,
nullptr
,
0
);
if
(
value
==
1
)
{
...
...
@@ -44,7 +46,9 @@ uint64_t CheckStep(int value)
}
uint64_t
state
=
*
shared
;
shmdt
(
shared
);
return
state
;
}
}
int
CountPrimes
(
uint32_t
maxNumber
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录