From acb607f0ea316107f0d7d939522eef3e19aa9b98 Mon Sep 17 00:00:00 2001 From: liujiahui Date: Mon, 19 Sep 2022 17:30:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=AF=B9=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E6=89=80=E5=8D=A0=E7=A9=BA=E9=97=B4=E7=9A=84=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujiahui --- mini_system_test/L1_mini_system_test.py | 14 +++++++++++++- mini_system_test/L2_mini_system_test.py | 8 ++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mini_system_test/L1_mini_system_test.py b/mini_system_test/L1_mini_system_test.py index ea5ae72..6d38a6c 100644 --- a/mini_system_test/L1_mini_system_test.py +++ b/mini_system_test/L1_mini_system_test.py @@ -86,7 +86,8 @@ if __name__ == "__main__": PrintToLog("{} is open failed".format(com_port)) PrintToLog("End of check, test failed!") sys.exit(99) - + + res = com_port.write("free".encode('utf-8')); read_com_thread = threading.Thread(target=ReadFromComPort, args=(com_port, 10)) read_com_thread.setDaemon(True) print('read wait:') @@ -137,6 +138,17 @@ if __name__ == "__main__": PrintToLog('not found softbus_server process') PrintToLog("End of check, test failed!") sys.exit(99) + mem_find = re.findall('Mem:\s*\d*\s*\d*\s*\d*\s*\d*', com_output) + print(mem_find) + if len(mem_find) > 0: + mem_size = int(mem_find[0].split()[2]) / 1024 / 1024 + else: + PrintToLog('Error:can find memory usage info!') + sys.exit(99) + if mem_size > 25: + PrintToLog( + 'Error:memory usage is over the upper limit(25M),now is {:.2f}'.format(mem_size)) + sys.exit(99) target_dir = os.path.normpath(os.path.join(args.archive_path, "rootfs")) ret_size = GetDirSize(target_dir)/1024/1024 diff --git a/mini_system_test/L2_mini_system_test.py b/mini_system_test/L2_mini_system_test.py index 175a2fd..dae7e1f 100644 --- a/mini_system_test/L2_mini_system_test.py +++ b/mini_system_test/L2_mini_system_test.py @@ -133,6 +133,14 @@ if __name__ == "__main__": else: PrintToLog("First processes check is ok\n") + # check processes usage + res = EnterCmd("hdc_std -t {} shell hidumper --mem".format(args.device_num), 0, 1) + process_usage = int(res.split(':')[-1].split()[0]) / 1024 + if process_usage > 40: + PrintToLog( + "ERROR: Processes usage cannot be greater than 40M, but currently it's actually %.2fM" % process_usage) + sys.exit(99) + time.sleep(10) #key processes second check, and cmp to first check -- Gitee