Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fa68992e
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看板
未验证
提交
fa68992e
编写于
5月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3328 修改hidebug js xts用例
Merge pull request !3328 from uoengopen/local
上级
d4e1782c
c69434c3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
116 addition
and
29 deletion
+116
-29
hiviewdfx/hicheckertest/hicheckerjstest/src/main/js/default/test/HiChecker.test.js
...icheckerjstest/src/main/js/default/test/HiChecker.test.js
+7
-8
hiviewdfx/hidebugtest/hidebugtestjstest/src/main/js/default/test/Hidebug.test.js
...idebugtestjstest/src/main/js/default/test/Hidebug.test.js
+109
-21
未找到文件。
hiviewdfx/hicheckertest/hicheckerjstest/src/main/js/default/test/HiChecker.test.js
浏览文件 @
fa68992e
...
...
@@ -66,14 +66,13 @@ describe('HiCheckerTest', function () {
it
(
'
HiCheckerTest002
'
,
0
,
function
()
{
console
.
info
(
'
HiCheckerTest002 start
'
);
hichecker
.
addRule
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
);
hichecker
.
addRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
|
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
);
hichecker
.
addRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
);
console
.
log
(
'
add rule success!
'
);
expect
(
hichecker
.
contains
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
)).
assertTrue
();
expect
(
hichecker
.
contains
(
hichecker
.
RULE_CHECK_SLOW_EVENT
)).
assertTrue
();
expect
(
hichecker
.
contains
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
)).
assertTrue
();
expect
(
hichecker
.
contains
(
hichecker
.
RULE_CAUTION_PRINT_LOG
)).
assertTrue
();
expect
(
hichecker
.
contains
(
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
)).
assertTrue
();
let
tmp
=
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
|
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
|
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
);
let
tmp
=
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
|
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
);
expect
(
hichecker
.
getRule
()
==
tmp
).
assertTrue
();
})
...
...
@@ -117,12 +116,12 @@ describe('HiCheckerTest', function () {
it
(
'
HiCheckerTest005
'
,
0
,
function
()
{
console
.
info
(
'
HiCheckerTest005 start
'
);
hichecker
.
addRule
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
);
hichecker
.
addRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
|
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
);
hichecker
.
addRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
);
console
.
log
(
'
add rule success!
'
);
let
tmp
=
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
|
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
);
let
tmp
=
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
);
hichecker
.
removeRule
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
);
expect
(
hichecker
.
getRule
()
==
tmp
).
assertTrue
();
hichecker
.
removeRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
|
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
);
hichecker
.
removeRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
);
expect
(
hichecker
.
getRule
()
==
0
).
assertTrue
();
})
...
...
@@ -134,9 +133,9 @@ describe('HiCheckerTest', function () {
it
(
'
HiCheckerTest006
'
,
0
,
function
()
{
console
.
info
(
'
HiCheckerTest006 start
'
);
hichecker
.
addRule
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
);
hichecker
.
addRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
|
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
);
hichecker
.
addRule
(
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
);
console
.
log
(
'
add rule success!
'
);
let
tmp
=
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
|
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
|
hichecker
.
RULE_CAUTION_TRIGGER_CRASH
);
let
tmp
=
(
hichecker
.
RULE_THREAD_CHECK_SLOW_PROCESS
|
hichecker
.
RULE_CHECK_SLOW_EVENT
|
hichecker
.
RULE_CHECK_ABILITY_CONNECTION_LEAK
|
hichecker
.
RULE_CAUTION_PRINT_LOG
);
hichecker
.
removeRule
(
-
1
);
expect
(
hichecker
.
getRule
()
==
tmp
).
assertTrue
();
hichecker
.
removeRule
(
0
);
...
...
hiviewdfx/hidebugtest/hidebugtestjstest/src/main/js/default/test/Hidebug.test.js
浏览文件 @
fa68992e
...
...
@@ -27,12 +27,11 @@ describe('HidebugJsTest', function () {
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0001 Test start*************
'
);
try
{
let
heapSize
=
hidebug
.
getNativeHeapSize
();
expect
(
heapSize
).
assertEqual
(
BigInt
(
0
)
);
expect
(
heapSize
>=
BigInt
(
0
)).
assertTrue
(
);
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0001 Test end*************
'
);
done
();
});
/*
...
...
@@ -40,16 +39,15 @@ describe('HidebugJsTest', function () {
* @tc.name : getNativeHeapAllocatedSize
* @tc.desc : Get Native heap memory allocation size.
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0002
'
,
0
,
function
(
done
)
{
it
(
'
DFX_DFR_Hiprofiler_Interface_0002
'
,
0
,
function
()
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0002 Test start*************
'
);
try
{
let
heapAllocatedSize
=
hidebug
.
getNativeHeapAllocatedSize
();
expect
(
heapAllocatedSize
).
assertEqual
(
BigInt
(
0
)
);
expect
(
heapAllocatedSize
>=
BigInt
(
0
)).
assertTrue
(
);
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0002 Test end*************
'
);
done
();
});
/*
...
...
@@ -57,16 +55,15 @@ describe('HidebugJsTest', function () {
* @tc.name : getNativeHeapFreeSize
* @tc.desc : Get Native heap memory free size
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0003
'
,
0
,
function
(
done
)
{
it
(
'
DFX_DFR_Hiprofiler_Interface_0003
'
,
0
,
function
()
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0003 Test start*************
'
);
try
{
let
heapFreeSize
=
hidebug
.
getNativeHeapFreeSize
();
expect
(
heapFreeSize
).
assertEqual
(
BigInt
(
0
)
);
expect
(
heapFreeSize
>=
BigInt
(
0
)).
assertTrue
(
);
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0003 Test end*************
'
);
done
();
});
/*
...
...
@@ -122,7 +119,7 @@ describe('HidebugJsTest', function () {
let
timestamp
=
Date
.
now
();
let
filename
=
'
cpuprofiler-
'
+
timestamp
.
toString
();
console
.
info
(
filename
);
let
path
=
'
/data/a
ccounts/account_0/appdata
/com.hidebug.test/files/
'
+
filename
+
'
.json
'
let
path
=
'
/data/a
pp/el2/100/base
/com.hidebug.test/files/
'
+
filename
+
'
.json
'
hidebug
.
startProfiling
(
filename
);
let
temp
=
100
;
hidebug
.
stopProfiling
();
...
...
@@ -144,9 +141,9 @@ describe('HidebugJsTest', function () {
it
(
'
DFX_DFR_Hiprofiler_Interface_0007
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0007 Test start*************
'
);
try
{
let
path1
=
'
/data/a
ccounts/account_0/appdata
/com.hidebug.test/files/cpuprofiler-111.json
'
let
path2
=
'
/data/a
ccounts/account_0/appdata
/com.hidebug.test/files/cpuprofiler-222.json
'
let
path3
=
'
/data/a
ccounts/account_0/appdata
/com.hidebug.test/files/cpuprofiler-333.json
'
let
path1
=
'
/data/a
pp/el2/100/base
/com.hidebug.test/files/cpuprofiler-111.json
'
let
path2
=
'
/data/a
pp/el2/100/base
/com.hidebug.test/files/cpuprofiler-222.json
'
let
path3
=
'
/data/a
pp/el2/100/base
/com.hidebug.test/files/cpuprofiler-333.json
'
hidebug
.
startProfiling
(
'
cpuprofiler-111
'
);
hidebug
.
startProfiling
(
'
cpuprofiler-222
'
);
hidebug
.
startProfiling
(
'
cpuprofiler-333
'
);
...
...
@@ -179,7 +176,7 @@ describe('HidebugJsTest', function () {
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0008
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0008 Test start*************
'
);
let
path
=
'
/data/a
ccounts/account_0/appdata/com.hidebug.test/files/
.json
'
let
path
=
'
/data/a
pp/el2/100/base/com.hidebug.test/files/undefined
.json
'
try
{
fileio
.
accessSync
(
path
,
0
);
let
res
=
fileio
.
unlinkSync
(
path
);
...
...
@@ -193,9 +190,9 @@ describe('HidebugJsTest', function () {
hidebug
.
stopProfiling
();
fileio
.
accessSync
(
path
,
0
);
console
.
info
(
'
file is exists:
'
,
path
);
expect
().
assertFail
();
}
catch
(
error
)
{
expect
(
true
).
assertTrue
();
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0008 Test end*************
'
);
done
();
...
...
@@ -208,7 +205,7 @@ describe('HidebugJsTest', function () {
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0009
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0009 Test start*************
'
);
let
path
=
'
/data/a
ccounts/account_0/appdata
/com.hidebug.test/files/undefined.json
'
let
path
=
'
/data/a
pp/el2/100/base
/com.hidebug.test/files/undefined.json
'
try
{
fileio
.
accessSync
(
path
,
0
);
let
res
=
fileio
.
unlinkSync
(
path
);
...
...
@@ -245,7 +242,7 @@ describe('HidebugJsTest', function () {
let
timestamp
=
Date
.
now
();
let
filename
=
'
heap-
'
+
timestamp
.
toString
();
console
.
info
(
filename
);
let
path
=
'
/data/a
ccounts/account_0/appdata
/com.hidebug.test/files/
'
+
filename
+
'
.heapsnapshot
'
let
path
=
'
/data/a
pp/el2/100/base
/com.hidebug.test/files/
'
+
filename
+
'
.heapsnapshot
'
hidebug
.
dumpHeapData
(
filename
);
fileio
.
accessSync
(
path
,
0
);
console
.
info
(
'
file is exists:
'
,
path
);
...
...
@@ -264,7 +261,7 @@ describe('HidebugJsTest', function () {
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0011
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0011 Test start*************
'
);
let
path
=
'
/data/a
ccounts/account_0/appdata/com.hidebug.test/files/
.heapsnapshot
'
let
path
=
'
/data/a
pp/el2/100/base/com.hidebug.test/files/undefined
.heapsnapshot
'
try
{
fileio
.
accessSync
(
path
,
0
);
let
res
=
fileio
.
unlinkSync
(
path
);
...
...
@@ -276,9 +273,9 @@ describe('HidebugJsTest', function () {
hidebug
.
dumpHeapData
(
''
);
fileio
.
accessSync
(
path
,
0
);
console
.
info
(
'
file is exists:
'
,
path
);
expect
().
assertFail
();
}
catch
(
error
)
{
expect
(
true
).
assertTrue
();
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0011 Test end*************
'
);
done
();
...
...
@@ -291,7 +288,7 @@ describe('HidebugJsTest', function () {
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0012
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0012 Test start*************
'
);
let
path
=
'
/data/a
ccounts/account_0/appdata
/com.hidebug.test/files/undefined.heapsnapshot
'
let
path
=
'
/data/a
pp/el2/100/base
/com.hidebug.test/files/undefined.heapsnapshot
'
try
{
fileio
.
accessSync
(
path
,
0
);
let
res
=
fileio
.
unlinkSync
(
path
);
...
...
@@ -314,5 +311,96 @@ describe('HidebugJsTest', function () {
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0012 Test end*************
'
);
done
();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0013
* @tc.name : getPrivateDirty
* @tc.desc : Get the size of the private dirty memory
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0013
'
,
0
,
function
()
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0013 Test start*************
'
);
try
{
let
temp
=
hidebug
.
getPrivateDirty
();
expect
(
temp
>=
BigInt
(
0
)).
assertTrue
();
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0013 Test end*************
'
);
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0014
* @tc.name : getCpuUsage
* @tc.desc : Get the cpu usage of a process
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0014
'
,
0
,
function
()
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0014 Test start*************
'
);
try
{
let
temp
=
-
1
;
for
(
let
i
=
0
;
i
<
10001
;
i
++
){
for
(
let
j
=
0
;
j
<
10001
;
j
++
){
if
(
i
+
j
==
20002
){
temp
=
hidebug
.
getCpuUsage
();
console
.
info
(
"
CpuUsage is
"
+
temp
);
}
}
}
expect
(
temp
>=
0
&&
temp
<=
1
).
assertTrue
();
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0014 Test end*************
'
);
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0015
* @tc.name : getServiceDump with normal parameter
* @tc.desc : getServiceDump
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0015
'
,
0
,
function
()
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0015 Test start*************
'
);
try
{
let
temp
=
hidebug
.
getServiceDump
(
10
);
console
.
info
(
"
ServiceDump is
"
+
temp
);
expect
(
temp
.
indexof
(
'
Success
'
)
!=-
1
).
assertTrue
();
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0015 Test end*************
'
);
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0016
* @tc.name : getServiceDump with abnormal parameter
* @tc.desc : getServiceDump
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0016
'
,
0
,
function
()
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0016 Test start*************
'
);
try
{
let
temp
=
hidebug
.
getServiceDump
(
-
1
);
console
.
info
(
"
ServiceDump is
"
+
temp
);
expect
(
temp
==
"
Error: no such system ability service.
"
).
assertTrue
();
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0016 Test end*************
'
);
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0017
* @tc.name : getServiceDump with overlog parameter
* @tc.desc : getServiceDump
*/
it
(
'
DFX_DFR_Hiprofiler_Interface_0017
'
,
0
,
function
()
{
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0017 Test start*************
'
);
try
{
let
temp
=
hidebug
.
getServiceDump
(
9007199254740993
);
console
.
info
(
"
ServiceDump is
"
+
temp
);
expect
(
temp
==
"
Error: invalid param
"
).
assertTrue
();
}
catch
(
error
)
{
expect
().
assertFail
();
}
console
.
log
(
'
************* DFX_DFR_Hiprofiler_Interface_0017 Test end*************
'
);
});
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录