From 2f888435498ffa9761174af7884ca2e3cf4f8baf Mon Sep 17 00:00:00 2001 From: redjie Date: Wed, 17 Aug 2022 18:55:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E6=9C=BA=E5=BD=95=E5=83=8F=E5=8F=AA?= =?UTF-8?q?=E5=81=9A=E6=88=AA=E5=9B=BE=E6=8B=A6=E6=88=AA=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=AA=92=E4=BD=93=E5=BA=93=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=AF=B9=E6=96=87=E4=BB=B6=E8=AF=BB=E5=8F=96=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=81=9A=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: redjie Change-Id: I9db887069603ff962e8abbbd0ba0b4114e91f47c --- .../app_capture_screen_test_config.json | 8 ++--- screenshot32/resource/capturescreentest.py | 34 +++++++++++-------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/screenshot32/resource/app_capture_screen_test_config.json b/screenshot32/resource/app_capture_screen_test_config.json index 361d8fb..07e3d17 100644 --- a/screenshot32/resource/app_capture_screen_test_config.json +++ b/screenshot32/resource/app_capture_screen_test_config.json @@ -94,14 +94,12 @@ "open_camera_log":["rm /data/log/hilog/* && hilog -b X;hilog -b D -T CAMERA;hilog -r"], "start_camera":["aa start -a com.ohos.camera.MainAbility -b com.ohos.camera"], "recover_log":["cd data/log/hilog/;hilog -x > camera_log.txt;hilog -b D"], - "cp_db": ["cp /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/rdb/media_library.db /data/video_photo.db"], + "cp_db": ["cp /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/rdb/media_library.db /data/camera_photo.db"], "all_actions": [ [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"], - [2, "take_photos-x-y"], [2, "take_photos-x-y"], [2, "convert_to_video-x-y"], [5, "take_photos-x-y"], [2, "stop_video-x-y"], [5, "take_photos-x-y"], [2, "stop_video-x-y"], [5, "convert_to_photos-x-y"], + [2, "take_photos-x-y"], [2, "take_photos-x-y"], [2, "convert_to_video-x-y"], [5, "take_photos-x-y"], [2, "stop_video-x-y"], [5, "take_photos-x-y"], [2, "stop_video-x-y"], [6, "convert_to_photos-x-y"], [2, "permisson_ok-x-y"], [2, "permisson_ok-x-y"], [1, "recover_log"], [1, "check_result"], [1, "shot_cmd", "camera_to_photos"], [1, "cmp_cmd-level", 921600], [2, "home-x-y"], [2, "recent-x-y"], - [2, "recent_del-x-y"], [5, "start_camera"], [2, "take_photos-x-y"], [2, "take_photos-x-y"], [2, "convert_to_video-x-y"], [5, "take_photos-x-y"], [2, "stop_video-x-y"], [5, "take_photos-x-y"], - [2, "stop_video-x-y"], [2, "home-x-y"], [2, "recent-x-y"], [2, "recent_del-x-y"], [1, "cp_db"], [1, "get_file_from_dev", "/data/video_photo.db"], [2, "photo_and_video_check"], [1, "compress_log"], - [1, "get_file_from_dev", "/data/log/hilog/camera_log.tar"] + [2, "recent_del-x-y"], [1, "cp_db"], [1, "get_file_from_dev", "/data/camera_photo.db"], [2, "camera_photo_check"], [1, "compress_log"], [1, "get_file_from_dev", "/data/log/hilog/camera_log.tar"] ] }, { diff --git a/screenshot32/resource/capturescreentest.py b/screenshot32/resource/capturescreentest.py index 011c905..9f3d3f7 100644 --- a/screenshot32/resource/capturescreentest.py +++ b/screenshot32/resource/capturescreentest.py @@ -107,14 +107,14 @@ def ImageCheck(str, testnum=1): cursor_image.execute("""select * from files where mime_type = "image/*" """) except: PrintToLog("SmokeTest:: error: media_library.db cannot be found, please check media library path") - SysExit() + return -1 if testnum == 2: try: PrintToLog("SmokeTest:: select * from files where mime_type = video/mp4") cursor_video.execute("""select * from files where mime_type = "video/mp4" """) except: PrintToLog("SmokeTest:: error: media_library.db cannot be found, please check media library path") - SysExit() + return -1 PrintToLog("SmokeTest:: media library is ok") image_result = cursor_image.fetchone() video_result = cursor_video.fetchone() @@ -387,10 +387,10 @@ if __name__ == "__main__": elif type(single_action[1]) == str and single_action[1] == 'connect_wifi': next_cmd = "" ConnectToWifi(args.tools_path) - elif type(single_action[1]) == str and single_action[1] == 'photo_and_video_check': + elif type(single_action[1]) == str and single_action[1] == 'camera_photo_check': next_cmd = "" - if ImageCheck("{}\\video_photo.db".format(os.path.normpath(args.save_path)),\ - 2) == 1 and testok == 1: + if ImageCheck("{}\\camera_photo.db".format(os.path.normpath(args.save_path)),\ + 1) == 1 and testok == 1: testok = 1 else: testok = -1 @@ -531,7 +531,8 @@ if __name__ == "__main__": PrintToLog("SmokeTest:: second processes check is ok") pr_analysis = args.pr_url - if "applications_sample_wifi_iot" or "softbus" in pr_analysis: + PrintToLog("SmokeTest:: get pr: {}".format(args.pr_url)) + if "applications_sample_wifi_iot" in pr_analysis or "softbus" in pr_analysis: #distributed smoketest PrintToLog("SmokeTest:: close selinux") EnterShellCmd("mount -o rw,remount /", 1) @@ -587,14 +588,17 @@ if __name__ == "__main__": EnterCmd("hdc_std -t {} file recv \"/data/log/hilog/hilog_getpin.txt\" \"{}\"".format(args.device_num,\ os.path.normpath(args.save_path)), 1) getpin_result = 0 - with open(os.path.normpath(os.path.join(args.save_path, "hilog_getpin.txt")), mode='r', encoding='gbk',\ - errors='ignore') as fs: - getpin_lines = fs.readlines() - for content in getpin_lines: - if "rkgetpin:: distributedcalc test is ok!!!" in content: - getpin_result = 1 - break - fs.close() + try: + with open(os.path.normpath(os.path.join(args.save_path, "hilog_getpin.txt")), mode='r', encoding='gbk',\ + errors='ignore') as fs: + getpin_lines = fs.readlines() + for content in getpin_lines: + if "rkgetpin:: distributedcalc test is ok!!!" in content: + getpin_result = 1 + break + fs.close() + except: + PrintToLog("SmokeTest:: cannot find hilog_getpin.txt") if getpin_result == 1: PrintToLog("SmokeTest:: distributed smoke test is ok!!!") else: @@ -629,7 +633,7 @@ if __name__ == "__main__": EnterShellCmd("rm -rf /data/* && reboot") reboot_result_list = EnterCmd("hdc_std list targets", 2) number = 0 - while "7001005458323933328a" not in reboot_result_list and number < 15: + while args.device_num not in reboot_result_list and number < 15: reboot_result_list = EnterCmd("hdc_std list targets", 2) number += 1 EnterShellCmd("rm /data/log/hilog/*;hilog -r;hilog -w start -l 400000000 -m none", 1) -- Gitee