Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Developertest
提交
a8c57c18
T
Test Developertest
项目概览
OpenHarmony
/
Test Developertest
10 个月 前同步成功
通知
2
Star
23
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Test Developertest
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a8c57c18
编写于
6月 24, 2022
作者:
C
caozhizhan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify drivers.py
Signed-off-by:
N
caozhizhan
<
caozhizhan@kaihongdigi.com
>
上级
4ad7ffbe
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
3 deletion
+28
-3
src/core/driver/drivers.py
src/core/driver/drivers.py
+28
-3
未找到文件。
src/core/driver/drivers.py
浏览文件 @
a8c57c18
...
...
@@ -25,6 +25,7 @@ import platform
import
zipfile
import
stat
from
dataclasses
import
dataclass
from
json
import
JSONDecodeError
from
xdevice
import
DeviceTestType
from
xdevice
import
DeviceLabelType
...
...
@@ -658,11 +659,18 @@ class JSUnitTestDriver(IDriver):
def
_run_jsunit
(
self
,
suite_file
,
device_log_file
):
filename
=
os
.
path
.
basename
(
suite_file
)
_
,
suffix_name
=
os
.
path
.
splitext
(
filename
)
resource_manager
=
ResourceManager
()
resource_data_dic
,
resource_dir
=
\
resource_manager
.
get_resource_data_dic
(
suite_file
)
timeout
=
ResourceManager
.
get_nodeattrib_data
(
resource_data_dic
)
resource_data_dic
,
resource_dir
=
resource_manager
.
get_resource_data_dic
(
suite_file
)
if
suffix_name
==
".hap"
:
json_file_path
=
suite_file
.
replace
(
".hap"
,
".json"
)
if
os
.
path
.
exists
(
json_file_path
):
timeout
=
self
.
_get_json_shell_timeout
(
json_file_path
)
else
:
timeout
=
ResourceManager
.
get_nodeattrib_data
(
resource_data_dic
)
else
:
timeout
=
ResourceManager
.
get_nodeattrib_data
(
resource_data_dic
)
resource_manager
.
process_preparer_data
(
resource_data_dic
,
resource_dir
,
self
.
config
.
device
)
...
...
@@ -800,6 +808,23 @@ class JSUnitTestDriver(IDriver):
_sleep_according_to_result
(
return_message
)
return
return_message
@
classmethod
def
_get_json_shell_timeout
(
cls
,
json_filepath
):
test_timeout
=
300
try
:
with
open
(
json_filepath
,
'r'
)
as
json_file
:
data_dic
=
json
.
load
(
json_file
)
if
not
data_dic
:
return
test_timeout
else
:
if
"driver"
in
data_dic
.
keys
():
driver_dict
=
data_dic
.
get
(
"driver"
)
if
driver_dict
and
"test-timeout"
in
driver_dict
.
keys
():
test_timeout
=
int
(
driver_dict
[
"shell-timeout"
])
/
1000
return
test_timeout
except
JSONDecodeError
:
return
test_timeout
@
staticmethod
def
_get_package_and_ability_name
(
hap_filepath
):
package_name
=
""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录