未验证 提交 52e2dd89 编写于 作者: O openharmony_ci 提交者: Gitee

!7276 测试套内存泄漏问题回合1018分支

Merge pull request !7276 from chenxuihui/monthly_20221018
...@@ -17,24 +17,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -17,24 +17,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export default function BytraceTest() { export default function BytraceTest() {
describe("BytraceTest", function () { describe("BytraceTest", function () {
async function msleep(time) {
var promise = new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), time);
});
var result = await promise;
}
it("DFX_DFR_Bytrace_0100", 0, async function (done) { it("DFX_DFR_Bytrace_0100", 0, async function (done) {
console.info("-------DFX_DFR_Bytrace_0100 start--------"); console.info("-------DFX_DFR_Bytrace_0100 start--------");
await msleep(3000);
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
console.info("DFX_DFR_Bytrace_0100 i = " + i) console.info("DFX_DFR_Bytrace_0100 i = " + i)
console.info("DFX_DFR_Bytrace_0100 " + i.toString() + " startTrace start"); console.info("DFX_DFR_Bytrace_0100 " + i.toString() + " startTrace start");
bytrace.startTrace("test-" + i.toString(), 111 + i, 5000); bytrace.startTrace("test-" + i.toString(), 111 + i, 5000);
console.info("DFX_DFR_Bytrace_0100 " + i.toString() + "startTrace end"); console.info("DFX_DFR_Bytrace_0100 " + i.toString() + "startTrace end");
// await msleep(3000);
console.info("DFX_DFR_Bytrace_0100 " + i.toString() + " finishTrace start"); console.info("DFX_DFR_Bytrace_0100 " + i.toString() + " finishTrace start");
bytrace.finishTrace("test-" + i.toString(), 111 + i); bytrace.finishTrace("test-" + i.toString(), 111 + i);
console.info("DFX_DFR_Bytrace_0100 " + i.toString() + "finishTrace end"); console.info("DFX_DFR_Bytrace_0100 " + i.toString() + "finishTrace end");
...@@ -155,7 +144,6 @@ describe("BytraceTest", function () { ...@@ -155,7 +144,6 @@ describe("BytraceTest", function () {
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
console.info("DFX_DFR_Bytrace_0400 :" + i); console.info("DFX_DFR_Bytrace_0400 :" + i);
bytrace.traceByValue("test4-" + i.toString(), 3 + i); bytrace.traceByValue("test4-" + i.toString(), 3 + i);
await msleep(1000);
} }
console.info("DFX_DFR_Bytrace_0400 end"); console.info("DFX_DFR_Bytrace_0400 end");
done(); done();
......
...@@ -39,13 +39,6 @@ describe('HiCheckerTest', function () { ...@@ -39,13 +39,6 @@ describe('HiCheckerTest', function () {
console.info('HiCheckerTest afterEach called') console.info('HiCheckerTest afterEach called')
}) })
async function msleep(time) {
let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), time)
});
let result = await promise;
}
/** /**
* @tc.number * @tc.number
* @tc.name DFX_DFR_Hichecker_Interface_0100 * @tc.name DFX_DFR_Hichecker_Interface_0100
...@@ -92,7 +85,7 @@ describe('HiCheckerTest', function () { ...@@ -92,7 +85,7 @@ describe('HiCheckerTest', function () {
expect(hichecker.contains(0)).assertEqual(false); expect(hichecker.contains(0)).assertEqual(false);
hichecker.addRule(999999); hichecker.addRule(999999);
console.log('add wrong rule!'); console.log('add wrong rule!');
expect(hichecker.contains(-1)).assertEqual(false); expect(hichecker.contains(999999)).assertEqual(false);
}) })
/** /**
......
...@@ -17,16 +17,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -17,16 +17,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export default function HitraceMeterTest() { export default function HitraceMeterTest() {
describe("HitraceMeterTest", function () { describe("HitraceMeterTest", function () {
async function msleep(time) {
var promise = new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), time);
});
var result = await promise;
}
it("DFX_DFR_HitraceMeter_0100", 0, async function (done) { it("DFX_DFR_HitraceMeter_0100", 0, async function (done) {
console.info("-------DFX_DFR_HitraceMeter_0100 start--------"); console.info("-------DFX_DFR_HitraceMeter_0100 start--------");
await msleep(3000);
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
console.info("DFX_DFR_HitraceMeter_0100 i = " + i) console.info("DFX_DFR_HitraceMeter_0100 i = " + i)
console.info("DFX_DFR_HitraceMeter_0100 " + i.toString() + " startTrace start"); console.info("DFX_DFR_HitraceMeter_0100 " + i.toString() + " startTrace start");
...@@ -152,7 +144,6 @@ describe("HitraceMeterTest", function () { ...@@ -152,7 +144,6 @@ describe("HitraceMeterTest", function () {
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
console.info("DFX_DFR_HitraceMeter_0400 :" + i); console.info("DFX_DFR_HitraceMeter_0400 :" + i);
hiTraceMeter.traceByValue("test4-" + i.toString(), 3 + i); hiTraceMeter.traceByValue("test4-" + i.toString(), 3 + i);
await msleep(1000);
} }
console.info("DFX_DFR_HitraceMeter_0400 end"); console.info("DFX_DFR_HitraceMeter_0400 end");
done(); done();
......
...@@ -35,10 +35,12 @@ describe("FaultlogJsTest", function () { ...@@ -35,10 +35,12 @@ describe("FaultlogJsTest", function () {
}) })
async function msleep(time) { async function msleep(time) {
let timeoutID = null;
let promise = new Promise((resolve, reject) => { let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), time) timeoutID = setTimeout(() => resolve("done!"), time)
}); });
let result = await promise; let result = await promise;
clearTimeout(timeoutID);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册