Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Applications Sample Wifi Iot
提交
3f944885
A
Applications Sample Wifi Iot
项目概览
OpenHarmony
/
Applications Sample Wifi Iot
10 个月 前同步成功
通知
3
Star
24
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Applications Sample Wifi Iot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
3f944885
编写于
5月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!73 进程检查迁移到冒烟
Merge pull request !73 from lnlan/master
上级
23c58261
37d8251b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
103 addition
and
39 deletion
+103
-39
screenshot/resource/app_capture_screen_test_config.json
screenshot/resource/app_capture_screen_test_config.json
+4
-4
screenshot/resource/capturescreentest.py
screenshot/resource/capturescreentest.py
+92
-30
screenshot/resource/process.txt
screenshot/resource/process.txt
+7
-5
未找到文件。
screenshot/resource/app_capture_screen_test_config.json
浏览文件 @
3f944885
[
{
"DEVICE_1"
:[
1
,
2
,
3
,
4
,
5
],
"DEVICE_2"
:[
6
,
7
,
8
,
9
,
10
,
11
],
"DEVICE_1"
:[
1
,
2
,
3
,
4
,
5
,
8
],
"DEVICE_2"
:[
6
,
7
,
9
,
10
,
11
],
"return-x-y"
:[
210
,
1240
],
"recent-x-y"
:[
515
,
1240
],
"home-x-y"
:[
360
,
1240
],
...
...
@@ -98,8 +98,8 @@
"entry"
:
"aa start -a com.ohos.settings.MainAbility -b com.ohos.settings"
,
"compress_log"
:[
"cd /data/log/hilog && tar -cf settings_keyboard_log.tar *"
],
"all_actions"
:
[
[
3
,
"shot_cmd"
,
"settings"
],
[
3
,
"cmp_cmd-level"
],
[
3
,
360
,
185
],
[
3
,
360
,
185
],
[
20
,
360
,
90
],
[
3
,
360
,
90
],
[
3
,
"shot_cmd"
,
"keyboard"
],
[
3
,
"recent-x-y"
],
[
3
,
"recent_del-x-y"
],
[
3
,
"recent-x-y"
],
[
3
,
"recent_del-x-y"
],
[
3
,
"cmp_cmd-level"
,
200000
],
[
2
,
"stop_hilog"
],
[
2
,
"compress_log"
],
[
2
,
"get_file_from_dev"
,
"/data/log/hilog/settings_keyboard_log.tar"
]
[
2
,
"shot_cmd"
,
"settings"
],
[
2
,
"cmp_cmd-level"
],
[
2
,
360
,
185
],
[
2
,
360
,
185
],
[
2
,
360
,
90
],
[
2
,
360
,
90
],
[
2
,
"shot_cmd"
,
"keyboard"
],
[
2
,
"recent-x-y"
],
[
2
,
"recent_del-x-y"
],
[
2
,
"recent-x-y"
],
[
2
,
"recent_del-x-y"
],
[
2
,
"cmp_cmd-level"
,
200000
],
[
2
,
"stop_hilog"
],
[
2
,
"compress_log"
],
[
2
,
"get_file_from_dev"
,
"/data/log/hilog/settings_keyboard_log.tar"
]
]
},
{
...
...
screenshot/resource/capturescreentest.py
浏览文件 @
3f944885
...
...
@@ -41,7 +41,7 @@ def EnterCmd(mycmd, waittime = 0, printresult = 1):
EnterCmdRetry
-=
1
try
:
p
=
subprocess
.
Popen
(
mycmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
result
,
unused_err
=
p
.
communicate
(
timeout
=
1
5
)
result
,
unused_err
=
p
.
communicate
(
timeout
=
2
5
)
try
:
result
=
result
.
decode
(
encoding
=
"utf-8"
)
except
UnicodeDecodeError
:
...
...
@@ -50,9 +50,9 @@ def EnterCmd(mycmd, waittime = 0, printresult = 1):
except
Exception
as
e
:
result
=
'retry failed again'
PrintToLog
(
e
)
PrintToLog
(
"cmd_retry_trace_{}
.png"
.
format
(
CmdRetryCnt
))
os
.
system
(
"hdc_std -t {} shell
\"
snapshot_display -f /data/cmd_retry_trace_{}
.png
\"
"
.
format
(
args
.
device_num
,
CmdRetryCnt
))
GetFileFromDev
(
"/data/cmd_retry_trace_{}
.png"
.
format
(
CmdRetryCnt
),
args
.
save_path
)
PrintToLog
(
"cmd_retry_trace_{}
_{}.png"
.
format
(
args
.
device_num
,
CmdRetryCnt
))
os
.
system
(
"hdc_std -t {} shell
\"
snapshot_display -f /data/cmd_retry_trace_{}
_{}.png
\"
"
.
format
(
args
.
device_num
,
args
.
device_num
,
CmdRetryCnt
))
GetFileFromDev
(
"/data/cmd_retry_trace_{}
_{}.png"
.
format
(
args
.
device_num
,
CmdRetryCnt
),
args
.
save_path
)
CmdRetryCnt
+=
1
p
.
kill
()
if
printresult
==
1
:
...
...
@@ -84,7 +84,7 @@ def GetFileFromDev(src, dst):
cmd
=
"hdc_std -t {} file recv
\"
{}
\"
\"
{}
\"
"
.
format
(
args
.
device_num
,
src
,
dst
)
return
EnterCmd
(
cmd
,
1
,
1
)
def
connect_to_w
ifi
(
tools_path
):
def
ConnectToW
ifi
(
tools_path
):
EnterShellCmd
(
"mkdir /data/l2tool"
,
1
)
SendFileToDev
(
os
.
path
.
normpath
(
os
.
path
.
join
(
tools_path
,
"l2tool/busybox"
)),
"/data/l2tool/"
)
SendFileToDev
(
os
.
path
.
normpath
(
os
.
path
.
join
(
tools_path
,
"l2tool/dhcpc.sh"
)),
"/data/l2tool/"
)
...
...
@@ -97,7 +97,7 @@ def connect_to_wifi(tools_path):
PrintToLog
(
"hdc_std shell ./data/l2tool/busybox udhcpc -i wlan0 -s /data/l2tool/dhcpc.sh"
)
p
=
subprocess
.
check_output
(
shlex
.
split
(
"hdc_std -t {} shell ./data/l2tool/busybox udhcpc -i wlan0 -s /data/l2tool/dhcpc.sh"
.
format
(
args
.
device_num
)),
timeout
=
8
)
PrintToLog
(
p
.
decode
(
encoding
=
"utf-8"
))
with
open
(
os
.
path
.
join
(
args
.
save_path
,
'shot_test_{}.bat'
.
format
(
args
.
device_num
)),
mode
=
'a'
,
encoding
=
'utf-8'
)
as
cmd_file
:
with
open
(
os
.
path
.
join
(
args
.
save_path
,
'shot_test_{}.bat'
.
format
(
args
.
device_num
)),
mode
=
'a'
,
encoding
=
'utf-8'
)
as
cmd_file
:
cmd_file
.
write
(
'hdc_std shell ./data/l2tool/busybox udhcpc -i wlan0 -s /data/l2tool/dhcpc.sh'
+
'
\n
'
)
cmd_file
.
close
()
ret_code
=
0
...
...
@@ -139,10 +139,7 @@ if __name__ == "__main__":
with
open
(
args
.
config
)
as
f
:
all_app
=
json
.
load
(
f
)
with
open
(
os
.
path
.
join
(
args
.
save_path
,
'shot_test_{}.bat'
.
format
(
args
.
device_num
)),
mode
=
'w'
,
encoding
=
'utf-8'
)
as
cmd_file
:
cmd_file
.
close
()
with
open
(
os
.
path
.
join
(
args
.
save_path
,
'shot_test_{}.log'
.
format
(
args
.
device_num
)),
mode
=
'w'
,
encoding
=
'utf-8'
)
as
log_file
:
log_file
.
close
()
cmp_status
=
0
global_pos
=
all_app
[
0
]
...
...
@@ -163,8 +160,8 @@ if __name__ == "__main__":
rmlockcnt
-=
1
EnterShellCmd
(
"hilog -w stop"
,
1
)
EnterShellCmd
(
"cd /data/log/hilog && tar -cf system_start_log
.tar *"
,
1
)
GetFileFromDev
(
"/data/log/hilog/system_start_log
.tar"
,
args
.
save_path
)
EnterShellCmd
(
"cd /data/log/hilog && tar -cf system_start_log
_{}.tar *"
.
format
(
args
.
device_num
)
,
1
)
GetFileFromDev
(
"/data/log/hilog/system_start_log
_{}.tar"
.
format
(
args
.
device_num
)
,
args
.
save_path
)
#print(os.path.normpath(os.path.join(args.anwser_path, "launcher.pngraw")))
SendFileToDev
(
os
.
path
.
normpath
(
os
.
path
.
join
(
args
.
anwser_path
,
"launcher.pngraw"
)),
"/data/screen_test/train_set"
)
EnterShellCmd
(
"/data/screen_test/printscreen -f /data/screen_test/rmlock.png"
,
1
)
...
...
@@ -180,17 +177,43 @@ if __name__ == "__main__":
os
.
system
(
"hdc_std -t {} shell reboot"
.
format
(
args
.
device_num
))
for
i
in
range
(
5
):
EnterCmd
(
"hdc_std list targets"
,
10
)
else
:
PrintToLog
(
"remove lock failed
\n\n
"
)
break
PrintToLog
(
"
\n\n
########## First check key processes start ##############"
)
lose_process
=
[]
process_pid
=
{}
with
open
(
os
.
path
.
normpath
(
os
.
path
.
join
(
args
.
tools_path
,
"resource/process.txt"
)),
"r+"
)
as
f
:
text
=
f
.
read
()
two_check_process_list
=
text
.
split
(
'#####'
)[
1
].
split
()[
0
:
-
1
]
other_process_list
=
text
.
split
(
'#####'
)[
2
].
split
()
for
pname
in
two_check_process_list
+
other_process_list
:
pids
=
EnterCmd
(
"hdc_std -t {} shell pidof {}"
.
format
(
args
.
device_num
,
pname
),
0
,
1
)
try
:
pidlist
=
pids
.
split
()
int
(
pidlist
[
0
])
for
pid
in
pidlist
:
int
(
pid
)
process_pid
[
pname
]
=
pidlist
except
:
lose_process
.
append
(
pname
)
if
lose_process
:
PrintToLog
(
"
\n\n
ERROR: %s, These processes are not exist!!!
\n
"
%
lose_process
)
PrintToLog
(
"SmokeTest find some fatal problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
99
)
else
:
PrintToLog
(
"First processes check is ok
\n
"
)
try
:
args
.
test_num
.
index
(
'/'
)
idx_total
=
args
.
test_num
.
split
(
'/'
)
if
len
(
idx_total
)
!=
2
:
PrintToLog
(
"test_num is invaild !!!"
)
PrintToLog
(
"SmokeTest find some key problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
1
)
sys
.
exit
(
98
)
elif
idx_total
[
1
]
==
'1'
:
idx_list
=
list
(
range
(
1
,
len
(
all_app
)))
else
:
...
...
@@ -198,7 +221,6 @@ if __name__ == "__main__":
except
ValueError
as
e
:
PrintToLog
(
e
)
idx_list
=
list
(
map
(
eval
,
args
.
test_num
.
split
()))
PrintToLog
(
idx_list
)
fail_idx_list
=
[]
...
...
@@ -237,20 +259,15 @@ if __name__ == "__main__":
else
:
pic_name
=
"{}{}"
.
format
(
single_app
[
'app_name'
],
".png"
)
raw_pic_name
=
single_app
[
'app_name'
]
+
".pngraw"
EnterShellCmd
(
"rm /data/screen_test/{}_{}*"
.
format
(
6
-
testcnt
,
pic_name
),
1
)
EnterShellCmd
(
capture_screen_cmd
.
format
(
6
-
testcnt
,
pic_name
),
1
)
GetFileFromDev
(
"/data/screen_test/{}_{}"
.
format
(
6
-
testcnt
,
pic_name
),
args
.
save_path
)
p
=
EnterShellCmd
(
"ls -al /data/screen_test/{}_{}"
.
format
(
6
-
testcnt
,
raw_pic_name
),
1
)
no_such
=
re
.
findall
(
r
'No such file or directory'
,
p
)
PrintToLog
(
no_such
)
if
type
(
no_such
)
==
list
and
len
(
no_such
)
>
0
and
no_such
[
0
]
==
'No such file or directory'
:
PrintToLog
(
"ERROR: {} screenshot failed!
\n\n
"
.
format
(
raw_pic_name
))
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
255
)
next_cmd
=
""
#cmp_cmd-level is stable, different to other cmd,so handle it specialy
elif
type
(
single_action
[
1
])
==
str
and
single_action
[
1
]
==
'cmp_cmd-level'
:
next_cmd
=
""
sys
.
stdout
.
flush
()
EnterShellCmd
(
"rm /data/train_set/{}"
.
format
(
raw_pic_name
),
1
)
SendFileToDev
(
os
.
path
.
normpath
(
os
.
path
.
join
(
args
.
anwser_path
,
raw_pic_name
)),
"/data/screen_test/train_set"
)
new_cmp_cmd
=
cmp_cmd
.
format
(
6
-
testcnt
,
raw_pic_name
,
raw_pic_name
)
if
len
(
single_action
)
==
3
:
...
...
@@ -258,16 +275,24 @@ if __name__ == "__main__":
else
:
tolerance
=
global_pos
[
'cmp_cmd-level'
][
1
]
p
=
EnterShellCmd
(
new_cmp_cmd
,
single_action
[
0
])
no_such
=
re
.
findall
(
r
'No such file or directory'
,
p
)
PrintToLog
(
no_such
)
if
type
(
no_such
)
==
list
and
len
(
no_such
)
>
0
and
no_such
[
0
]
==
'No such file or directory'
:
PrintToLog
(
"ERROR: {} screenshot failed!
\n\n
"
.
format
(
raw_pic_name
))
PrintToLog
(
"SmokeTest find some key problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
98
)
num
=
re
.
findall
(
r
'[-+]?\d+'
,
p
)
PrintToLog
(
num
)
if
type
(
num
)
==
list
and
len
(
num
)
>
0
and
int
(
num
[
0
])
<
tolerance
:
testok
=
1
if
testok
==
0
:
testok
=
1
PrintToLog
(
"{} screenshot check is ok!
\n\n
"
.
format
(
raw_pic_name
))
else
:
testok
=
-
1
PrintToLog
(
"{} screenshot check is abnarmal!
\n\n
"
.
format
(
raw_pic_name
))
sys
.
stdout
.
flush
()
if
testok
==
1
or
testcnt
==
1
:
if
testok
==
1
or
testcnt
==
1
or
smoke_first_failed
!=
''
:
old_name
=
os
.
path
.
normpath
(
os
.
path
.
join
(
args
.
save_path
,
"{}_{}"
.
format
(
6
-
testcnt
,
pic_name
)))
GetFileFromDev
(
"/data/screen_test/{}_{}"
.
format
(
6
-
testcnt
,
raw_pic_name
),
args
.
save_path
)
os
.
system
(
"rename {} {}"
.
format
(
old_name
,
pic_name
))
...
...
@@ -287,7 +312,7 @@ if __name__ == "__main__":
EnterCmd
(
"hdc_std -t {} file send
\"
{}
\"
\"
{}
\"
"
.
format
(
args
.
device_num
,
os
.
path
.
normpath
(
os
.
path
.
join
(
args
.
tools_path
,
single_action
[
2
])),
single_action
[
3
]))
elif
type
(
single_action
[
1
])
==
str
and
single_action
[
1
]
==
'connect_wifi'
:
next_cmd
=
""
connect_to_w
ifi
(
args
.
tools_path
)
ConnectToW
ifi
(
args
.
tools_path
)
#other cmd handle
elif
type
(
single_action
[
1
])
==
str
:
if
single_action
[
1
]
not
in
single_app
.
keys
():
...
...
@@ -338,15 +363,52 @@ if __name__ == "__main__":
if
smoke_first_failed
==
'launcher'
:
break
EnterShellCmd
(
"cd /data/log/faultlog/temp && tar -cf after_test_crash_log.tar cppcrash*"
)
EnterCmd
(
"hdc_std -t {} file recv /data/log/faultlog/temp/after_test_crash_log.tar {}"
.
format
(
args
.
device_num
,
os
.
path
.
normpath
(
args
.
save_path
)))
#key processes second check, and cmp to first check
PrintToLog
(
"
\n\n
########## Second check key processes start ##############"
)
second_check_lose_process
=
[]
for
pname
in
two_check_process_list
+
other_process_list
:
pids
=
EnterCmd
(
"hdc_std -t {} shell pidof {}"
.
format
(
args
.
device_num
,
pname
),
0
,
1
)
try
:
pidlist
=
pids
.
split
()
if
process_pid
[
pname
]
!=
pidlist
:
if
pname
in
two_check_process_list
:
PrintToLog
(
"ERROR: pid of %s is different the first check"
%
pname
)
PrintToLog
(
"SmokeTest find some fatal problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
99
)
else
:
PrintToLog
(
"WARNNING: pid of %s is different the first check"
%
pname
)
elif
len
(
pidlist
)
!=
1
:
if
pname
in
two_check_process_list
:
PrintToLog
(
"ERROR: pid of %s is not only one"
%
pname
)
PrintToLog
(
"SmokeTest find some fatal problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
99
)
else
:
PrintToLog
(
"WARNNING: pid of %s is not only one"
%
pname
)
except
:
second_check_lose_process
.
append
(
pname
)
if
second_check_lose_process
:
PrintToLog
(
"ERROR: pid of %s is not exist"
%
pname
)
PrintToLog
(
"SmokeTest find some fatal problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
99
)
else
:
PrintToLog
(
"Second processes check is ok
\n
"
)
EnterShellCmd
(
"cd /data/log/faultlog/temp && tar -cf after_test_crash_log_{}.tar cppcrash*"
.
format
(
args
.
device_num
))
GetFileFromDev
(
"/data/log/faultlog/temp/after_test_crash_log_{}.tar"
.
format
(
args
.
device_num
),
os
.
path
.
normpath
(
args
.
save_path
))
if
len
(
fail_idx_list
)
!=
0
:
PrintToLog
(
"ERROR: name {}, index {}, these testcase is failed"
.
format
(
fail_name_list
,
fail_idx_list
))
if
fail_name_list
.
count
(
'launcher'
)
or
fail_name_list
.
count
(
'settings_keyboard'
):
PrintToLog
(
"End of check, Some Key APPs(launcher or setting) failed!"
)
PrintToLog
(
"SmokeTest find some fatal problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
99
)
PrintToLog
(
"SmokeTest find some key problems!"
)
PrintToLog
(
"End of check, test failed!"
)
sys
.
exit
(
98
)
else
:
PrintToLog
(
"All testcase is ok"
)
PrintToLog
(
"End of check, test succeeded!"
)
sys
.
stdout
.
flush
()
sys
.
exit
(
len
(
fail_idx_list
))
\ No newline at end of file
sys
.
exit
(
0
)
\ No newline at end of file
screenshot/resource/process.txt
浏览文件 @
3f944885
####First_check_at_begin__Second_check_at_end__Two_results_must_be_same#####
com.ohos.launcher:extension_process
render_service
####only_check_these_processes_are_exitst#####
hdf_devmgr
param_watcher
storage_manager
...
...
@@ -8,7 +13,6 @@ storage_daemon
udevd
uinput_inject
multimodalinput
token_sync_serv
huks_service
memmgrservice
bluetooth_servi
...
...
@@ -33,7 +37,6 @@ inputmethod_ser
ui_service
fms_service
distributedfile
distributedfile
netmanager
battery_stats
dslm_service
...
...
@@ -46,7 +49,6 @@ hiview
telephony
usb_service
camera_service
render_service
thermal
foundation
accesstoken_ser
...
...
@@ -65,5 +67,5 @@ blue_host
wifi_hal_service
com.ohos.systemui:extension_process
device_usage_st
com.ohos.launcher:extension_process
power_host
\ No newline at end of file
power_host
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录