Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Xdevice
提交
23a37e27
T
Test Xdevice
项目概览
OpenHarmony
/
Test Xdevice
9 个月 前同步成功
通知
6
Star
23
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Test Xdevice
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
23a37e27
编写于
7月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!139 OHJSunitTest新增testcase-timeout参数配置,以及修复部分bug
Merge pull request !139 from liguangjie/cherry-pick-1658390862
上级
b0c2de83
f8032674
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
16 deletion
+28
-16
extension/src/xdevice_extension/_core/driver/drivers.py
extension/src/xdevice_extension/_core/driver/drivers.py
+22
-15
extension/src/xdevice_extension/_core/driver/openharmony.py
extension/src/xdevice_extension/_core/driver/openharmony.py
+6
-1
未找到文件。
extension/src/xdevice_extension/_core/driver/drivers.py
浏览文件 @
23a37e27
...
...
@@ -1630,24 +1630,31 @@ class JSUnitTestDriver(IDriver):
LOG
.
warning
(
"there is no suites end"
)
if
len
(
label_list
[
0
])
>
0
and
sum
(
label_list
[
0
])
!=
0
:
# the problem happened! when the sum of label list is not zero
for
i
in
range
(
len
(
label_list
[
0
])):
if
label_list
[
0
][
i
]
==
1
:
# this is the start label
if
i
+
1
<
len
(
label_list
[
0
]):
# peek backward
if
label_list
[
0
][
i
+
1
]
==
1
:
# lack the end label
message_list
.
insert
(
label_list
[
1
][
i
+
1
],
"app Log: [suite end]
\n
"
)
LOG
.
warning
(
"there is no suite end"
)
for
j
in
range
(
i
+
1
,
len
(
label_list
[
1
])):
label_list
[
1
][
j
]
+=
1
# move the index to next
else
:
# at the tail
message_list
.
insert
(
-
1
,
"app Log: [suite end]
\n
"
)
LOG
.
warning
(
"there is no suite end"
)
self
.
_insert_suite_end
(
label_list
,
message_list
)
result_message
=
""
.
join
(
message_list
)
message_list
.
clear
()
expect_tests_dict
=
self
.
_parse_suite_info
(
suite_info
)
self
.
_analyse_tests
(
request
,
result_message
,
expect_tests_dict
)
@
classmethod
def
_insert_suite_end
(
cls
,
label_list
,
message_list
):
for
i
in
range
(
len
(
label_list
[
0
])):
if
label_list
[
0
][
i
]
!=
1
:
# skipp
continue
# check the start label, then peek next position
if
i
+
1
==
len
(
label_list
[
0
]):
# next position at the tail
message_list
.
insert
(
-
1
,
"app Log: [suite end]
\n
"
)
LOG
.
warning
(
"there is no suite end"
)
continue
if
label_list
[
0
][
i
+
1
]
!=
1
:
# 0 present the end label
continue
message_list
.
insert
(
label_list
[
1
][
i
+
1
],
"app Log: [suite end]
\n
"
)
LOG
.
warning
(
"there is no suite end"
)
for
j
in
range
(
i
+
1
,
len
(
label_list
[
1
])):
label_list
[
1
][
j
]
+=
1
# move the index to next
def
_analyse_tests
(
self
,
request
,
result_message
,
expect_tests_dict
):
listener_copy
=
request
.
listeners
.
copy
()
parsers
=
get_plugin
(
...
...
@@ -1682,6 +1689,7 @@ class JSUnitTestDriver(IDriver):
for
test_name
in
test_name_dict
.
values
():
test
=
TestDescription
(
class_name
,
test_name
)
tests_dict
.
get
(
class_name
).
append
(
test
)
test_count
+=
1
except
json
.
decoder
.
JSONDecodeError
as
json_error
:
LOG
.
warning
(
"Suites info is invalid: %s"
%
json_error
)
LOG
.
debug
(
"Collect suite count is %s, test count is %s"
%
...
...
@@ -1712,7 +1720,7 @@ class JSUnitTestDriver(IDriver):
_
,
pos
=
re
.
match
(
".+
\\
[suites info]"
,
line
).
span
()
suite_info
.
append
(
line
[
pos
:].
strip
())
if
"[start] start run suites"
in
line
:
#
ʼǩ
if
"[start] start run suites"
in
line
:
#
发现了任务开始标签
pid
,
is_update
=
\
self
.
_init_suites_start
(
line
,
pattern
,
pid
)
if
is_update
:
...
...
@@ -1926,7 +1934,7 @@ class LTPPosixTestDriver(IDriver):
parser_instances
.
append
(
parser_instance
)
self
.
handler
=
ShellHandler
(
parser_instances
)
result_message
=
self
.
config
.
device
.
hdc_command
(
"shell {}
{}"
.
format
(
dst
,
test_bin
))
"shell {}
"
.
format
(
test_bin
))
LOG
.
info
(
"get result from command {}"
.
format
(
result_message
))
process_command_ret
(
result_message
,
self
.
handler
)
...
...
@@ -1972,7 +1980,6 @@ class OHKernelTestDriver(IDriver):
request
.
config
.
report_path
,
request
.
config
.
device
.
__get_serial__
(),
"device_hilog"
)
hilog_open
=
os
.
open
(
hilog
,
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_APPEND
,
FilePermission
.
mode_755
)
with
os
.
fdopen
(
hilog_open
,
"a"
)
as
hilog_file_pipe
:
...
...
extension/src/xdevice_extension/_core/driver/openharmony.py
浏览文件 @
23a37e27
...
...
@@ -290,7 +290,7 @@ class OHJSUnitTestDriver(IDriver):
if
not
package
and
not
module
:
raise
ParamError
(
"Neither package nor moodle is found"
" in config file."
,
error_no
=
"03201"
)
timeout_config
=
get_config_value
(
"
test
-timeout"
,
timeout_config
=
get_config_value
(
"
shell
-timeout"
,
json_config
.
get_driver
(),
False
)
if
timeout_config
:
self
.
config
.
timeout
=
int
(
timeout_config
)
...
...
@@ -303,6 +303,11 @@ class OHJSUnitTestDriver(IDriver):
if
test_timeout
:
self
.
runner
.
add_arg
(
"wait_time"
,
int
(
test_timeout
))
testcase_timeout
=
get_config_value
(
'testcase-timeout'
,
json_config
.
get_driver
(),
False
)
if
testcase_timeout
:
self
.
runner
.
add_arg
(
"timeout"
,
int
(
testcase_timeout
))
def
_do_test_run
(
self
,
listener
):
test_to_run
=
self
.
_collect_test_to_run
()
LOG
.
info
(
"Collected test count is: %s"
%
(
len
(
test_to_run
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录