Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Developertest
提交
03b4ff01
T
Test Developertest
项目概览
OpenHarmony
/
Test Developertest
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
03b4ff01
编写于
6月 24, 2022
作者:
F
fengkai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
analysis of function
Signed-off-by:
N
fengkai
<
fengkai@kaihongdigi.com
>
上级
a60f7d47
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
2 deletion
+27
-2
src/core/config/config_manager.py
src/core/config/config_manager.py
+27
-2
未找到文件。
src/core/config/config_manager.py
浏览文件 @
03b4ff01
...
@@ -24,24 +24,38 @@ from xdevice import platform_logger
...
@@ -24,24 +24,38 @@ from xdevice import platform_logger
from
core.constants
import
ConfigFileConst
from
core.constants
import
ConfigFileConst
LOG
=
platform_logger
(
"config_manager"
)
LOG
=
platform_logger
(
"config_manager"
)
CONFIG_PATH
=
os
.
path
.
join
(
sys
.
framework_res_dir
,
"config"
)
# framework_res_dir = OpenHarmony/test/developertest
# CONFIG_PATH = OpenHarmony/test/developertest/config
CONFIG_PATH
=
os
.
path
.
join
(
sys
.
framework_res_dir
,
"config"
)
# framework_config.xml
class
FrameworkConfigManager
(
object
):
class
FrameworkConfigManager
(
object
):
def
__init__
(
self
,
filepath
=
""
):
def
__init__
(
self
,
filepath
=
""
):
if
filepath
==
""
:
if
filepath
==
""
:
# filepath = OpenHarmony/test/developertest/config/framework_config.xml
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
CONFIG_PATH
,
ConfigFileConst
.
FRAMECONFIG_FILEPATH
))
CONFIG_PATH
,
ConfigFileConst
.
FRAMECONFIG_FILEPATH
))
else
:
else
:
self
.
filepath
=
filepath
self
.
filepath
=
filepath
# 获取framework_config.xml中所有name的value,返回列表
def
get_framework_config
(
self
,
target_name
):
def
get_framework_config
(
self
,
target_name
):
data_list
=
[]
data_list
=
[]
try
:
try
:
if
os
.
path
.
exists
(
self
.
filepath
):
if
os
.
path
.
exists
(
self
.
filepath
):
# 读取xml文件
tree
=
ET
.
parse
(
self
.
filepath
)
tree
=
ET
.
parse
(
self
.
filepath
)
# 获取根节点
root
=
tree
.
getroot
()
root
=
tree
.
getroot
()
# 获取节点的名字
node
=
root
.
find
(
target_name
)
node
=
root
.
find
(
target_name
)
# 遍历 name 节点 获取value 添加到data_list中
for
sub
in
node
:
for
sub
in
node
:
value
=
sub
.
attrib
.
get
(
"name"
)
value
=
sub
.
attrib
.
get
(
"name"
)
if
value
and
value
!=
""
:
if
value
and
value
!=
""
:
...
@@ -50,6 +64,7 @@ class FrameworkConfigManager(object):
...
@@ -50,6 +64,7 @@ class FrameworkConfigManager(object):
LOG
.
error
((
"Parse %s fail!"
%
self
.
filepath
)
+
xml_exception
.
args
)
LOG
.
error
((
"Parse %s fail!"
%
self
.
filepath
)
+
xml_exception
.
args
)
return
data_list
return
data_list
# 获取framework_config.xml中test_category标签里name、desc、timeout的value,返回字典
def
get_test_category_info
(
self
,
target_name
=
"test_category"
):
def
get_test_category_info
(
self
,
target_name
=
"test_category"
):
test_type_timeout_dic
=
{}
test_type_timeout_dic
=
{}
try
:
try
:
...
@@ -69,13 +84,17 @@ class FrameworkConfigManager(object):
...
@@ -69,13 +84,17 @@ class FrameworkConfigManager(object):
LOG
.
error
((
"Parse %s fail!"
%
self
.
filepath
)
+
xml_exception
.
args
)
LOG
.
error
((
"Parse %s fail!"
%
self
.
filepath
)
+
xml_exception
.
args
)
return
test_type_timeout_dic
return
test_type_timeout_dic
# 获取framework_config.xml中all_category标签里name的value,返回列表 如:unittest、moduletest、systemtest、performance
def
get_all_category_info
(
self
,
target_name
=
"all_category"
):
def
get_all_category_info
(
self
,
target_name
=
"all_category"
):
return
self
.
get_framework_config
(
target_name
)
return
self
.
get_framework_config
(
target_name
)
# filter_config.xml
class
FilterConfigManager
(
object
):
class
FilterConfigManager
(
object
):
def
__init__
(
self
,
filepath
=
""
):
def
__init__
(
self
,
filepath
=
""
):
if
filepath
==
""
:
if
filepath
==
""
:
# filepath = OpenHarmony/test/developertest/config/filter_config.xml
self
.
filepath
=
os
.
path
.
abspath
(
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
CONFIG_PATH
,
os
.
path
.
join
(
CONFIG_PATH
,
ConfigFileConst
.
FILTERCONFIG_FILEPATH
))
ConfigFileConst
.
FILTERCONFIG_FILEPATH
))
...
@@ -106,7 +125,7 @@ class FilterConfigManager(object):
...
@@ -106,7 +125,7 @@ class FilterConfigManager(object):
def
get_filter_config_path
(
self
):
def
get_filter_config_path
(
self
):
return
self
.
filepath
return
self
.
filepath
# 这里的filepath不存在
class
ResourceConfigManager
(
object
):
class
ResourceConfigManager
(
object
):
def
__init__
(
self
,
filepath
=
""
):
def
__init__
(
self
,
filepath
=
""
):
if
filepath
==
""
:
if
filepath
==
""
:
...
@@ -142,6 +161,8 @@ class ResourceConfigManager(object):
...
@@ -142,6 +161,8 @@ class ResourceConfigManager(object):
class
UserConfigManager
(
object
):
class
UserConfigManager
(
object
):
def
__init__
(
self
,
config_file
=
""
):
def
__init__
(
self
,
config_file
=
""
):
if
config_file
==
""
:
if
config_file
==
""
:
# filepath = OpenHarmony/test/developertest/config/user_config.xml
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
CONFIG_PATH
,
ConfigFileConst
.
USERCONFIG_FILEPATH
))
CONFIG_PATH
,
ConfigFileConst
.
USERCONFIG_FILEPATH
))
else
:
else
:
...
@@ -261,6 +282,8 @@ class UserConfigManager(object):
...
@@ -261,6 +282,8 @@ class UserConfigManager(object):
class
BuildConfigManager
(
object
):
class
BuildConfigManager
(
object
):
def
__init__
(
self
,
filepath
=
""
):
def
__init__
(
self
,
filepath
=
""
):
if
filepath
==
""
:
if
filepath
==
""
:
# filepath = OpenHarmony/test/developertest/config/build_config.xml
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
CONFIG_PATH
,
ConfigFileConst
.
BUILDCONFIG_FILEPATH
))
CONFIG_PATH
,
ConfigFileConst
.
BUILDCONFIG_FILEPATH
))
else
:
else
:
...
@@ -287,6 +310,8 @@ class BuildConfigManager(object):
...
@@ -287,6 +310,8 @@ class BuildConfigManager(object):
class
FuzzerConfigManager
(
object
):
class
FuzzerConfigManager
(
object
):
def
__init__
(
self
,
config_path
=
""
):
def
__init__
(
self
,
config_path
=
""
):
if
config_path
==
""
:
if
config_path
==
""
:
# filepath = OpenHarmony/test/developertest/config/fuzz_config.xml
self
.
filepath
=
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
filepath
=
self
.
filepath
=
os
.
path
.
abspath
(
os
.
path
.
join
(
CONFIG_PATH
,
ConfigFileConst
.
FUZZCONFIG_FILEPATH
))
CONFIG_PATH
,
ConfigFileConst
.
FUZZCONFIG_FILEPATH
))
else
:
else
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录