提交 10867965 编写于 作者: U uoengopen

guofeng43@huawei.com

Signed-off-by: Nuoengopen <guofeng43@huawei.com>
上级 1776854f
......@@ -18,7 +18,7 @@ group("hiviewdfxtestacts") {
"bytracetest:ActsBytraceJsTest",
"hiappeventtest/hiappeventjstest:ActsHiAppeventTest",
"hicheckertest/hicheckerjstest:hicheckerjstest",
"hidebugtest:ActsHiDebugTest",
"hidebugtest/hidebugtestjstest:ActsHiDebugTest",
"hitracechaintest:ActsHiTraceChainTest",
"hiview/faultlogger/faultloggerjs:faultloggerjs_test",
]
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
Want.parameters['timeout'] = 100000
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from "deccjsunit/index.ets";
import hiDebug from '@ohos.hidebug'
export default function hiDebugJsunit() {
describe('hiDebugTest', function () {
console.log("************* hiDebug Test start*************");
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0001
* @tc.name : getNativeHeapSize
* @tc.desc : Get total native heap memory size
*/
it('DFX_DFR_Hiprofiler_Interface_0001', 0, async function (done) {
console.log("************* DFX_DFR_Hiprofiler_Interface_0001 Test start*************");
try {
let heapSize = hiDebug.getNativeHeapSize();
expect(heapSize).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_DFR_Hiprofiler_Interface_0001 Test end*************");
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0002
* @tc.name : getNativeHeapAllocatedSize
* @tc.desc : Get Native heap memory allocation size.
*/
it('DFX_DFR_Hiprofiler_Interface_0002', 0, async function (done) {
console.log("************* DFX_DFR_Hiprofiler_Interface_0002 Test start*************");
try {
let heapAllocatedSize = hiDebug.getNativeHeapAllocatedSize();
expect(heapAllocatedSize).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_DFR_Hiprofiler_Interface_0002 Test end*************");
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0003
* @tc.name : getNativeHeapFreeSize
* @tc.desc : Get Native heap memory free size
*/
it('DFX_DFR_Hiprofiler_Interface_0003', 0, async function (done) {
console.log("************* DFX_DFR_Hiprofiler_Interface_0003 Test start*************");
try {
let heapFreeSize = hiDebug.getNativeHeapFreeSize();
expect(heapFreeSize).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_DFR_Hiprofiler_Interface_0003 Test end*************");
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0004
* @tc.name : getPss
* @tc.desc : Get application process proportional set size memory information
*/
it('DFX_DFR_Hiprofiler_Interface_0004', 0, async function (done) {
console.log("************* DFX_DFR_Hiprofiler_Interface_0004 Test start*************");
try {
let pss = hiDebug.getPss();
expect(pss).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_DFR_Hiprofiler_Interface_0004 Test end*************");
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0005
* @tc.name : getSharedDirty
* @tc.desc : Obtains the size of the shared dirty memory of a process.
*/
it('DFX_DFR_Hiprofiler_Interface_0005', 0, async function (done) {
console.log("************* DFX_DFR_Hiprofiler_Interface_0005 Test start*************");
try {
let dirty = hiDebug.getSharedDirty();
expect(dirty).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_DFR_Hiprofiler_Interface_0005 Test end*************");
done();
});
console.log("************* hiDebug Test end*************");
})
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -14,19 +14,19 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsHiDebugTest") {
hap_profile = "./entry/src/main/config.json"
hap_profile = "./src/main/config.json"
deps = [
":hidebug_ets_assets",
":hidebug_ets_resources",
":hidebug_js_assets",
":hidebug_js_resources",
]
ets2abc = true
#ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsHiDebugTest"
}
ohos_js_assets("hidebug_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
ohos_js_assets("hidebug_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hidebug_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
ohos_resources("hidebug_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
......@@ -9,10 +9,10 @@
"kits": [
{
"test-file-name": [
"$module.hap"
"ActsHiDebugTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.hidebug.test",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "ohos.hidebug.test",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.hidebug.test",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "com.hidebug.test",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.hidebug.test.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "MyApplication",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend, Constant} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hidebug from '@ohos.hidebug'
import fileio from '@ohos.fileio'
import {describe, it, expect} from 'deccjsunit/index'
describe('HidebugJsTest', function () {
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0001
* @tc.name : getNativeHeapSize
* @tc.desc : Get total native heap memory size
*/
it('DFX_DFR_Hiprofiler_Interface_0001', 0, function() {
console.log('************* DFX_DFR_Hiprofiler_Interface_0001 Test start*************');
try {
let heapSize = hidebug.getNativeHeapSize();
expect(heapSize).assertEqual(BigInt(0));
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0001 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0002
* @tc.name : getNativeHeapAllocatedSize
* @tc.desc : Get Native heap memory allocation size.
*/
it('DFX_DFR_Hiprofiler_Interface_0002', 0, function(done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0002 Test start*************');
try {
let heapAllocatedSize = hidebug.getNativeHeapAllocatedSize();
expect(heapAllocatedSize).assertEqual(BigInt(0));
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0002 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0003
* @tc.name : getNativeHeapFreeSize
* @tc.desc : Get Native heap memory free size
*/
it('DFX_DFR_Hiprofiler_Interface_0003', 0, function(done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0003 Test start*************');
try {
let heapFreeSize = hidebug.getNativeHeapFreeSize();
expect(heapFreeSize).assertEqual(BigInt(0));
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0003 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0004
* @tc.name : getPss
* @tc.desc : Get application process proportional set size memory information
*/
it('DFX_DFR_Hiprofiler_Interface_0004', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0004 Test start*************');
try {
const times = 3;
let pssValue = BigInt(0);
for(let i = 0; i < times; i++){
let arr = new Array(i*100000).fill(1);
let tmp = hidebug.getPss();
console.info('No.' + i + ' tmp: ' + tmp);
expect(tmp).assertLarger(pssValue);
pssValue = tmp;
}
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0004 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0005
* @tc.name : getSharedDirty
* @tc.desc : Obtains the size of the shared dirty memory of a process.
*/
it('DFX_DFR_Hiprofiler_Interface_0005', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0005 Test start*************');
try {
let dirty = hidebug.getSharedDirty();
let temp = hidebug.getSharedDirty();
expect(dirty).assertEqual(temp);
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0005 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0006
* @tc.name : startProfiling with normal parameter
* @tc.desc : Start CPU Profiling.
*/
it('DFX_DFR_Hiprofiler_Interface_0006', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0006 Test start*************');
try {
let timestamp = Date.now();
let filename = 'cpuprofiler-' + timestamp.toString();
console.info(filename);
let path = '/data/accounts/account_0/appdata/com.hidebug.test/files/' + filename + '.json'
hidebug.startProfiling(filename);
let temp = 100;
hidebug.stopProfiling();
fileio.accessSync(path, 0);
console.info('file is exists:', path);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0006 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0007
* @tc.name : startProfiling repeatedly
* @tc.desc : Start CPU Profiling.
*/
it('DFX_DFR_Hiprofiler_Interface_0007', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0007 Test start*************');
try {
let path1 = '/data/accounts/account_0/appdata/com.hidebug.test/files/cpuprofiler-111.json'
let path2 = '/data/accounts/account_0/appdata/com.hidebug.test/files/cpuprofiler-222.json'
let path3 = '/data/accounts/account_0/appdata/com.hidebug.test/files/cpuprofiler-333.json'
hidebug.startProfiling('cpuprofiler-111');
hidebug.startProfiling('cpuprofiler-222');
hidebug.startProfiling('cpuprofiler-333');
let temp = 100;
hidebug.stopProfiling();
hidebug.stopProfiling();
fileio.accessSync(path1, 0);
fileio.accessSync(path2, 0);
fileio.accessSync(path3, 0);
let res = fileio.readTextSync(path1);
let tmp = JSON.stringify(res);
expect(tmp.length).assertLarger(2);
res = fileio.readTextSync(path2);
tmp = JSON.stringify(res);
expect(tmp.length).assertEqual(2);
res = fileio.readTextSync(path3);
tmp = JSON.stringify(res);
expect(tmp.length).assertEqual(2);
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0007 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0008
* @tc.name : startProfiling with empty parameter
* @tc.desc : Start CPU Profiling.
*/
it('DFX_DFR_Hiprofiler_Interface_0008', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0008 Test start*************');
let path = '/data/accounts/account_0/appdata/com.hidebug.test/files/.json'
try {
fileio.accessSync(path, 0);
let res = fileio.unlinkSync(path);
console.log(JSON.stringify(res));
} catch(e) {
console.info('the file is not exists');
};
try {
hidebug.startProfiling('');
let temp = 100;
hidebug.stopProfiling();
fileio.accessSync(path, 0);
console.info('file is exists:', path);
expect().assertFail();
} catch (error) {
expect(true).assertTrue();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0008 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0009
* @tc.name : startProfiling with overlong parameter
* @tc.desc : Start CPU Profiling.
*/
it('DFX_DFR_Hiprofiler_Interface_0009', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0009 Test start*************');
let path = '/data/accounts/account_0/appdata/com.hidebug.test/files/undefined.json'
try {
fileio.accessSync(path, 0);
let res = fileio.unlinkSync(path);
console.log(JSON.stringify(res));
} catch(e) {
console.info('the file is not exists');
};
let str = '';
for (let i = 0; i < 1000; i++) {
str += 'abcd';
}
try {
hidebug.startProfiling(str);
let temp = 100;
hidebug.stopProfiling();
fileio.accessSync(path, 0);
console.info('file is exists:', path);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0009 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0010
* @tc.name : dumpHeapData with normal parameter
* @tc.desc : Dump JS Virtual Machine Heap Snapshot.
*/
it('DFX_DFR_Hiprofiler_Interface_0010', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0010 Test start*************');
try {
let timestamp = Date.now();
let filename = 'heap-' + timestamp.toString();
console.info(filename);
let path = '/data/accounts/account_0/appdata/com.hidebug.test/files/' + filename + '.heapsnapshot'
hidebug.dumpHeapData(filename);
fileio.accessSync(path, 0);
console.info('file is exists:', path);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0010 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0011
* @tc.name : dumpHeapData with empty parameter
* @tc.desc : Dump JS Virtual Machine Heap Snapshot.
*/
it('DFX_DFR_Hiprofiler_Interface_0011', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0011 Test start*************');
let path = '/data/accounts/account_0/appdata/com.hidebug.test/files/.heapsnapshot'
try {
fileio.accessSync(path, 0);
let res = fileio.unlinkSync(path);
console.log(JSON.stringify(res));
} catch(e) {
console.info('the file is not exists');
};
try {
hidebug.dumpHeapData('');
fileio.accessSync(path, 0);
console.info('file is exists:', path);
expect().assertFail();
} catch (error) {
expect(true).assertTrue();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0011 Test end*************');
done();
});
/*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0012
* @tc.name : dumpHeapData with overlog parameter
* @tc.desc : Dump JS Virtual Machine Heap Snapshot.
*/
it('DFX_DFR_Hiprofiler_Interface_0012', 0, async function (done) {
console.log('************* DFX_DFR_Hiprofiler_Interface_0012 Test start*************');
let path = '/data/accounts/account_0/appdata/com.hidebug.test/files/undefined.heapsnapshot'
try {
fileio.accessSync(path, 0);
let res = fileio.unlinkSync(path);
console.log(JSON.stringify(res));
} catch(e) {
console.info('the file is not exists');
};
let str = '';
for (let i = 0; i < 1000; i++) {
str += 'abcd';
}
try {
hidebug.dumpHeapData(str);
fileio.accessSync(path, 0);
console.info('file is exists:', path);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log('************* DFX_DFR_Hiprofiler_Interface_0012 Test end*************');
done();
});
})
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hiDebugJsunit from './HiDebugJsunit.test.ets';
export default function testsuite() {
hiDebugJsunit();
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./Hidebug.test.js')
{
"string": [
{
"name": "app_name",
"value": "hidebug"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
......@@ -23,94 +23,6 @@ export default function byTraceHiDebugJsunit() {
describe('byTraceHiDebugTest', function () {
console.log("************* byTraceHiDebug Test start*************");
/*
* @tc.number : DFX_ByTrace_ByTrace_startTrace_0100
* @tc.name : startTrace
* @tc.desc : Records a trace marking it as the start of a task, can with the expected completion time between
startTrace and finishTrace.
*/
it('DFX_ByTrace_ByTrace_startTrace_0100', 0, async function (done) {
console.log("************* DFX_ByTrace_ByTrace_startTrace_0100 Test start*************");
try {
byTrace.startTrace("test1", 1, 1000);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_ByTrace_ByTrace_startTrace_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_ByTrace_ByTrace_startTrace_0200
* @tc.name : startTrace
* @tc.desc : Records a trace marking it as the start of a task, can with the expected completion time between
startTrace and finishTrace.
*/
it('DFX_ByTrace_ByTrace_startTrace_0200', 0, async function (done) {
console.log("************* DFX_ByTrace_ByTrace_startTrace_0200 Test start*************");
try {
byTrace.startTrace("test2", 2, 5000);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_ByTrace_ByTrace_startTrace_0200 Test end*************");
done();
});
/*
* @tc.number : DFX_ByTrace_ByTrace_startTrace_0300
* @tc.name : startTrace
* @tc.desc : Records a trace marking it as the start of a task, can with the expected completion time between
startTrace and finishTrace.
*/
it('DFX_ByTrace_ByTrace_startTrace_0300', 0, async function (done) {
console.log("************* DFX_ByTrace_ByTrace_startTrace_0300 Test start*************");
try {
byTrace.startTrace("test3", 3);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_ByTrace_ByTrace_startTrace_0300 Test end*************");
done();
});
/*
* @tc.number : DFX_ByTrace_ByTrace_traceByValue_0100
* @tc.name : traceByValue
* @tc.desc : Records a trace for generating a count, such as clock pulse and the number of layers.
*/
it('DFX_ByTrace_ByTrace_traceByValue_0100', 0, async function (done) {
console.log("************* DFX_ByTrace_ByTrace_traceByValue_0100 Test start*************");
try {
byTrace.traceByValue("test1", 1);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_ByTrace_ByTrace_traceByValue_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_ByTrace_ByTrace_traceByValue_0200
* @tc.name : traceByValue
* @tc.desc : Records a trace for generating a count, such as clock pulse and the number of layers.
*/
it('DFX_ByTrace_ByTrace_traceByValue_0200', 0, async function (done) {
console.log("************* DFX_ByTrace_ByTrace_traceByValue_0200 Test start*************");
try {
byTrace.traceByValue("test1", 1);
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_ByTrace_ByTrace_traceByValue_0200 Test end*************");
done();
});
/*
* @tc.number : DFX_HiAppEvent_Event_DISTRIBUTED_SERVICE_START_0100
* @tc.name : DISTRIBUTED_SERVICE_START
......@@ -127,142 +39,6 @@ export default function byTraceHiDebugJsunit() {
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_getNativeHeapSize_0100
* @tc.name : getNativeHeapSize
* @tc.desc : Get total native heap memory size
*/
it('DFX_HiDebug_HiDebug_getNativeHeapSize_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_getNativeHeapSize_0100 Test start*************");
try {
let heapSize = hiDebug.getNativeHeapSize();
expect(heapSize).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_getNativeHeapSize_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_getNativeHeapAllocatedSize_0100
* @tc.name : getNativeHeapAllocatedSize
* @tc.desc : Get Native heap memory allocation size.
*/
it('DFX_HiDebug_HiDebug_getNativeHeapAllocatedSize_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_getNativeHeapAllocatedSize_0100 Test start*************");
try {
let heapAllocatedSize = hiDebug.getNativeHeapAllocatedSize();
expect(heapAllocatedSize).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_getNativeHeapAllocatedSize_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_getNativeHeapFreeSize_0100
* @tc.name : getNativeHeapFreeSize
* @tc.desc : Get Native heap memory free size
*/
it('DFX_HiDebug_HiDebug_getNativeHeapFreeSize_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_getNativeHeapFreeSize_0100 Test start*************");
try {
let heapFreeSize = hiDebug.getNativeHeapFreeSize();
expect(heapFreeSize).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_getNativeHeapFreeSize_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_getPss_0100
* @tc.name : getPss
* @tc.desc : Get application process proportional set size memory information
*/
it('DFX_HiDebug_HiDebug_getPss_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_getPss_0100 Test start*************");
try {
let pss = hiDebug.getPss();
expect(pss).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_getPss_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_getSharedDirty_0100
* @tc.name : getSharedDirty
* @tc.desc : Obtains the size of the shared dirty memory of a process.
*/
it('DFX_HiDebug_HiDebug_getSharedDirty_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_getSharedDirty_0100 Test start*************");
try {
let dirty = hiDebug.getSharedDirty();
expect(dirty).assertEqual(undefined);
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_getSharedDirty_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_startProfiling_0100
* @tc.name : startProfiling
* @tc.desc : Start CPU Profiling.
*/
it('DFX_HiDebug_HiDebug_startProfiling_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_startProfiling_0100 Test start*************");
try {
hiDebug.startProfiling('/data/accounts/account_0/appdata/[package name]/files/cpuprofile_test.json');
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_startProfiling_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_stopProfiling_0100
* @tc.name : stopProfiling
* @tc.desc : Stop CPU Profiling.
*/
it('DFX_HiDebug_HiDebug_stopProfiling_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_stopProfiling_0100 Test start*************");
try {
hiDebug.stopProfiling();
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_stopProfiling_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiDebug_HiDebug_dumpHeapData_0100
* @tc.name : dumpHeapData
* @tc.desc : Dump JS Virtual Machine Heap Snapshot.
*/
it('DFX_HiDebug_HiDebug_dumpHeapData_0100', 0, async function (done) {
console.log("************* DFX_HiDebug_HiDebug_dumpHeapData_0100 Test start*************");
try {
hiDebug.dumpHeapData();
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
}
console.log("************* DFX_HiDebug_HiDebug_dumpHeapData_0100 Test end*************");
done();
});
/*
* @tc.number : DFX_HiLog_HiLog_info_0100
* @tc.name : info
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册