From bcfe726434a8201c1a756293d8b3dd25e0f97842 Mon Sep 17 00:00:00 2001 From: redjie Date: Wed, 19 Jul 2023 15:13:23 +0800 Subject: [PATCH] configure apl check Signed-off-by: redjie Change-Id: Idacc2177e6b52e5a8e47c9cf70ded9a421210f5f --- .../screenshot32/acls_check/acl_check.py | 2 +- .../resource/capturescreentest.py | 24 +++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/cases/smoke/basic/screenshot32/acls_check/acl_check.py b/cases/smoke/basic/screenshot32/acls_check/acl_check.py index 3a12bb5..a6781a1 100644 --- a/cases/smoke/basic/screenshot32/acls_check/acl_check.py +++ b/cases/smoke/basic/screenshot32/acls_check/acl_check.py @@ -32,7 +32,7 @@ def whitelist_check(whitelist, acls): for acl in v: if acl not in temp: check_pass = False - set_log_content(LogLevel(2).name, log_tag, log_tag + '->whitelist_check', + set_log_content(LogLevel(2).name, log_tag + '->whitelist_check', 'precessName = {} the acl = {} trustlist is not configured.'.format(k, acl)) else: check_pass = False diff --git a/cases/smoke/basic/screenshot32/resource/capturescreentest.py b/cases/smoke/basic/screenshot32/resource/capturescreentest.py index dc4db8c..03abe18 100644 --- a/cases/smoke/basic/screenshot32/resource/capturescreentest.py +++ b/cases/smoke/basic/screenshot32/resource/capturescreentest.py @@ -23,13 +23,14 @@ import re import subprocess import shlex import datetime -import sqlite3 import shutil import numpy import cv2 import pytesseract sys.path.append(os.path.dirname(os.path.realpath(__file__)).replace('resource', 'acls_check')) +sys.path.append(os.path.dirname(os.path.realpath(__file__)).replace('resource', 'APL_compare_03')) from acl_check import * +from compare import * from pytesseract import Output from PIL import Image @@ -295,7 +296,7 @@ def distributed_test(): distributed_result = f.read() f.close() except Exception as reason: - print_to_log("SmokeTest:: distributed_report.txt is not exist!") + print_to_log("SmokeTest:: distributed_report.txt do not exist!") if "distributedcalc" in distributed_result: print_to_log("SmokeTest:: testcase 0, distributed is ok!") else: @@ -391,11 +392,24 @@ if __name__ == "__main__": lose_process.append(pname) if lose_process: - print_to_log("SmokeTest:: error: %s, These processes are not exist!!!" % lose_process) + print_to_log("SmokeTest:: error: %s, These processes do not exist!!!" % lose_process) sys_exit() else: print_to_log("SmokeTest:: first processes check is ok") + apl_check_main(args.device_num) + apl_compare = os.path.normpath(os.path.join(args.tools_path, "APL_compare_03", "apl_compare.log")) + try: + with open(apl_compare, mode='r', encoding='utf-8', errors='ignore') as compare_file: + compare_file.seek(0) + apl_result = compare_file.read() + compare_file.close() + except Exception as reason: + print_to_log("SmokeTest:: error: apl_compare.log do not exist!") + if "APL Check failed" in apl_result: + print_to_log("SmokeTest:: error: apl check failed") + sys_exit() + main(args.device_num) native_sa = os.path.normpath(os.path.join(args.tools_path, "acls_check", "native_sa.log")) try: @@ -404,7 +418,7 @@ if __name__ == "__main__": acl_result = native_file.read() native_file.close() except Exception as reason: - print_to_log("SmokeTest:: error: native_sa.log are not exist!") + print_to_log("SmokeTest:: error: native_sa.log do not exist!") if "ACL check failed" in acl_result: print_to_log("SmokeTest:: error: acl check failed") sys_exit() @@ -620,7 +634,7 @@ if __name__ == "__main__": reboot_result = f.read() f.close() if len(reboot_result) < 1 and reboot_cnt >= 1: - print_to_log("SmokeTest:: \"reboot\" is not found in the reboot.txt") + print_to_log("SmokeTest:: no \"reboot\" found in the reboot.txt") print_to_log("SmokeTest:: the device will reboot and try the failed testcase") print_to_log("SmokeTest:: mkdir {}\\reboot".format(args.save_path)) os.system("mkdir {}\\reboot".format(args.save_path)) -- Gitee