From 35f87b1cfe5bcf5e49136f1549b795962164feae Mon Sep 17 00:00:00 2001 From: lnlan Date: Mon, 30 May 2022 03:03:41 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E9=94=81=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20Signed-off-by:=20lnlan=20=20?= =?UTF-8?q?Change-Id:=20I6cc2e9b8a05e6f54ea8fbf713d63c0002888c4ba?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id57b5452388e4c499f3ab6caf432afc2796cb406 --- screenshot/resource/capturescreentest.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/screenshot/resource/capturescreentest.py b/screenshot/resource/capturescreentest.py index 32d3273..8d30a03 100644 --- a/screenshot/resource/capturescreentest.py +++ b/screenshot/resource/capturescreentest.py @@ -167,21 +167,23 @@ if __name__ == "__main__": EnterShellCmd("/data/screen_test/printscreen -f /data/screen_test/launcher_{}.png".format(args.device_num), 1) GetFileFromDev("/data/screen_test/launcher_{}.pngraw".format(args.device_num), args.save_path) GetFileFromDev("/data/screen_test/launcher_{}.png".format(args.device_num), args.save_path) - cmp_launcher = "cmp -l /data/screen_test/launcher.pngraw /data/screen_test/train_set/launcher.pngraw | wc -l" + cmp_launcher = "cmp -l /data/screen_test/launcher_{}.pngraw /data/screen_test/train_set/launcher.pngraw | wc -l".format(args.device_num) p = EnterShellCmd(cmp_launcher, 1) num = re.findall(r'[-+]?\d+', p) PrintToLog(num) - if type(num) == list and len(num) > 0 and int(num[0]) < 443200: + if type(num) == list and len(num) > 0 and int(num[0]) < 443200 and p.find('No such file or directory', 0, len(p)) == -1: PrintToLog("remove lock is ok!\n\n") break elif rebootcnt >= 1: PrintToLog("remove lock failed, reboot and try!!!\n\n") - os.system("hdc_std -t {} shell reboot".format(args.device_num)) + EnterShellCmd("reboot") for i in range(5): EnterCmd("hdc_std list targets", 10) else: - PrintToLog("remove lock failed\n\n") - break + PrintToLog("ERROR: remove lock failed\n\n") + PrintToLog("SmokeTest find some fatal problems!") + PrintToLog("End of check, test failed!") + sys.exit(99) PrintToLog("\n\n########## First check key processes start ##############") lose_process = [] @@ -284,16 +286,11 @@ 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) + #no_such = re.findall(r'No such file or directory', p) + #PrintToLog(no_such) num = re.findall(r'[-+]?\d+', p) PrintToLog(num) - if type(num) == list and len(num) > 0 and int(num[0]) < tolerance: + if type(num) == list and len(num) > 0 and int(num[0]) < tolerance and p.find('No such file or directory', 0, len(p)) == -1: if testok == 0: testok = 1 PrintToLog("{} screenshot check is ok!\n\n".format(raw_pic_name)) -- Gitee