Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Developertest
提交
4ad7ffbe
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,发现更多精彩内容 >>
提交
4ad7ffbe
编写于
6月 24, 2022
作者:
Y
yangchengdong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
compile and execute command parameter development;Add filter parameters
Signed-off-by:
N
yangchengdong
<
yangchengdong@kaihongdigi.com
>
上级
af06c903
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
57 addition
and
2 deletion
+57
-2
src/core/testcase/testcase_manager.py
src/core/testcase/testcase_manager.py
+57
-2
未找到文件。
src/core/testcase/testcase_manager.py
浏览文件 @
4ad7ffbe
...
...
@@ -18,6 +18,12 @@
import
os
import
copy
import
json
import
sys
from
json
import
JSONDecodeError
from
core.utils
import
get_build_output_path
from
core.common
import
is_open_source_product
from
core.utils
import
get_file_list_by_postfix
from
core.config.config_manager
import
FilterConfigManager
from
xdevice
import
platform_logger
...
...
@@ -79,22 +85,25 @@ class TestCaseManager(object):
"subsystem_name"
,
options
.
productform
)
filter_list_test_file
=
FilterConfigManager
().
get_filtering_list
(
"testfile_name"
,
options
.
productform
)
# 遍历测试用例输出目录下面的所有文件夹,每个文件夹对应一个子系统
for
part_name
in
os
.
listdir
(
test_case_out_path
):
part_case_dir
=
os
.
path
.
join
(
test_case_out_path
,
part_name
)
if
not
os
.
path
.
isdir
(
part_case_dir
):
continue
# 如果子系统在fiter_config.xml配置文件的<subsystem_name>下面配置过,则过滤
if
part_name
in
filter_part_list
:
continue
# 获取子系统目录下面的所有文件路径列表
suite_file_list
=
get_file_list_by_postfix
(
part_case_dir
)
for
suite_file
in
suite_file_list
:
# 如果文件在resource目录下面,需要过滤
if
-
1
!=
suite_file
.
replace
(
test_case_out_path
,
""
).
find
(
os
.
sep
+
"resource"
+
os
.
sep
):
continue
file_name
=
os
.
path
.
basename
(
suite_file
)
# 如果文件在fiter_config.xml配置文件的<testfile_name>下面配置过,则过滤
if
file_name
in
filter_list_test_file
:
continue
...
...
@@ -122,6 +131,27 @@ class TestCaseManager(object):
return
suite_file_dictionary
def
get_acts_test_files
(
self
,
acts_test_case_path
,
options
):
LOG
.
info
(
"acts test case path: "
+
acts_test_case_path
)
acts_suit_file_dic
=
copy
.
deepcopy
(
TESTFILE_TYPE_DATA_DIC
)
if
os
.
path
.
exists
(
acts_test_case_path
):
# 获取acts测试用例输出目录下面的所有文件路径列表
acts_suite_file_list
=
get_file_list_by_postfix
(
acts_test_case_path
)
for
acts_suite_file
in
acts_suite_file_list
:
file_name
=
os
.
path
.
basename
(
acts_suite_file
)
prefix_name
,
suffix_name
=
os
.
path
.
splitext
(
file_name
)
if
suffix_name
!=
".hap"
:
continue
# 如果acts测试指定了-ts,只有完全匹配的HAP包才会加入最终执行的队列
if
options
.
testsuit
!=
""
and
options
.
testsuit
!=
prefix_name
:
continue
if
not
self
.
check_hap_test_file
(
acts_suite_file
):
continue
acts_suit_file_dic
[
"JST"
].
append
(
acts_suite_file
)
else
:
LOG
.
error
(
"acts %s is not exist."
%
acts_test_case_path
)
return
acts_suit_file_dic
@
classmethod
def
get_valid_suite_file
(
cls
,
test_case_out_path
,
suite_file
,
options
):
partlist
=
options
.
partname_list
...
...
@@ -166,3 +196,28 @@ class TestCaseManager(object):
if
filename
.
startswith
(
"test_"
):
return
True
return
False
@
classmethod
def
check_hap_test_file
(
cls
,
hap_file_path
):
try
:
if
hap_file_path
.
endswith
(
".hap"
):
json_file_path
=
hap_file_path
.
replace
(
".hap"
,
".json"
)
if
os
.
path
.
exists
(
json_file_path
):
with
open
(
json_file_path
,
'r'
)
as
json_file
:
data_dic
=
json
.
load
(
json_file
)
if
not
data_dic
:
return
False
else
:
if
"kits"
in
data_dic
.
keys
():
kits_list
=
data_dic
.
get
(
"kits"
)
if
len
(
kits_list
)
>
0
:
kits_dict
=
kits_list
[
0
]
if
"test-file-name"
in
kits_dict
.
keys
():
return
True
else
:
return
False
else
:
return
False
return
False
except
JSONDecodeError
:
return
False
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录