Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
580fabd1
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看板
未验证
提交
580fabd1
编写于
2月 07, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7381 add libuv xts
Merge pull request !7381 from wanglichao/master
上级
00bec899
2a5151c7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
175 addition
and
6 deletion
+175
-6
arkui/libuv/src/ActsLibuvTest.cpp
arkui/libuv/src/ActsLibuvTest.cpp
+175
-6
未找到文件。
arkui/libuv/src/ActsLibuvTest.cpp
浏览文件 @
580fabd1
...
...
@@ -19,11 +19,23 @@
extern
"C"
{
#include "runner.h"
}
#include "uv.h"
typedef
void
(
*
init_plugin_function
)();
namespace
OHOS
{
using
namespace
std
;
using
namespace
testing
::
ext
;
static
const
char
TESTFILE
[]
=
"foo.gz"
;
static
uv_once_t
once_only
=
UV_ONCE_INIT
;
int
i
=
0
;
void
Increment
()
{
i
++
;
}
// Preset action of the test suite, which is executed before the first test case
void
ActsLibuvTest
::
SetUpTestCase
(
void
)
{
...
...
@@ -41,11 +53,168 @@ namespace OHOS {
{
}
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestCase001
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start ActsLibuvTest------
\n
"
);
system
(
"/data/local/tmp/libuvruntest"
);
EXPECT_TRUE
(
true
);
printf
(
"------end ActsLibuvTest------
\n
"
);
/**
* @tc.number : ActsZlibTest_0100
* @tc.name : Test uv_version and uv_version_string test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestUVVersion
,
Function
|
MediumTest
|
Level2
)
{
int
version
=
uv_version
();
ASSERT_EQ
(
version
,
UV_VERSION_HEX
);
fprintf
(
stderr
,
"uv_version error: %d
\n
"
,
version
);
auto
versionString
=
uv_version_string
();
fprintf
(
stderr
,
"uv_version_string error: %s
\n
"
,
versionString
);
int
replaceAllocator
=
uv_replace_allocator
(
nullptr
,
nullptr
,
nullptr
,
nullptr
);
ASSERT_EQ
(
replaceAllocator
,
UV_EINVAL
);
fprintf
(
stderr
,
"uv_replace_allocator error: %d
\n
"
,
replaceAllocator
);
uv_loop_t
*
loop
=
uv_loop_new
();
ASSERT_TRUE
(
loop
!=
nullptr
);
}
/**
* @tc.number : ActsZlibTest_0200
* @tc.name : Test uv_loop_new
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestLoop
,
Function
|
MediumTest
|
Level2
)
{
uv_loop_t
*
newLoop
;
newLoop
=
uv_loop_new
();
ASSERT_TRUE
(
newLoop
!=
NULL
);
uv_loop_delete
(
newLoop
);
ASSERT_TRUE
(
true
);
}
/**
* @tc.number : ActsZlibTest_0300
* @tc.name : Test uv_err_name_r
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestErrName
,
Function
|
MediumTest
|
Level2
)
{
int
err
=
0
;
char
buf
[
40
];
size_t
buflen
=
40
;
char
*
newBuf
=
uv_err_name_r
(
err
,
buf
,
buflen
);
fprintf
(
stderr
,
"uv_err_name_r error: %s
\n
"
,
newBuf
);
ASSERT_STREQ
(
newBuf
,
"Unknown system error 0"
);
}
/**
* @tc.number : ActsZlibTest_0400
* @tc.name : Test uv_req_get_data and uv_req_set_data and uv_req_get_type
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestReqGetData
,
Function
|
MediumTest
|
Level2
)
{
float
f
=
5.5
f
;
float
*
pf
=
&
f
;
uv_req_t
*
req
=
(
uv_req_t
*
)
malloc
(
sizeof
(
uv_req_t
));
uv_req_t
*
setReq
=
(
uv_req_t
*
)
malloc
(
sizeof
(
uv_req_t
));
req
->
data
=
pf
;
req
->
type
=
UV_UNKNOWN_REQ
;
fprintf
(
stderr
,
"uv_req_get_data: %f
\n
"
,
*
(
float
*
)
uv_req_get_data
(
req
));
fprintf
(
stderr
,
"uv_req_get_type: %d
\n
"
,
uv_req_get_type
(
req
));
ASSERT_EQ
(
uv_req_get_data
(
req
),
pf
);
ASSERT_EQ
(
uv_req_get_type
(
req
),
UV_UNKNOWN_REQ
);
uv_req_set_data
(
setReq
,
pf
);
ASSERT_EQ
(
uv_req_get_data
(
setReq
),
pf
);
}
/**
* @tc.number : ActsZlibTest_0500
* @tc.name : Test uv_print_all_handles and uv_print_active_handles
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestPrintHandles
,
Function
|
MediumTest
|
Level2
)
{
uv_loop_t
*
loop
=
nullptr
;
FILE
*
fp
=
fopen
(
TESTFILE
,
"w"
);
uv_print_all_handles
(
loop
,
fp
);
uv_print_active_handles
(
loop
,
fp
);
ASSERT_TRUE
(
true
);
}
/**
* @tc.number : ActsZlibTest_0600
* @tc.name : Test uv_udp_get_send_queue_size and uv_udp_get_send_queue_count
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestUpdSendQueue
,
Function
|
MediumTest
|
Level2
)
{
size_t
size
,
sizeC
;
uv_udp_t
*
handle
=
(
uv_udp_t
*
)
malloc
(
sizeof
(
uv_udp_t
));
handle
->
send_queue_size
=
5
;
handle
->
send_queue_count
=
5
;
size
=
uv_udp_get_send_queue_size
(
handle
);
ASSERT_TRUE
(
size
==
5
);
sizeC
=
uv_udp_get_send_queue_count
(
handle
);
ASSERT_TRUE
(
sizeC
==
5
);
}
/**
* @tc.number : ActsZlibTest_0700
* @tc.name : Test uv_fs_lchown
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestFsLchown
,
Function
|
MediumTest
|
Level2
)
{
int
retC
;
uv_loop_t
loop
;
uv_fs_t
req
;
const
char
*
path
=
"/date/"
;
uv_uid_t
uid
=
10000
;
uv_gid_t
gid
=
2020
;
retC
=
uv_fs_lchown
(
&
loop
,
&
req
,
path
,
uid
,
gid
,
nullptr
);
fprintf
(
stderr
,
"uv_err_name_r error: %d
\n
"
,
retC
);
}
/**
* @tc.number : ActsZlibTest_0800
* @tc.name : Test uv_disable_stdio_inheritance
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestDisableStdioInheritance
,
Function
|
MediumTest
|
Level2
)
{
uv_disable_stdio_inheritance
();
ASSERT_TRUE
(
true
);
}
/**
* @tc.number : ActsZlibTest_0900
* @tc.name : Test uv_dlsym
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestDlsym
,
Function
|
MediumTest
|
Level2
)
{
int
argc
=
3
;
const
char
*
tmp
[]
=
{
"aaaa"
,
"bbbb"
,
"cccc"
};
const
char
**
argv
=
tmp
;
uv_lib_t
*
lib
=
(
uv_lib_t
*
)
malloc
(
sizeof
(
uv_lib_t
));
while
(
--
argc
)
{
uv_dlopen
(
argv
[
argc
],
lib
);
ASSERT_TRUE
(
true
);
init_plugin_function
init_plugin
;
uv_dlsym
(
lib
,
"initialize"
,
(
void
**
)
&
init_plugin
);
ASSERT_TRUE
(
true
);
}
}
/**
* @tc.number : ActsZlibTest_1000
* @tc.name : Test uv_once
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsLibuvTest
,
TestLibuvTestUvOnce
,
Function
|
MediumTest
|
Level2
)
{
uv_once
(
&
once_only
,
Increment
);
ASSERT_TRUE
(
true
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录