未验证 提交 684c4d7a 编写于 作者: O openharmony_ci 提交者: Gitee

!85 添加关键进程的crash检查

Merge pull request !85 from hongshaojie/pr
......@@ -20,8 +20,9 @@
"entry": "",
"compress_file_recv":["cd /data/log/faultlog/temp && tar -cf crash_log.tar cppcrash*"],
"crash_check":["ls /data/log/faultlog/temp/ -al | wc -l", ""],
"clear_faultlog":["rm /data/log/faultlog/temp/*"],
"all_actions": [
[1, "remount"], [1, "crash_check"], [1, "compress_file_recv"], [1, "get_file_from_dev", "/data/log/faultlog/temp/crash_log.tar"]
[1, "remount"], [1, "process_crash_check", "foundation"], [1, "process_crash_check", "render_service"], [1, "process_crash_check", "appspawn"], [1, "compress_file_recv"], [1, "get_file_from_dev", "/data/log/faultlog/temp/crash_log.tar"]
]
},
{
......@@ -51,13 +52,13 @@
"start_test":["aa start -a ohos.acts.multimedia.video.videoplayer.MainAbility -b ohos.acts.multimedia.video.videoplayer"],
"recover_log":["cd data/log/hilog/;hilog -x > video_log.txt"],
"check_result":["cd /data/log/hilog && grep -nr 'total cases'", "failure 0,error 0,pass 1"],
"compress_log":["cd /data/log/hilog && tar -cf video_log.tar video_*"],
"compress_log":["cd /data/log/hilog && tar -cf video_log.tar *"],
"clear_log":["rm /data/log/hilog/*"],
"all_actions": [
[2, "install_hap", "vediotest/ActsVideoPlayerJsTest.hap"], [1, "mk_test_dir"], [1, "remount"],
[1,"close_auto_log"], [1,"start_video_log"], [2, "install_hap", "vediotest/ActsVideoPlayerJsTest.hap"], [1, "mk_test_dir"], [1, "remount"],
[1, "send_file_to_dev", "vediotest/H264_AAC.mp4", "/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/"],
[15, "start_test"], [1, "stop_hilog"], [1, "check_result"], [1, "compress_log"],
[1, "get_file_from_dev", "/data/log/hilog/video_log.tar"], [1, "clear_log"], [2, "recent-x-y"], [2, "recent_del-x-y"], [2, "recent-x-y"], [2, "recent_del-x-y"]
[15, "start_test"], [1, "recover_log"], [1, "stop_hilog"], [1, "check_result"], [1, "compress_log"],
[1, "get_file_from_dev", "/data/log/hilog/video_log.tar"], [2, "recent-x-y"], [2, "recent_del-x-y"], [2, "home-x-y"], [2, "recent-x-y"], [2, "recent_del-x-y"], [2, "home-x-y"]
]
},
{
......@@ -83,7 +84,7 @@
"recover_log":["cd data/log/hilog/;hilog -x > camera_log.txt;hilog -b D"],
"all_actions": [
[1, "close_auto_log"], [1, "open_camera_log"], [5, "start_camera"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [1, "recover_log"], [1, "check_result"],
[1, "shot_cmd"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/camera_log.tar"]
[1, "shot_cmd"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/camera_log.tar"], [2, "home-x-y"], [2, "home-x-y"]
]
},
{
......@@ -91,18 +92,25 @@
"entry": "aa start -a com.ohos.settings.MainAbility -b com.ohos.settings",
"compress_log":["cd /data/log/hilog && tar -cf settings_log.tar *"],
"all_actions": [
[2, "shot_cmd", "settings"], [1, "cmp_cmd-level"], [2, "recent-x-y"], [2, "recent_del-x-y"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "stop_hilog"], [1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/settings_log.tar"]
[2, "shot_cmd", "settings"], [1, "cmp_cmd-level"], [2, "recent-x-y"], [2, "recent_del-x-y"], [2, "home-x-y"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "stop_hilog"],
[1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/settings_log.tar"], [2, "home-x-y"]
]
},
{
"app_name": "photos",
"entry": "aa start -a com.ohos.photos.MainAbility -b com.ohos.photos",
"all_actions": [[2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "shot_cmd"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "cmp_cmd-level", 200000], [1, "recent-x-y"], [1, "recent_del-x-y"]]
"all_actions": [
[2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "shot_cmd"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "cmp_cmd-level", 200000],
[2, "home-x-y"], [1, "recent-x-y"], [1, "recent_del-x-y"], [2, "home-x-y"]
]
},
{
"app_name": "note",
"entry": "aa start -a MainAbility -b com.ohos.note",
"compress_log":["cd /data/log/hilog && tar -cf note_log.tar *"],
"all_actions": [[2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "shot_cmd"], [2, "recent-x-y"], [2, "recent_del-x-y"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "cmp_cmd-level"], [1, "stop_hilog"], [1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/note_log.tar"]]
"all_actions": [
[2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [2, "shot_cmd"], [2, "recent-x-y"], [2, "recent_del-x-y"], [2, "home-x-y"],
[2, "recent-x-y"], [2, "recent_del-x-y"], [1, "cmp_cmd-level"], [1, "stop_hilog"], [1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/note_log.tar"], [2, "home-x-y"]
]
}
]
......@@ -70,6 +70,11 @@ def EnterCmd(mycmd, waittime = 0, printresult = 1):
cmd_file.close()
return result
def SysExit():
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))
sys.exit(99)
def EnterShellCmd(shellcmd, waittime = 0, printresult = 1):
if shellcmd == "":
return
......@@ -147,10 +152,7 @@ if __name__ == "__main__":
rebootcnt = 2
while rebootcnt:
rebootcnt -= 1
#os.system("hdc_std start")
EnterCmd("hdc_std list targets", 1)
#EnterCmd("hdc_std list targets", 1)
#EnterShellCmd("rm -rf /data/screen_test/train_set")
EnterShellCmd("mkdir -p /data/screen_test/train_set")
SendFileToDev(os.path.normpath(os.path.join(args.tools_path, "resource/printscreen")), "/data/screen_test/")
EnterShellCmd("chmod 777 /data/screen_test/printscreen")
......@@ -183,7 +185,7 @@ if __name__ == "__main__":
PrintToLog("ERROR: remove lock failed\n\n")
PrintToLog("SmokeTest find some fatal problems!")
PrintToLog("End of check, test failed!")
sys.exit(99)
SysExit()
PrintToLog("\n\n########## First check key processes start ##############")
lose_process = []
......@@ -213,7 +215,7 @@ if __name__ == "__main__":
PrintToLog("\n\nERROR: %s, These processes are not exist!!!\n" % lose_process)
PrintToLog("SmokeTest find some fatal problems!")
PrintToLog("End of check, test failed!")
sys.exit(99)
SysExit()
else:
PrintToLog("First processes check is ok\n")
......@@ -319,6 +321,23 @@ if __name__ == "__main__":
elif type(single_action[1]) == str and single_action[1] == 'connect_wifi':
next_cmd = ""
ConnectToWifi(args.tools_path)
#process_crash_check
elif type(single_action[1]) == str and single_action[1] == 'process_crash_check':
next_cmd = ""
if len(single_action) == 3:
p = EnterShellCmd("cd /data/log/faultlog/temp && grep \"Process name\" -rnw ./", single_action[0])
result = "".join(p)
findsome = result.find(single_action[2], 0, len(result))
if findsome != -1:
testok = -1
PrintToLog("\"{}\" ERROR:find crux crash \"{}\"!\n".format(single_action[1], single_action[2]))
PrintToLog("SmokeTest find some fatal problems!")
PrintToLog("End of check, test failed!")
SysExit()
else:
testok = 1
PrintToLog("\"{}\" check execut result is ok, not find crux crash \"{}\"!\n".format(single_action[1], single_action[2]))
sys.stdout.flush()
#other cmd handle
elif type(single_action[1]) == str:
if single_action[1] not in single_app.keys():
......@@ -368,7 +387,7 @@ if __name__ == "__main__":
EnterShellCmd("hilog -w stop", 1)
if smoke_first_failed == 'launcher':
break
#key processes second check, and cmp to first check
PrintToLog("\n\n########## Second check key processes start ##############")
second_check_lose_process = []
......@@ -382,7 +401,7 @@ if __name__ == "__main__":
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)
SysExit()
else:
PrintToLog("WARNNING: pid of %s is different the first check" % pname)
elif len(pidlist) != 1:
......@@ -390,7 +409,7 @@ if __name__ == "__main__":
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)
SysExit()
else:
PrintToLog("WARNNING: pid of %s is not only one" % pname)
except:
......@@ -400,7 +419,7 @@ if __name__ == "__main__":
PrintToLog("ERROR: pid of %s is not exist" % pname)
PrintToLog("SmokeTest find some fatal problems!")
PrintToLog("End of check, test failed!")
sys.exit(99)
SysExit()
else:
PrintToLog("Second processes check is ok\n")
......@@ -411,7 +430,7 @@ if __name__ == "__main__":
if fail_name_list.count('launcher') or fail_name_list.count('settings_keyboard'):
PrintToLog("SmokeTest find some fatal problems!")
PrintToLog("End of check, test failed!")
sys.exit(99)
SysExit()
PrintToLog("SmokeTest find some key problems!")
PrintToLog("End of check, test failed!")
sys.exit(98)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册