Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fb74fecb
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fb74fecb
编写于
1月 27, 2022
作者:
X
xdmal
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Signed-off-by: xdmal <maxiaodong16@huawei.com>
On branch master Your branch is up to date with 'origin/master'.
上级
3210d95e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
3 addition
and
264 deletion
+3
-264
compileruntime/process_lib_standard/src/main/js/test/Process.test.js
...ime/process_lib_standard/src/main/js/test/Process.test.js
+3
-264
未找到文件。
compileruntime/process_lib_standard/src/main/js/test/Process.test.js
浏览文件 @
fb74fecb
...
...
@@ -16,267 +16,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
import
process
from
'
@ohos.process
'
describe
(
'
ChildProcessTest
'
,
function
()
{
/**
* @tc.name: testRunCmd001
* @tc.desc: Return a child process object and spawns a new ChildProcess to run the command.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testRunCmd001
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo abc
'
)
child
.
wait
()
var
array
=
new
Uint8Array
([
97
,
98
,
99
,
10
,
0
])
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testRunCmd002
* @tc.desc: Return a child process object and spawns a new ChildProcess to run the command.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testRunCmd002
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo abc;
'
,
{
maxBuffer
:
2
})
child
.
wait
()
var
array
=
new
Uint8Array
([
97
,
98
,
0
])
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testRunCmd003
* @tc.desc: Return a child process object and spawns a new ChildProcess to run the command.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testRunCmd003
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
sleep 5; echo abc;
'
,
{
timeout
:
1
,
killSignal
:
9
})
child
.
wait
()
var
array
=
new
Uint8Array
([
0
])
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
expect
(
child
.
exitCode
).
assertEqual
(
0
)
})
/**
* @tc.name: testRunCmd004
* @tc.desc: Return a child process object and spawns a new ChildProcess to run the command.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testRunCmd004
'
,
0
,
async
function
(
)
{
var
child
=
process
.
runCmd
(
'
sleep 2; echo abc;
'
,
{
timeout
:
9000
,
killSignal
:
9
})
child
.
wait
()
var
array
=
new
Uint8Array
([
97
,
98
,
99
,
10
,
0
])
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
expect
(
child
.
exitCode
).
assertEqual
(
0
)
})
/**
* @tc.name: testRunCmd005
* @tc.desc: Return a child process object and spawns a new ChildProcess to run the command.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testRunCmd005
'
,
0
,
async
function
(
)
{
var
child
=
process
.
runCmd
(
'
echo abc
'
,
{
maxBuffer
:
1000
})
child
.
wait
()
var
array
=
new
Uint8Array
([
97
,
98
,
99
,
10
,
0
])
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testGetOutput001
* @tc.desc: return it as 'Uint8Array' of the stdout until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetOutput001
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo bcd;
'
)
var
array
=
new
Uint8Array
([
98
,
99
,
100
,
10
,
0
])
child
.
wait
();
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testGetOutput002
* @tc.desc: return it as 'Uint8Array' of the stdout until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetOutput002
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo 123;
'
);
var
array
=
new
Uint8Array
([
49
,
50
,
51
,
10
,
0
]);
child
.
wait
();
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
]);
}
})
})
/**
* @tc.name: testGetOutput003
* @tc.desc: return it as 'Uint8Array' of the stdout until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetOutput003
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo helloWorld;
'
);
var
array
=
new
Uint8Array
([
104
,
101
,
108
,
108
,
111
,
87
,
111
,
114
,
108
,
100
,
10
,
0
]);
child
.
wait
();
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
]);
}
})
})
/**
* @tc.name: testGetOutput004
* @tc.desc: return it as 'Uint8Array' of the stdout until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetOutput004
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo helloWorld;
'
);
var
array
=
new
Uint8Array
([
228
,
189
,
160
,
229
,
165
,
189
,
10
,
0
]);
child
.
wait
();
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
]);
}
})
})
/**
* @tc.name: testGetOutput005
* @tc.desc: return it as 'Uint8Array' of the stdout until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetOutput005
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo ~_~;
'
);
var
array
=
new
Uint8Array
([
126
,
95
,
126
,
10
,
0
]);
child
.
wait
();
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
]);
}
})
})
/**
* @tc.name: testGetErrorOutput001
* @tc.desc: return it as 'Uint8Array of the stderr until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetErrorOutput001
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
makdir 1.txt
'
)
child
.
wait
()
var
array
=
new
Uint8Array
([
115
,
104
,
58
,
32
,
109
,
97
,
107
,
100
,
105
,
114
,
58
,
32
,
105
,
110
,
97
,
99
,
99
,
101
,
115
,
115
,
105
,
98
,
108
,
101
,
32
,
111
,
114
,
32
,
110
,
111
,
116
,
32
,
102
,
111
,
117
,
110
,
100
,
10
,
0
])
child
.
getErrorOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testGetErrorOutput002
* @tc.desc: return it as 'Uint8Array of the stderr until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetErrorOutput002
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo "error" 1>&2
'
)
child
.
wait
()
var
array
=
new
Uint8Array
([
101
,
114
,
111
,
114
,
10
,
0
])
child
.
getErrorOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testGetErrorOutput003
* @tc.desc: return it as 'Uint8Array of the stderr until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetErrorOutput003
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
1
'
)
child
.
wait
()
var
array
=
new
Uint8Array
([
115
,
104
,
58
,
32
,
49
,
58
,
32
,
105
,
110
,
97
,
99
,
99
,
101
,
115
,
115
,
105
,
98
,
108
,
101
,
32
,
111
,
114
,
32
,
110
,
111
,
116
,
32
,
102
,
111
,
117
,
110
,
100
,
10
,
0
])
child
.
getErrorOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testGetErrorOutput004
* @tc.desc: return it as 'Uint8Array of the stderr until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetErrorOutput004
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
chmod 777 123
'
)
var
array
=
new
Uint8Array
([
99
,
104
,
109
,
111
,
100
,
58
,
32
,
49
,
50
,
51
,
58
,
32
,
78
,
111
,
32
,
115
,
117
,
99
,
104
,
32
,
102
,
105
,
108
,
101
,
32
,
111
,
114
,
32
,
100
,
105
,
114
,
101
,
99
,
116
,
111
,
114
,
121
,
10
,
0
]);
child
.
wait
();
child
.
getErrorOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testGetErrorOutput005
* @tc.desc: return it as 'Uint8Array of the stderr until EOF.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testGetErrorOutput005
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
cp ./1 ./2
'
)
var
array
=
new
Uint8Array
([
99
,
112
,
58
,
32
,
98
,
97
,
100
,
32
,
39
,
46
,
47
,
49
,
39
,
58
,
32
,
78
,
111
,
32
,
115
,
117
,
99
,
104
,
32
,
102
,
105
,
108
,
101
,
32
,
111
,
114
,
32
,
100
,
105
,
114
,
101
,
99
,
116
,
111
,
114
,
121
,
10
,
0
])
child
.
wait
();
child
.
getErrorOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testWait001
* @tc.desc: return 'number' is the targer process exit code.
...
...
@@ -1819,7 +1558,7 @@ describe('ChildProcessTest', function () {
*/
it
(
'
testIsisolatedProcess001
'
,
0
,
function
()
{
var
pres
=
process
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
fals
e
)
expect
(
pres
).
assertEqual
(
tru
e
)
})
/**
...
...
@@ -1832,7 +1571,7 @@ describe('ChildProcessTest', function () {
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pres
=
process
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
fals
e
)
expect
(
pres
).
assertEqual
(
tru
e
)
}
})
...
...
@@ -1846,7 +1585,7 @@ describe('ChildProcessTest', function () {
for
(
var
i
=
0
;
i
<
1000
;
i
++
)
{
var
pres
=
process
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
fals
e
)
expect
(
pres
).
assertEqual
(
tru
e
)
}
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录