Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Developertest
提交
cc2b66cd
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,发现更多精彩内容 >>
未验证
提交
cc2b66cd
编写于
7月 11, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 11, 2022
浏览文件
操作
浏览文件
下载
差异文件
!142 解决代码检查告警问题 个别功能完善
Merge pull request !142 from shenchunpingkaihong/master
上级
d1044e27
9fedd801
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
83 addition
and
28 deletion
+83
-28
src/core/build/build_manager.py
src/core/build/build_manager.py
+1
-0
src/core/build/build_testcases.py
src/core/build/build_testcases.py
+5
-2
src/core/command/display.py
src/core/command/display.py
+35
-12
src/core/config/config_manager.py
src/core/config/config_manager.py
+6
-1
src/core/driver/drivers.py
src/core/driver/drivers.py
+30
-12
src/core/testcase/testcase_manager.py
src/core/testcase/testcase_manager.py
+4
-0
src/core/utils.py
src/core/utils.py
+2
-1
未找到文件。
src/core/build/build_manager.py
浏览文件 @
cc2b66cd
...
...
@@ -170,6 +170,7 @@ class BuildManager(object):
LOG
.
info
(
"partname_list = %s"
%
str
(
param
.
partname_list
))
LOG
.
info
(
"testmodule = %s"
%
param
.
testmodule
)
LOG
.
info
(
"testsuit = %s"
%
param
.
testsuit
)
LOG
.
info
(
"testcase = %s"
%
param
.
testcase
)
LOG
.
info
(
"--------------------------------------------------"
)
LOG
.
info
(
""
)
...
...
src/core/build/build_testcases.py
浏览文件 @
cc2b66cd
...
...
@@ -203,14 +203,17 @@ class BuildTestcases(object):
build_result
=
False
acts_build_command
=
[]
current_path
=
os
.
getcwd
()
# acts_rootpath = ~/OpenHarmony/test/xts/acts
#
路径
acts_rootpath = ~/OpenHarmony/test/xts/acts
os
.
chdir
(
self
.
xts_project_rootpath
)
acts_build_command
.
append
(
BUILD_PRODUCT_NAME
%
para
.
productform
)
acts_build_command
.
append
(
"system_size=standard"
)
if
len
(
para
.
subsystem
)
>
0
:
acts_build_command
.
append
(
BUILD_TARGET_SUBSYSTEM
%
para
.
subsystem
[
0
])
if
para
.
testsuit
!=
""
:
if
para
.
testsuit
!=
""
and
len
(
para
.
subsystem
)
>
0
:
acts_build_command
.
append
(
BUILD_TARGET_SUITE
%
para
.
testsuit
)
elif
para
.
testsuit
!=
""
and
len
(
para
.
subsystem
)
==
0
:
LOG
.
error
(
"Please specify subsystem."
)
return
if
os
.
path
.
exists
(
BUILD_FILEPATH
):
build_command
=
[
BUILD_FILEPATH
]
build_command
.
extend
(
acts_build_command
)
...
...
src/core/command/display.py
浏览文件 @
cc2b66cd
...
...
@@ -45,15 +45,16 @@ CMD_KEY_PRODUCTLIST = "productlist"
# 测试用例类型
# 1. UT
# 2. MST
# 3. ST
# 4. PERF
# 5. SEC
# 6. FUZZ
# 7. RELI
# 8. DST
# 9. BENCHMARK
# 10. ALL
# 2. ACTS
# 3. MST
# 4. ST
# 5. PERF
# 6. SEC
# 7. FUZZ
# 8. RELI
# 9. DST
# 10. BENCHMARK
# 11. ALL
CMD_KEY_TYPELIST
=
"typelist"
# 子系统名称列表
...
...
@@ -62,6 +63,9 @@ CMD_KEY_SUBSYSTEMLIST = "subsystemlist"
# 子系统下的部件名
CMD_KEY_PARTLIST
=
"partlist"
# acts子系统名称列表
CMD_KEY_SUBSYSTEMLIST_ACTS
=
"actssubsystemlist"
TOOL_VERSION_INFO
=
"""Welcome to DeveloperTest V1.0.0.
"""
...
...
@@ -179,19 +183,20 @@ def select_user_input(data_list):
sys
.
exit
(
0
)
return
select_item_value
,
select_item_index
# 选择productform
def
select_productform
():
select_value
=
"phone"
# scan_support_product() = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568]
#
列表注释
scan_support_product() = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568]
scan_product_list
=
scan_support_product
()
# 从framework_config.xml里取productform节点的value:ipcamera_hispark_aries、ipcamera_hispark_taurus、wifiiot_hispark_pegasus
config_product_list
=
\
FrameworkConfigManager
().
get_framework_config
(
"productform"
)
# productform_list = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568,
# ipcamera_hispark_aries、ipcamera_hispark_taurus、wifiiot_hispark_pegasus]
#
列表注释
productform_list = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568,
#
列表注释
ipcamera_hispark_aries、ipcamera_hispark_taurus、wifiiot_hispark_pegasus]
productform_list
=
scan_product_list
+
config_product_list
if
len
(
productform_list
)
!=
0
:
...
...
@@ -275,6 +280,7 @@ def show_testtype_list():
else
:
print
(
"No category specified."
)
# 从OpenHarmony/out/rk3568/build_configs/infos_for_testfwk.json里的subsystem_infos中subsystem_infos下获取subsystemlist
def
show_subsystem_list
(
product_form
):
print
(
"List of currently supported subsystem names:"
)
...
...
@@ -287,11 +293,25 @@ def show_subsystem_list(product_form):
for
index
,
element
in
enumerate
(
subsystem_name_list
):
print
(
" %d. %s"
%
(
index
+
1
,
element
))
def
show_acts_subsystem_list
():
print
(
"List of currently supported acts subsystem names:"
)
sub_list
=
[
'global'
,
'security'
,
'useriam'
,
'multimedia'
,
'appexecfwk'
,
'account'
,
'communication'
,
'notification'
,
'ability'
,
'miscservices'
,
'powermgr'
,
'startup'
,
'sensor'
,
'distributeddatamgr'
,
'update'
,
'graphic'
,
'arkui'
,
'storage'
,
'compileruntime'
,
'usb'
,
'multimodalinput'
,
'resourceschedule'
,
'telephony'
,
'hiviewdfx'
,
'location'
,
'barrierfree'
,
'customization'
]
sub_list
.
sort
()
for
index
,
element
in
enumerate
(
sub_list
):
print
(
" %d. %s"
%
(
index
+
1
,
element
.
strip
()))
print
(
"end"
)
# 从OpenHarmony/out/rk3568/build_configs/infos_for_testfwk.json里的subsystem_infos中subsystem_infos下获取partlist
def
show_partname_list
(
product_form
):
print
(
"List of currently supported part names:"
)
parser
=
ParsePartsConfig
(
product_form
)
subsystem_name_list
=
parser
.
get_subsystem_name_list
()
if
len
(
subsystem_name_list
)
==
0
:
return
...
...
@@ -304,6 +324,7 @@ def show_partname_list(product_form):
for
index
,
element
in
enumerate
(
part_name_list
):
print
(
" %d. %s"
%
(
index
+
1
,
element
))
def
display_help_command_info
(
command
):
if
command
==
ToolCommandType
.
TOOLCMD_KEY_SHOW
:
print
(
SUPPORT_COMMAND_SHOW
)
...
...
@@ -326,6 +347,8 @@ def display_show_command_info(command, product_form="phone"):
show_subsystem_list
(
product_form
)
elif
command
==
CMD_KEY_PARTLIST
:
show_partname_list
(
product_form
)
elif
command
==
CMD_KEY_SUBSYSTEMLIST_ACTS
:
show_acts_subsystem_list
()
else
:
print
(
"This command is not support."
)
...
...
src/core/config/config_manager.py
浏览文件 @
cc2b66cd
...
...
@@ -29,8 +29,10 @@ LOG = platform_logger("config_manager")
# 变量注释 CONFIG_PATH = OpenHarmony/test/developertest/config
CONFIG_PATH
=
os
.
path
.
join
(
sys
.
framework_res_dir
,
"config"
)
# framework_config.xml
class
FrameworkConfigManager
(
object
):
def
__init__
(
self
,
filepath
=
""
):
if
filepath
==
""
:
...
...
@@ -40,9 +42,10 @@ class FrameworkConfigManager(object):
else
:
self
.
filepath
=
filepath
# 获取framework_config.xml中所有name的value,返回列表
def
get_framework_config
(
self
,
target_name
):
# 获取framework_config.xml中所有name的value,返回列表
data_list
=
[]
try
:
if
os
.
path
.
exists
(
self
.
filepath
):
...
...
@@ -125,6 +128,7 @@ class FilterConfigManager(object):
def
get_filter_config_path
(
self
):
return
self
.
filepath
# 这里的filepath不存在
class
ResourceConfigManager
(
object
):
def
__init__
(
self
,
filepath
=
""
):
...
...
@@ -307,6 +311,7 @@ class BuildConfigManager(object):
def
get_build_path
(
self
):
return
self
.
filepath
class
FuzzerConfigManager
(
object
):
def
__init__
(
self
,
config_path
=
""
):
if
config_path
==
""
:
...
...
src/core/driver/drivers.py
浏览文件 @
cc2b66cd
...
...
@@ -99,6 +99,8 @@ class DisplayOutputReceiver:
class
GTestConst
(
object
):
exec_para_filter
=
"--gtest_filter"
exec_para_level
=
"--gtest_testsize"
exec_acts_para_filter
=
"--jstest_filter"
exec_acts_para_level
=
"--jstest_testsize"
def
get_device_log_file
(
report_path
,
serial
=
None
,
log_name
=
"device_log"
):
...
...
@@ -671,12 +673,9 @@ class JSUnitTestDriver(IDriver):
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
)
resource_manager
.
process_preparer_data
(
resource_data_dic
,
resource_dir
,
self
.
config
.
device
)
main_result
=
self
.
_install_hap
(
suite_file
)
result
=
ResultManager
(
suite_file
,
self
.
config
)
if
main_result
:
self
.
_execute_hapfile_jsunittest
()
try
:
...
...
@@ -686,8 +685,7 @@ class JSUnitTestDriver(IDriver):
if
timeout
:
actiontime
=
timeout
times
=
1
device_log_file_open
=
os
.
open
(
device_log_file
,
os
.
O_RDONLY
,
stat
.
S_IWUSR
|
stat
.
S_IRUSR
)
device_log_file_open
=
os
.
open
(
device_log_file
,
os
.
O_RDONLY
,
stat
.
S_IWUSR
|
stat
.
S_IRUSR
)
with
os
.
fdopen
(
device_log_file_open
,
"r"
,
encoding
=
'utf-8'
)
\
as
file_read_pipe
:
for
i
in
range
(
0
,
times
):
...
...
@@ -704,7 +702,6 @@ class JSUnitTestDriver(IDriver):
break
if
int
(
time
.
time
())
-
start_time
>
5
:
break
finally
:
_lock_screen
(
self
.
config
.
device
)
self
.
_uninstall_hap
(
self
.
package_name
)
...
...
@@ -712,8 +709,7 @@ class JSUnitTestDriver(IDriver):
self
.
result
=
result
.
get_test_results
(
"Error: install hap failed"
)
LOG
.
error
(
"Error: install hap failed"
)
resource_manager
.
process_cleaner_data
(
resource_data_dic
,
resource_dir
,
self
.
config
.
device
)
resource_manager
.
process_cleaner_data
(
resource_data_dic
,
resource_dir
,
self
.
config
.
device
)
def
generate_console_output
(
self
,
device_log_file
,
request
):
result_message
=
self
.
read_device_log
(
device_log_file
)
...
...
@@ -808,6 +804,28 @@ class JSUnitTestDriver(IDriver):
_sleep_according_to_result
(
return_message
)
return
return_message
@
staticmethod
def
_get_acts_test_para
(
testcase
,
testlevel
,
testtype
,
target_test_path
,
suite_file
,
filename
):
if
"actstest"
==
testtype
[
0
]:
test_para
=
(
" --actstest_out_format=json"
" --actstest_out=%s%s.json"
)
%
(
target_test_path
,
filename
)
return
test_para
if
""
!=
testcase
and
""
==
testlevel
:
test_para
=
"%s=%s"
%
(
GTestConst
.
exec_acts_para_filter
,
testcase
)
elif
""
==
testcase
and
""
!=
testlevel
:
level_para
=
get_level_para_string
(
testlevel
)
test_para
=
"%s=%s"
%
(
GTestConst
.
exec_acts_para_level
,
level_para
)
else
:
test_para
=
""
return
test_para
@
classmethod
def
_get_json_shell_timeout
(
cls
,
json_filepath
):
test_timeout
=
300
...
...
@@ -824,12 +842,14 @@ class JSUnitTestDriver(IDriver):
return
test_timeout
except
JSONDecodeError
:
return
test_timeout
finally
:
print
(
" get json shell timeout finally"
)
@
staticmethod
def
_get_package_and_ability_name
(
hap_filepath
):
package_name
=
""
ability_name
=
""
if
os
.
path
.
exists
(
hap_filepath
):
filename
=
os
.
path
.
basename
(
hap_filepath
)
...
...
@@ -863,7 +883,6 @@ class JSUnitTestDriver(IDriver):
package_name
=
profile
.
get
(
"package"
)
if
not
package_name
:
continue
abilities
=
profile
.
get
(
"abilities"
)
for
abilitie
in
abilities
:
abilities_name
=
abilitie
.
get
(
"name"
)
...
...
@@ -880,5 +899,4 @@ class JSUnitTestDriver(IDriver):
shutil
.
rmtree
(
hap_bak_path
)
else
:
print
(
"file %s not exist"
%
hap_filepath
)
return
package_name
,
ability_name
src/core/testcase/testcase_manager.py
浏览文件 @
cc2b66cd
...
...
@@ -189,6 +189,7 @@ class TestCaseManager(object):
break
return
is_valid_status
@
classmethod
def
check_python_test_file
(
cls
,
suite_file
):
if
suite_file
.
endswith
(
".py"
):
...
...
@@ -197,6 +198,7 @@ class TestCaseManager(object):
return
True
return
False
@
classmethod
def
check_hap_test_file
(
cls
,
hap_file_path
):
try
:
...
...
@@ -221,3 +223,5 @@ class TestCaseManager(object):
return
False
except
JSONDecodeError
:
return
False
finally
:
print
(
" check hap test file finally"
)
src/core/utils.py
浏览文件 @
cc2b66cd
...
...
@@ -49,6 +49,7 @@ def get_file_list(find_path, postfix=""):
file_list
.
append
(
file_name
)
return
file_list
# 获取目录下每一个文件,并放到一个列表里
def
get_file_list_by_postfix
(
path
,
postfix
=
""
):
file_list
=
[]
...
...
@@ -102,7 +103,7 @@ def get_build_output_path(product_form):
def
scan_support_product
():
# scan standard and large system info
# product_form_dir = OpenHarmony/productdefine/common/products/
#
路径注释
product_form_dir = OpenHarmony/productdefine/common/products/
product_form_dir
=
os
.
path
.
join
(
sys
.
source_code_root_path
,
"productdefine"
,
"common"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录