Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
db71ea87
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看板
提交
db71ea87
编写于
3月 30, 2021
作者:
O
openharmony_ci
提交者:
Gitee
3月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
!74 Fix potential segfaults
Merge pull request !74 from Robert Drab/fix/segfaults
上级
e2d438b3
85301638
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
102 addition
and
74 deletion
+102
-74
communication_lite/lwip_posix/src/ActsLwipTest.cpp
communication_lite/lwip_posix/src/ActsLwipTest.cpp
+4
-7
global_lite/datatime_posix/src/UnitDateTimeTest.cpp
global_lite/datatime_posix/src/UnitDateTimeTest.cpp
+3
-3
kernel_lite/fs_posix/src/FsDirentTest.cpp
kernel_lite/fs_posix/src/FsDirentTest.cpp
+11
-11
kernel_lite/fs_posix/src/FsOtherTest.cpp
kernel_lite/fs_posix/src/FsOtherTest.cpp
+4
-4
kernel_lite/fs_posix/src/FsStdioTest.cpp
kernel_lite/fs_posix/src/FsStdioTest.cpp
+14
-14
kernel_lite/fs_posix/src/FsStdlibTest.cpp
kernel_lite/fs_posix/src/FsStdlibTest.cpp
+1
-1
kernel_lite/io_posix/src/IoTestStdio.cpp
kernel_lite/io_posix/src/IoTestStdio.cpp
+10
-6
kernel_lite/mem_posix/src/MemApiTest.cpp
kernel_lite/mem_posix/src/MemApiTest.cpp
+2
-2
kernel_lite/net_posix/src/ActsNetTest.cpp
kernel_lite/net_posix/src/ActsNetTest.cpp
+3
-3
kernel_lite/process_posix/src/ProcessTest.cpp
kernel_lite/process_posix/src/ProcessTest.cpp
+3
-3
kernel_lite/sys_posix/src/SysApiTest.cpp
kernel_lite/sys_posix/src/SysApiTest.cpp
+2
-1
kernel_lite/time_posix/src/ClockTimeTest.cpp
kernel_lite/time_posix/src/ClockTimeTest.cpp
+7
-3
kernel_lite/time_posix/src/TimeUtilsTest.cpp
kernel_lite/time_posix/src/TimeUtilsTest.cpp
+35
-13
multimedia_lite/multimedia_posix/camera/src/ActsMediaCameraTest.cpp
..._lite/multimedia_posix/camera/src/ActsMediaCameraTest.cpp
+3
-3
未找到文件。
communication_lite/lwip_posix/src/ActsLwipTest.cpp
浏览文件 @
db71ea87
...
...
@@ -931,13 +931,10 @@ HWTEST_F(ActsLwipTest, testInetNtopIpv4Normal, Function | MediumTest | Level2)
inputAddr
.
s_addr
=
inputBig
[
i
];
#endif
ret
=
inet_ntop
(
AF_INET
,
&
inputAddr
,
rstBuff
,
sizeof
(
rstBuff
));
if
(
ret
==
nullptr
)
{
EXPECT_TRUE
(
ret
!=
nullptr
)
<<
"ErrInfo:inet_ntop NULL ["
<<
expectAddrs
[
i
]
<<
"]"
;
}
else
{
printf
(
"inet_ntop expect [%s]: ret[%s], buf[%s]
\n
"
,
expectAddrs
[
i
],
ret
,
rstBuff
);
EXPECT_STREQ
(
expectAddrs
[
i
],
ret
);
EXPECT_STREQ
(
expectAddrs
[
i
],
rstBuff
);
}
ASSERT_NE
(
ret
,
nullptr
)
<<
"ErrInfo:inet_ntop NULL ["
<<
expectAddrs
[
i
]
<<
"]"
;
printf
(
"inet_ntop expect [%s]: ret[%s], buf[%s]
\n
"
,
expectAddrs
[
i
],
ret
,
rstBuff
);
EXPECT_STREQ
(
expectAddrs
[
i
],
ret
);
EXPECT_STREQ
(
expectAddrs
[
i
],
rstBuff
);
}
}
...
...
global_lite/datatime_posix/src/UnitDateTimeTest.cpp
浏览文件 @
db71ea87
...
...
@@ -78,7 +78,7 @@ HWTEST_P(DateTimeTest, GLOBAL_DateTimeFormat_Format_0100, Function | MediumTest
int
length
=
sizeof
(
patternFormats
)
/
sizeof
(
patternFormats
[
0
]);
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
DateTimeFormat
*
datetime
=
new
DateTimeFormat
(
patternFormats
[
i
],
localeInfo
);
EXPEC
T_TRUE
(
datetime
!=
nullptr
);
ASSER
T_TRUE
(
datetime
!=
nullptr
);
time_t
cal
=
3600
*
3
+
3600
*
24
*
6
;
I18nStatus
status
=
I18nStatus
::
ISUCCESS
;
string
appendTo
=
""
;
...
...
@@ -108,7 +108,7 @@ HWTEST_P(DateTimeTest, GLOBAL_DateTimeFormat_Format_0200, Function | MediumTest
int
length
=
sizeof
(
patternFormats
)
/
sizeof
(
patternFormats
[
0
]);
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
DateTimeFormat
*
datetime
=
new
DateTimeFormat
(
patternFormats
[
i
],
localeInfo
);
EXPEC
T_TRUE
(
datetime
!=
nullptr
);
ASSER
T_TRUE
(
datetime
!=
nullptr
);
time_t
cal
=
3600
*
3
+
3600
*
24
*
6
;
I18nStatus
status
=
I18nStatus
::
ISUCCESS
;
string
appendTo
=
""
;
...
...
@@ -138,7 +138,7 @@ HWTEST_P(DateTimeTest, GLOBAL_DateTimeFormat_Format_0300, Function | MediumTest
int
length
=
sizeof
(
patternFormats
)
/
sizeof
(
patternFormats
[
0
]);
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
DateTimeFormat
*
datetime
=
new
DateTimeFormat
(
patternFormats
[
i
],
localeInfo
);
EXPEC
T_TRUE
(
datetime
!=
nullptr
);
ASSER
T_TRUE
(
datetime
!=
nullptr
);
time_t
cal
=
3600
*
3
+
3600
*
24
*
6
;
I18nStatus
status
=
I18nStatus
::
ISUCCESS
;
string
appendTo
=
""
;
...
...
kernel_lite/fs_posix/src/FsDirentTest.cpp
浏览文件 @
db71ea87
...
...
@@ -48,7 +48,7 @@ HWTEST_F(FileSystemTest, testReaddir, Function | MediumTest | Level3)
CreateTestFolder
();
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
EXPEC
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
ASSER
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
// Prevents infinite loops.
dResult
=
readdir
(
dirp
);
if
(
dResult
==
nullptr
)
{
...
...
@@ -83,7 +83,7 @@ HWTEST_F(FileSystemTest, testReaddirEbadf, Function | MediumTest | Level3)
CreateTestFolder
();
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
EXPEC
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
ASSER
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
EXPECT_EQ
(
closedir
(
dirp
),
0
)
<<
"> closedir errno = "
<<
errno
;
dResult
=
readdir
(
dirp
);
...
...
@@ -106,7 +106,7 @@ HWTEST_F(FileSystemTest, testReaddirR, Function | MediumTest | Level3)
CreateTestFolder
();
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
EXPEC
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
ASSER
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
// Prevents infinite loops.
if
((
readdir_r
(
dirp
,
&
dEntry
,
&
dResult
))
!=
0
)
{
break
;
...
...
@@ -174,24 +174,24 @@ HWTEST_F(FileSystemTest, testSeekdir, Function | MediumTest | Level3)
CreateTestFolder
();
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
EXPEC
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
ASSER
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
dResult
=
readdir
(
dirp
);
EXPEC
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
ASSER
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
EXPECT_EQ
(
telldir
(
dirp
),
dResult
->
d_off
);
LOG
(
"> dResult->d_name = %s"
,
dResult
->
d_name
);
LOG
(
"> dResult->d_off = %lu"
,
dResult
->
d_off
);
long
tellDir0
=
dResult
->
d_off
;
dResult
=
readdir
(
dirp
);
EXPEC
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
ASSER
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
EXPECT_EQ
(
telldir
(
dirp
),
dResult
->
d_off
);
LOG
(
"> dResult->d_name = %s"
,
dResult
->
d_name
);
LOG
(
"> dResult->d_off = %lu"
,
dResult
->
d_off
);
long
tellDir1
=
dResult
->
d_off
;
dResult
=
readdir
(
dirp
);
EXPEC
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
ASSER
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
LOG
(
"> 111"
);
EXPECT_EQ
(
telldir
(
dirp
),
dResult
->
d_off
);
LOG
(
"> 222"
);
...
...
@@ -201,7 +201,7 @@ HWTEST_F(FileSystemTest, testSeekdir, Function | MediumTest | Level3)
rewinddir
(
dirp
);
dResult
=
readdir
(
dirp
);
EXPEC
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
ASSER
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
EXPECT_EQ
(
telldir
(
dirp
),
dResult
->
d_off
);
EXPECT_EQ
(
telldir
(
dirp
),
tellDir0
);
LOG
(
"> dResult->d_name = %s"
,
dResult
->
d_name
);
...
...
@@ -209,7 +209,7 @@ HWTEST_F(FileSystemTest, testSeekdir, Function | MediumTest | Level3)
seekdir
(
dirp
,
tellDir1
);
dResult
=
readdir
(
dirp
);
EXPEC
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
ASSER
T_FALSE
(
dResult
==
nullptr
)
<<
"> readdir errno = "
<<
errno
;
EXPECT_EQ
(
telldir
(
dirp
),
dResult
->
d_off
);
EXPECT_EQ
(
telldir
(
dirp
),
tellDir2
);
LOG
(
"> dResult->d_name = %s"
,
dResult
->
d_name
);
...
...
@@ -231,7 +231,7 @@ HWTEST_F(FileSystemTest, testOpendir, Function | MediumTest | Level2)
errno
=
0
;
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
EXPEC
T_NE
(
dirp
,
nullptr
);
ASSER
T_NE
(
dirp
,
nullptr
);
EXPECT_EQ
(
errno
,
0
);
EXPECT_EQ
(
closedir
(
dirp
),
0
)
<<
"> closedir errno = "
<<
errno
;
}
...
...
@@ -326,6 +326,6 @@ HWTEST_F(FileSystemTest, testClosedir, Function | MediumTest | Level3)
CreateTestFolder
();
dirp
=
opendir
(
TOP_DIR
"/"
DIR0
);
EXPEC
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
ASSER
T_NE
(
dirp
,
nullptr
)
<<
"> opendir errno = "
<<
errno
;
EXPECT_EQ
(
closedir
(
dirp
),
0
)
<<
"> closedir errno = "
<<
errno
;
}
kernel_lite/fs_posix/src/FsOtherTest.cpp
浏览文件 @
db71ea87
...
...
@@ -53,7 +53,7 @@ HWTEST_F(FileSystemTest, testPath, Function | MediumTest | Level1)
// get dir
char
*
workDir
=
dirname
((
char
*
)
FILE0
);
EXPEC
T_NE
(
workDir
,
nullptr
)
<<
"> dirname errno = "
<<
errno
;
ASSER
T_NE
(
workDir
,
nullptr
)
<<
"> dirname errno = "
<<
errno
;
EXPECT_STREQ
(
"."
,
workDir
);
LOG
(
"> workDir = %s"
,
workDir
);
}
...
...
@@ -73,7 +73,7 @@ HWTEST_F(FileSystemTest, testGetCurrentDirName, Function | MediumTest | Level1)
// get current dir name
const
char
*
currentDirStandard
=
TOP_DIR
;
char
*
currentDir
=
get_current_dir_name
();
EXPEC
T_NE
(
currentDir
,
nullptr
);
ASSER
T_NE
(
currentDir
,
nullptr
);
EXPECT_STREQ
(
currentDir
,
currentDirStandard
);
LOG
(
"> currentDir = %s"
,
currentDir
);
}
...
...
@@ -92,7 +92,7 @@ HWTEST_F(FileSystemTest, testBasename, Function | MediumTest | Level1)
// get file name
char
*
desName
=
basename
((
char
*
)
FILE0
);
EXPEC
T_NE
(
desName
,
nullptr
)
<<
"> basename errno = "
<<
errno
;
ASSER
T_NE
(
desName
,
nullptr
)
<<
"> basename errno = "
<<
errno
;
EXPECT_STREQ
(
desName
,
FILE0
);
LOG
(
"> desName = %s"
,
desName
);
}
...
...
@@ -271,7 +271,7 @@ HWTEST_F(FileSystemTest, testFwprintf, Function | MediumTest | Level3)
// read
fp
=
fopen
(
filePath
,
"r"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_NE
(
fgetws
(
readBuf
,
30
,
fp
),
nullptr
)
<<
"fgetws error"
;
EXPECT_TRUE
(
wcscmp
(
writeBuf
,
readBuf
)
==
0
)
<<
"writeBuf != readBuf"
;
EXPECT_NE
(
fclose
(
fp
),
-
1
)
<<
"> fclose errno ="
<<
errno
;
...
...
kernel_lite/fs_posix/src/FsStdioTest.cpp
浏览文件 @
db71ea87
...
...
@@ -51,13 +51,13 @@ HWTEST_F(FileSystemTest, testFILE, Function | MediumTest | Level2)
EXPECT_NE
(
fd
,
-
1
)
<<
"> creat faild errno = "
<<
errno
;
EXPECT_NE
(
close
(
fd
),
-
1
)
<<
"> close errno = "
<<
errno
;
fp
=
fopen
(
FILE0
,
"w+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_EQ
(
fwrite
(
writeBuf
,
sizeof
(
writeBuf
),
1
,
fp
),
1
)
<<
"> fwrite errno = "
<<
errno
;
EXPECT_NE
(
fclose
(
fp
),
-
1
)
<<
"> fclose errno ="
<<
errno
;
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_NE
(
fread
(
readBuf
,
sizeof
(
writeBuf
),
1
,
fp
),
0
)
<<
"> fread errno = "
<<
errno
;
EXPECT_STREQ
(
writeBuf
,
readBuf
)
<<
"> writeBuf = "
<<
writeBuf
<<
"
\n
> readBuf = "
<<
readBuf
;
EXPECT_NE
(
fclose
(
fp
),
-
1
)
<<
"> fclose errno ="
<<
errno
;
...
...
@@ -82,7 +82,7 @@ HWTEST_F(FileSystemTest, testFeof, Function | MediumTest | Level3)
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_EQ
(
fseeko
(
fp
,
0
,
SEEK_SET
),
0
)
<<
"> fseeko errno = "
<<
errno
;
fgetc
(
fp
);
...
...
@@ -115,7 +115,7 @@ HWTEST_F(FileSystemTest, testFseek, Function | MediumTest | Level3)
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
fpos_t
offset
;
EXPECT_EQ
(
fgetpos
(
fp
,
&
offset
),
0
)
<<
"> fgetpos errno = "
<<
errno
;
...
...
@@ -148,7 +148,7 @@ HWTEST_F(FileSystemTest, testFseekSeekCur, Function | MediumTest | Level3)
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
fpos_t
offset
;
EXPECT_EQ
(
fgetpos
(
fp
,
&
offset
),
0
)
<<
"> fgetpos errno = "
<<
errno
;
...
...
@@ -181,7 +181,7 @@ HWTEST_F(FileSystemTest, testFseekSeekEnd, Function | MediumTest | Level3)
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
fpos_t
offset
;
EXPECT_EQ
(
fgetpos
(
fp
,
&
offset
),
0
)
<<
"> fgetpos errno = "
<<
errno
;
...
...
@@ -214,7 +214,7 @@ HWTEST_F(FileSystemTest, testFseeko, Function | MediumTest | Level3)
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_EQ
(
fseeko
(
fp
,
2
,
SEEK_SET
),
0
)
<<
"> fseeko errno = "
<<
errno
;
EXPECT_EQ
(
ftello
(
fp
),
2
)
<<
" errno = "
<<
errno
;
...
...
@@ -245,7 +245,7 @@ HWTEST_F(FileSystemTest, testFseekoSeekCur, Function | MediumTest | Level3)
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_EQ
(
fseeko
(
fp
,
2
,
SEEK_CUR
),
0
)
<<
"> fseeko errno = "
<<
errno
;
EXPECT_EQ
(
ftello
(
fp
),
2
)
<<
" errno = "
<<
errno
;
...
...
@@ -276,7 +276,7 @@ HWTEST_F(FileSystemTest, testFseekoSeekEnd, Function | MediumTest | Level3)
// read
fp
=
fopen
(
FILE0
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_EQ
(
fseeko
(
fp
,
0
,
SEEK_END
),
0
)
<<
"> fseeko errno = "
<<
errno
;
EXPECT_EQ
(
ftello
(
fp
),
sizeof
(
writeBuf
))
<<
" errno = "
<<
errno
;
...
...
@@ -315,7 +315,7 @@ HWTEST_F(FileSystemTest, testFunlockfile, Function | MediumTest | Level3)
CreateTestFolder
();
FILE
*
fp
=
fopen
(
filePath
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
pthread_t
tid
;
int
reInt
=
pthread_create
(
&
tid
,
nullptr
,
ChildWrite
,
(
void
*
)
fp
);
...
...
@@ -351,7 +351,7 @@ HWTEST_F(FileSystemTest, testFileno, Function | MediumTest | Level2)
ASSERT_NE
(
close
(
fd
),
-
1
)
<<
"> close errno = "
<<
errno
;
fp
=
fopen
(
filePath
,
"w+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
fd
=
fileno
(
fp
);
EXPECT_NE
(
fd
,
-
1
)
<<
"> fileno errno = "
<<
errno
;
WriteCloseTest
(
fd
);
...
...
@@ -380,7 +380,7 @@ HWTEST_F(FileSystemTest, testFileno1, Function | MediumTest | Level2)
// read
fp
=
fopen
(
filePath
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
fd
=
fileno
(
fp
);
EXPECT_NE
(
fd
,
-
1
)
<<
"> fileno errno = "
<<
errno
;
...
...
@@ -458,14 +458,14 @@ HWTEST_F(FileSystemTest, testFflush, Function | MediumTest | Level3)
}
Msleep
(
50
);
FILE
*
fp
=
fopen
(
filePath
,
"r"
);
EXPEC
T_NE
(
fp
,
nullptr
);
ASSER
T_NE
(
fp
,
nullptr
);
EXPECT_EQ
(
fseek
(
fp
,
0
,
SEEK_END
),
0
)
<<
"> fseek errno = "
<<
errno
;
EXPECT_EQ
(
ftell
(
fp
),
0
);
EXPECT_NE
(
fclose
(
fp
),
-
1
)
<<
"> fclose errno ="
<<
errno
;
Msleep
(
100
);
fp
=
fopen
(
filePath
,
"r"
);
EXPEC
T_NE
(
fp
,
nullptr
);
ASSER
T_NE
(
fp
,
nullptr
);
EXPECT_NE
(
fread
(
readBuf
,
sizeof
(
writeBuf
),
1
,
fp
),
0
)
<<
"> fread errno = "
<<
errno
;
EXPECT_STREQ
(
readBuf
,
writeBuf
);
LOG
(
"> readBuf = %s"
,
readBuf
);
...
...
kernel_lite/fs_posix/src/FsStdlibTest.cpp
浏览文件 @
db71ea87
...
...
@@ -120,7 +120,7 @@ HWTEST_F(FileSystemTest, testRealpath, Function | MediumTest | Level3)
// get Absolute Path
const
char
*
realPathStandard
=
TOP_DIR
"/"
FILE0
;
char
*
realPath
=
(
char
*
)
malloc
(
256
);
EXPEC
T_NE
(
realpath
(
FILE0
,
realPath
),
nullptr
)
<<
"> realpath errno = "
<<
errno
;
ASSER
T_NE
(
realpath
(
FILE0
,
realPath
),
nullptr
)
<<
"> realpath errno = "
<<
errno
;
EXPECT_STREQ
(
realPath
,
realPathStandard
);
LOG
(
"> realPath = %s"
,
realPath
);
free
(
realPath
);
...
...
kernel_lite/io_posix/src/IoTestStdio.cpp
浏览文件 @
db71ea87
...
...
@@ -606,7 +606,7 @@ HWTEST_F(IoTest, testPerror, Function | MediumTest | Level1)
WaitProcExitedOK
(
pid
);
FILE
*
fp1
=
fopen
(
IOTEST_TEMPFILE
,
"r"
);
EXPEC
T_NE
(
fp1
,
nullptr
)
<<
"fopen fail, errno = "
<<
errno
;
ASSER
T_NE
(
fp1
,
nullptr
)
<<
"fopen fail, errno = "
<<
errno
;
char
str
[
100
]
=
{
0
};
char
*
gStr
=
fgets
(
str
,
sizeof
(
str
),
fp1
);
EXPECT_STREQ
(
gStr
,
str
);
...
...
@@ -737,15 +737,19 @@ void *Thread(void *arg)
{
FILE
*
fp
=
fopen
(
IOTEST_TEMPFILE
,
"w"
);
EXPECT_NE
(
fp
,
nullptr
)
<<
"fopen fail, errno = "
<<
errno
;
EXPECT_NE
(
fputs
(
"hello world"
,
fp
),
-
1
)
<<
"fputs fail, errno = "
<<
errno
;
EXPECT_NE
(
fclose
(
fp
),
-
1
)
<<
"fclose fail, errno = "
<<
errno
;
if
(
fp
)
{
EXPECT_NE
(
fputs
(
"hello world"
,
fp
),
-
1
)
<<
"fputs fail, errno = "
<<
errno
;
EXPECT_NE
(
fclose
(
fp
),
-
1
)
<<
"fclose fail, errno = "
<<
errno
;
}
FILE
*
fp1
=
freopen
(
IOTEST_TEMPFILE
,
"r"
,
stdin
);
EXPECT_TRUE
(
fp1
!=
nullptr
)
<<
"freopen fail, errno = "
<<
errno
;
if
(
getchar_unlocked
()
!=
EOF
)
{
EXPECT_NE
(
getchar_unlocked
(),
-
1
)
<<
"getchar_unlocked fail, errno = "
<<
errno
;
if
(
fp1
)
{
if
(
getchar_unlocked
()
!=
EOF
)
{
EXPECT_NE
(
getchar_unlocked
(),
-
1
)
<<
"getchar_unlocked fail, errno = "
<<
errno
;
}
EXPECT_NE
(
fclose
(
fp1
),
-
1
)
<<
"fclose fail, errno = "
<<
errno
;
}
EXPECT_NE
(
fclose
(
fp1
),
-
1
)
<<
"fclose fail, errno = "
<<
errno
;
return
nullptr
;
}
...
...
kernel_lite/mem_posix/src/MemApiTest.cpp
浏览文件 @
db71ea87
...
...
@@ -132,7 +132,7 @@ HWTEST_F(MemApiTest, testReallocMem, Function | MediumTest | Level3)
memset
(
mem
,
testChar
,
mlen
);
rlen
=
GetRandom
(
0x200000
);
mem
=
realloc
(
mem
,
rlen
);
EXPEC
T_TRUE
(
mem
!=
nullptr
)
<<
"mem == NULL, i = "
<<
i
;
ASSER
T_TRUE
(
mem
!=
nullptr
)
<<
"mem == NULL, i = "
<<
i
;
len
=
mlen
<=
rlen
?
mlen
:
rlen
;
...
...
@@ -558,7 +558,7 @@ HWTEST_F(MemApiTest, testOpenMemstreamBase, Function | MediumTest | Level2)
FILE
*
stream
=
open_memstream
(
&
buf
,
&
len
);
ASSERT_TRUE
(
stream
!=
nullptr
)
<<
"stream == nullptr"
;
EXPEC
T_TRUE
(
buf
!=
nullptr
&&
len
==
0
)
<<
"buf == nullptr or len != 0"
;
ASSER
T_TRUE
(
buf
!=
nullptr
&&
len
==
0
)
<<
"buf == nullptr or len != 0"
;
fprintf
(
stream
,
wBuf
);
fflush
(
stream
);
...
...
kernel_lite/net_posix/src/ActsNetTest.cpp
浏览文件 @
db71ea87
...
...
@@ -1367,7 +1367,7 @@ HWTEST_F(ActsNetTest, testEtherConvertNormal, Function | MediumTest | Level2)
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
atonRst
=
nullptr
;
atonRst
=
ether_aton
(
addrHex
[
i
]);
EXPEC
T_TRUE
(
atonRst
!=
nullptr
);
ASSER
T_TRUE
(
atonRst
!=
nullptr
);
int
ret
=
sprintf_s
(
atonByteRst
,
sizeof
(
atonByteRst
),
"%u.%u.%u.%u.%u.%u"
,
atonRst
->
ether_addr_octet
[
0
],
atonRst
->
ether_addr_octet
[
1
],
atonRst
->
ether_addr_octet
[
2
],
atonRst
->
ether_addr_octet
[
3
],
...
...
@@ -1406,13 +1406,13 @@ HWTEST_F(ActsNetTest, testEtherConvertNormalWithThreadSafe, Function | MediumTes
char
*
ntoaPointRst
=
nullptr
;
struct
ether_addr
*
atonPointRst
=
nullptr
;
struct
ether_addr
*
atonDataRst
=
(
ether_addr
*
)
malloc
(
sizeof
(
ether_addr
));
EXPEC
T_TRUE
(
atonDataRst
!=
nullptr
);
ASSER
T_TRUE
(
atonDataRst
!=
nullptr
);
char
addrHex
[
3
][
18
]
=
{
"FF:FF:FF:FF:FF:FF"
,
"00:00:00:00:00:00"
,
"5F:4E:2C:3D:1B:0A"
};
char
addrByte
[
3
][
24
]
=
{
"255.255.255.255.255.255"
,
"0.0.0.0.0.0"
,
"95.78.44.61.27.10"
};
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
atonPointRst
=
nullptr
;
atonPointRst
=
ether_aton_r
(
addrHex
[
i
],
atonDataRst
);
EXPEC
T_TRUE
(
atonPointRst
!=
nullptr
);
ASSER
T_TRUE
(
atonPointRst
!=
nullptr
);
char
byteRst
[
24
];
ret
=
sprintf_s
(
byteRst
,
sizeof
(
byteRst
),
"%u.%u.%u.%u.%u.%u"
,
atonDataRst
->
ether_addr_octet
[
0
],
atonDataRst
->
ether_addr_octet
[
1
],
...
...
kernel_lite/process_posix/src/ProcessTest.cpp
浏览文件 @
db71ea87
...
...
@@ -85,7 +85,7 @@ HWTEST_F(ProcessTest, testLineBigExitFlush, Function | MediumTest | Level3)
// read
FILE
*
fp
=
fopen
(
testFile
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_EQ
(
fread
(
readBuf
,
sizeof
(
writeBuf
),
1
,
fp
),
0
);
EXPECT_STRNE
(
writeBuf
,
readBuf
)
<<
"> writeBuf = "
<<
writeBuf
\
<<
"
\n
> readBuf = "
<<
readBuf
;
...
...
@@ -195,7 +195,7 @@ HWTEST_F(ProcessTest, testLineExitFlush, Function | MediumTest | Level3)
// read
FILE
*
fp
=
fopen
(
testFile
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_EQ
(
fread
(
readBuf
,
sizeof
(
writeBuf
),
1
,
fp
),
0
);
EXPECT_STRNE
(
writeBuf
,
readBuf
)
<<
"> writeBuf = "
<<
writeBuf
\
<<
"
\n
> readBuf = "
<<
readBuf
;
...
...
@@ -305,7 +305,7 @@ HWTEST_F(ProcessTest, testExitFlush, Function | MediumTest | Level3)
// read
FILE
*
fp
=
fopen
(
testFile
,
"r+"
);
EXPEC
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
ASSER
T_NE
(
fp
,
nullptr
)
<<
"> fopen errno = "
<<
errno
;
EXPECT_NE
(
fread
(
readBuf
,
sizeof
(
writeBuf
),
1
,
fp
),
0
);
EXPECT_STREQ
(
writeBuf
,
readBuf
)
<<
"> writeBuf = "
<<
writeBuf
\
<<
"
\n
> readBuf = "
<<
readBuf
;
...
...
kernel_lite/sys_posix/src/SysApiTest.cpp
浏览文件 @
db71ea87
...
...
@@ -550,7 +550,8 @@ void VerrxLog(const char *format, ...)
void
CheckStdPrint
(
const
char
*
res
)
{
FILE
*
fp1
=
fopen
(
SYS_TEST_FILE_01
,
"r"
);
EXPECT_FALSE
(
fp1
==
nullptr
)
<<
"fopen fail, errno = "
<<
errno
;
ASSERT_FALSE
(
fp1
==
nullptr
)
<<
"fopen fail, errno = "
<<
errno
;
char
str
[
100
]
=
{
0
};
char
*
gStr
=
fgets
(
str
,
sizeof
(
str
),
fp1
);
printf
(
"gStr = %s
\n
"
,
gStr
);
...
...
kernel_lite/time_posix/src/ClockTimeTest.cpp
浏览文件 @
db71ea87
...
...
@@ -323,9 +323,11 @@ HWTEST_F(ClockTimeTest, testLocaltime, Function | MediumTest | Level1) {
EXPECT_EQ
(
0
,
ret
);
struct
tm
*
tmStart
=
localtime
(
&
tStart
);
ASSERT_NE
(
nullptr
,
tmStart
);
strftime
(
cTime
,
sizeof
(
cTime
),
"%H:%M:%S"
,
tmStart
);
EXPECT_STREQ
(
"23:59:59"
,
cTime
);
struct
tm
*
tmEnd
=
localtime
(
&
tEnd
);
ASSERT_NE
(
nullptr
,
tmEnd
);
strftime
(
cTime
,
sizeof
(
cTime
),
"%H:%M:%S"
,
tmEnd
);
EXPECT_STREQ
(
"00:00:01"
,
cTime
);
}
...
...
@@ -348,7 +350,9 @@ HWTEST_F(ClockTimeTest, testLocaltimer, Function | MediumTest | Level1) {
sleep
(
1
);
time
(
&
tEnd
);
struct
tm
*
tmrStartPtr
=
localtime_r
(
&
tStart
,
&
tmrStart
);
ASSERT_NE
(
nullptr
,
tmrStartPtr
);
struct
tm
*
tmrEndPtr
=
localtime_r
(
&
tEnd
,
&
tmrEnd
);
ASSERT_NE
(
nullptr
,
tmrEndPtr
);
EXPECT_EQ
(
0
,
ret
);
strftime
(
cTime
,
sizeof
(
cTime
),
"%H:%M:%S"
,
&
tmrStart
);
...
...
@@ -373,7 +377,7 @@ HWTEST_F(ClockTimeTest, testGetdateBasic, Function | MediumTest | Level1) {
FILE
*
fp
=
nullptr
;
char
mask
[
20
]
=
"%Y-%m-%d %H:%M:%S"
;
fp
=
fopen
(
DATEMSK_FILE
,
"w+"
);
EXPEC
T_NE
(
nullptr
,
fp
);
ASSER
T_NE
(
nullptr
,
fp
);
int
ret
=
fwrite
(
mask
,
sizeof
(
mask
),
1
,
fp
);
EXPECT_TRUE
(
ret
>
0
);
ret
=
setenv
(
"DATEMSK"
,
DATEMSK_FILE
,
1
);
...
...
@@ -386,7 +390,7 @@ HWTEST_F(ClockTimeTest, testGetdateBasic, Function | MediumTest | Level1) {
struct
tm
*
retTm
=
nullptr
;
const
char
*
cInput
=
"2020-10-26 00:01:01"
;
retTm
=
getdate
(
cInput
);
EXPEC
T_NE
(
nullptr
,
retTm
)
<<
" getdate fail errno:"
<<
getdate_err
;
ASSER
T_NE
(
nullptr
,
retTm
)
<<
" getdate fail errno:"
<<
getdate_err
;
strftime
(
cTime
,
sizeof
(
cTime
),
mask
,
retTm
);
EXPECT_STREQ
(
cInput
,
cTime
);
strftime
(
cTime
,
sizeof
(
cTime
),
"%D %A %H:%M:%S"
,
retTm
);
...
...
@@ -423,7 +427,7 @@ HWTEST_F(ClockTimeTest, testGetdateError, Function | MediumTest | Level2) {
FILE
*
fp
=
nullptr
;
char
mask
[
10
]
=
"%H:%M:%S"
;
fp
=
fopen
(
DATEMSK_FILE
,
"w+"
);
EXPEC
T_NE
(
nullptr
,
fp
);
ASSER
T_NE
(
nullptr
,
fp
);
ret
=
fwrite
(
mask
,
sizeof
(
mask
),
1
,
fp
);
EXPECT_TRUE
(
ret
>
0
);
ret
=
fclose
(
fp
);
...
...
kernel_lite/time_posix/src/TimeUtilsTest.cpp
浏览文件 @
db71ea87
...
...
@@ -175,19 +175,23 @@ HWTEST_F(TimeUtilsTest, testGmtime, Function | MediumTest | Level3)
{
time_t
time1
=
18880
;
struct
tm
*
stm
=
gmtime
(
&
time1
);
ASSERT_NE
(
nullptr
,
stm
);
EXPECT_EQ
(
stm
->
tm_hour
,
05
)
<<
"gmtime return error!"
;
EXPECT_STREQ
(
asctime
(
stm
),
"Thu Jan 1 05:14:40 1970
\n
"
)
<<
"gmtime return error!"
;
time1
=
LONG_MAX
;
stm
=
gmtime
(
&
time1
);
ASSERT_NE
(
nullptr
,
stm
);
EXPECT_STREQ
(
asctime
(
stm
),
"Tue Jan 19 03:14:07 2038
\n
"
)
<<
"gmtime return error!"
;
time1
=
253402300799
;
stm
=
gmtime
(
&
time1
);
ASSERT_NE
(
nullptr
,
stm
);
EXPECT_STREQ
(
asctime
(
stm
),
"Fri Dec 31 23:59:59 9999
\n
"
)
<<
"gmtime return error!"
;
time1
=
LONG_MIN
;
stm
=
gmtime
(
&
time1
);
ASSERT_NE
(
nullptr
,
stm
);
EXPECT_STREQ
(
asctime
(
stm
),
"Fri Dec 13 20:45:52 1901
\n
"
)
<<
"gmtime return error!"
;
}
...
...
@@ -200,6 +204,7 @@ HWTEST_F(TimeUtilsTest, testGmtimeR, Function | MediumTest | Level3)
{
struct
tm
res
=
{
0
};
struct
tm
*
stm
=
gmtime_r
(
&
g_time
,
&
res
);
ASSERT_NE
(
nullptr
,
stm
);
EXPECT_EQ
(
stm
->
tm_hour
,
05
)
<<
"gmtime_r return error!"
;
EXPECT_STREQ
(
asctime
(
stm
),
"Thu Jan 1 05:14:40 1970
\n
"
)
<<
"gmtime_r return error!"
;
EXPECT_TRUE
(
stm
==
&
res
)
<<
"gmtime_r returns not equal"
;
...
...
@@ -207,6 +212,7 @@ HWTEST_F(TimeUtilsTest, testGmtimeR, Function | MediumTest | Level3)
time_t
timeNow
;
time
(
&
timeNow
);
stm
=
gmtime_r
(
&
timeNow
,
&
res
);
ASSERT_NE
(
nullptr
,
stm
);
EXPECT_EQ
(
stm
->
tm_year
,
70
)
<<
"gmtime_r return error!"
;
EXPECT_STRNE
(
asctime
(
stm
),
""
)
<<
"gmtime_r return error!"
;
EXPECT_TRUE
(
stm
==
&
res
)
<<
"gmtime_r returns not equal"
;
...
...
@@ -219,6 +225,7 @@ HWTEST_F(TimeUtilsTest, testGmtimeR, Function | MediumTest | Level3)
*/
HWTEST_F
(
TimeUtilsTest
,
testMktime
,
Function
|
MediumTest
|
Level2
)
{
struct
tm
*
localTime
;
struct
tm
timeptr
=
{
0
};
timeptr
.
tm_sec
=
0
;
timeptr
.
tm_min
=
10
;
...
...
@@ -229,7 +236,9 @@ HWTEST_F(TimeUtilsTest, testMktime, Function | MediumTest | Level2)
timeptr
.
tm_wday
=
7
;
EXPECT_EQ
(
mktime
(
&
timeptr
),
1596967800
)
<<
"mktime return error!"
;
time_t
timep
=
mktime
(
localtime
(
&
g_time
));
localTime
=
localtime
(
&
g_time
);
ASSERT_NE
(
nullptr
,
localTime
);
time_t
timep
=
mktime
(
localTime
);
EXPECT_EQ
(
timep
,
18880
)
<<
"mktime return error!"
;
}
...
...
@@ -240,25 +249,33 @@ HWTEST_F(TimeUtilsTest, testMktime, Function | MediumTest | Level2)
*/
HWTEST_F
(
TimeUtilsTest
,
testStrftime
,
Function
|
MediumTest
|
Level3
)
{
char
buffer
[
32
]
;
char
buffer
[
80
]
=
{
0
}
;
time_t
mtime
=
18880
;
size_t
ftime
=
strftime
(
buffer
,
80
,
"%Ex %EX %A"
,
localtime
(
&
mtime
));
struct
tm
*
localTime
=
localtime
(
&
mtime
);
ASSERT_NE
(
nullptr
,
localTime
);
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!"
;
mtime
=
LONG_MAX
;
ftime
=
strftime
(
buffer
,
80
,
"%y-%m-%d %H:%M:%S"
,
localtime
(
&
mtime
));
localTime
=
localtime
(
&
mtime
);
ASSERT_NE
(
nullptr
,
localTime
);
ftime
=
strftime
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%y-%m-%d %H:%M:%S"
,
localTime
);
EXPECT_STREQ
(
buffer
,
"38-01-19 03:14:07"
)
<<
"buffer return error!"
;
mtime
=
253402300799
;
ftime
=
strftime
(
buffer
,
80
,
"%Y-%m-%d %H:%M:%S"
,
localtime
(
&
mtime
));
localTime
=
localtime
(
&
mtime
);
ASSERT_NE
(
nullptr
,
localTime
);
ftime
=
strftime
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%Y-%m-%d %H:%M:%S"
,
localTime
);
EXPECT_STREQ
(
buffer
,
"9999-12-31 23:59:59"
)
<<
"buffer return error!"
;
mtime
=
LONG_MIN
;
ftime
=
strftime
(
buffer
,
80
,
"%x %X"
,
localtime
(
&
mtime
));
localTime
=
localtime
(
&
mtime
);
ASSERT_NE
(
nullptr
,
localTime
);
ftime
=
strftime
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%x %X"
,
localTime
);
EXPECT_STREQ
(
buffer
,
"12/13/01 20:45:52"
)
<<
"buffer return error!"
;
ftime
=
strftime
(
buffer
,
11
,
"%Y-%m-%d %H:%M:%S"
,
localtime
(
&
mtime
)
);
ftime
=
strftime
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%Y-%m-%d %H:%M:%S"
,
localTime
);
EXPECT_EQ
(
ftime
,
g_zero
)
<<
"strftime return error!"
;
EXPECT_STREQ
(
buffer
,
"1901-12-13"
)
<<
"buffer return error!"
;
}
...
...
@@ -271,10 +288,11 @@ HWTEST_F(TimeUtilsTest, testStrftime, Function | MediumTest | Level3)
HWTEST_F
(
TimeUtilsTest
,
testStrftimeL
,
Function
|
MediumTest
|
Level2
)
{
struct
tm
*
tm1
;
char
buffer
[
32
]
;
char
buffer
[
80
]
=
{
0
}
;
tm1
=
localtime
(
&
g_time
);
size_t
ftime
=
strftime_l
(
buffer
,
80
,
"%F %T %Z"
,
tm1
,
(
locale_t
)
0
);
ASSERT_NE
(
nullptr
,
tm1
);
size_t
ftime
=
strftime_l
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%F %T %Z"
,
tm1
,
nullptr
);
EXPECT_GT
(
ftime
,
g_zero
)
<<
"strftime return error!"
;
EXPECT_STREQ
(
buffer
,
"1970-01-01 05:14:40 UTC"
)
<<
"buffer return error!"
;
}
...
...
@@ -286,14 +304,18 @@ HWTEST_F(TimeUtilsTest, testStrftimeL, Function | MediumTest | Level2)
*/
HWTEST_F
(
TimeUtilsTest
,
testWcsftime
,
Function
|
MediumTest
|
Level2
)
{
wchar_t
buff
[
48
];
size_t
len
=
wcsftime
(
buff
,
sizeof
(
buff
),
L"%A %c"
,
localtime
(
&
g_time
));
wchar_t
buff
[
48
]
=
{
0
};
struct
tm
*
localTime
=
localtime
(
&
g_time
);
ASSERT_NE
(
nullptr
,
localTime
);
size_t
len
=
wcsftime
(
buff
,
sizeof
(
buff
)
-
1
,
L"%A %c"
,
localTime
);
LOG
(
"buff = %ls, len = %ld
\n
"
,
buff
,
(
long
)
len
);
EXPECT_EQ
(
len
,
(
size_t
)
33
)
<<
"wcsftime return error!"
;
EXPECT_STREQ
(
buff
,
L"Thursday Thu Jan 1 05:14:40 1970"
)
<<
"buff return error!"
;
len
=
wcsftime
(
buff
,
9
,
L"%A %c"
,
localtime
(
&
g_time
));
localTime
=
localtime
(
&
g_time
);
ASSERT_NE
(
nullptr
,
localTime
);
len
=
wcsftime
(
buff
,
sizeof
(
buff
)
-
1
,
L"%A %c"
,
localTime
);
LOG
(
"buff = %ls, len = %ld
\n
"
,
buff
,
(
long
)
len
);
EXPECT_EQ
(
len
,
g_zero
)
<<
"wcsftime return error!"
;
EXPECT_STREQ
(
buff
,
L"Thursday"
)
<<
"buff return error!"
;
}
\ No newline at end of file
}
multimedia_lite/multimedia_posix/camera/src/ActsMediaCameraTest.cpp
浏览文件 @
db71ea87
...
...
@@ -455,7 +455,7 @@ void GetCameraId(CameraKit *cameraKit, list<string> &camList, string &camId)
for
(
auto
&
cam
:
camList
)
{
cout
<<
"camera name:"
<<
cam
<<
endl
;
const
CameraAbility
*
ability
=
cameraKit
->
GetCameraAbility
(
cam
);
EXPEC
T_NE
(
ability
,
nullptr
);
ASSER
T_NE
(
ability
,
nullptr
);
CameraFlag
::
g_onGetCameraAbilityFlag
=
FLAG1
;
/* find camera which fits user's ability */
list
<
CameraPicSize
>
sizeList
=
ability
->
GetSupportedSizes
(
0
);
...
...
@@ -572,7 +572,7 @@ HWTEST_F(ActsMediaCameraTest, Test_RegisterCameraDeviceCallback, Function | Medi
SampleCameraStateMng
camStateMng
(
eventHdlr
);
SampleCameraDeviceCallback
*
deviceCallback
=
nullptr
;
deviceCallback
=
new
SampleCameraDeviceCallback
();
EXPEC
T_NE
(
nullptr
,
deviceCallback
);
ASSER
T_NE
(
nullptr
,
deviceCallback
);
cameraKit
->
RegisterCameraDeviceCallback
(
*
deviceCallback
,
eventHdlr
);
sleep
(
1
);
EXPECT_EQ
(
CameraFlag
::
g_onCameraAvailableFlag
,
FLAG1
);
...
...
@@ -596,7 +596,7 @@ HWTEST_F(ActsMediaCameraTest, Test_UnregisterCameraDeviceCallback, Function | Me
SampleCameraStateMng
camStateMng
(
eventHdlr
);
SampleCameraDeviceCallback
*
deviceCallback
=
nullptr
;
deviceCallback
=
new
SampleCameraDeviceCallback
();
EXPEC
T_NE
(
nullptr
,
deviceCallback
);
ASSER
T_NE
(
nullptr
,
deviceCallback
);
cameraKit
->
RegisterCameraDeviceCallback
(
*
deviceCallback
,
eventHdlr
);
sleep
(
1
);
EXPECT_EQ
(
CameraFlag
::
g_onCameraAvailableFlag
,
FLAG1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录