门禁升级适配liunx系统

This commit is contained in:
cwx1281816
2024-05-24 14:25:44 +08:00
parent 95d4f5ea85
commit 3354c1fb27
2 changed files with 18 additions and 4 deletions
@@ -7,6 +7,7 @@ import time
import re
import shutil
import random
import platform
from core.base import BaseApp, dec_stepmsg
from util.file_locker import FileLock
@@ -89,7 +90,9 @@ class liteOsUpgrade_RK3568(BaseApp):
# @return: True or Flase
#===================================================================================
'''
global local_image_path, loader_tool_path, sn, LocationID ,test_num
global local_image_path, loader_tool_path, sn, LocationID ,test_num, system_type
system_type = platform.system()
logger.printLog("******系统为:%s ******" % system_type)
version_savepath = self.params_dict.get("img_path")
upgrade_test_type = self.params_dict.get("UpgradeTestType")
sn = self.params_dict.get("sn")
@@ -98,14 +101,20 @@ class liteOsUpgrade_RK3568(BaseApp):
pr_url = self.params_dict.get("pr_url")
logFilePath = self.logFilePath
logger.info(logFilePath)
r = logFilePath.rfind("\\")
if system_type == "Windows":
r = logFilePath.rfind("\\")
else:
r = logFilePath.rfind("/")
report_path = logFilePath[:r]
logger.info(report_path)
scriptpath = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))))
logger.info(scriptpath)
local_image_path = os.path.join(version_savepath)
logger.info(local_image_path)
loader_tool_path = os.path.join(scriptpath, "resource", "RK3568_tool", "upgrade_tool.exe")
if system_type == "Windows":
loader_tool_path = os.path.join(scriptpath, "resource", "RK3568_tool", "upgrade_tool.exe")
else:
loader_tool_path = os.path.join(scriptpath, "resource", "RK3568_tool", "upgrade_tool")
logger.info(loader_tool_path)
mini_path = os.path.join(local_image_path, "mini_system_test", "L2_mini_system_test.py")
archive_path = os.path.join(version_savepath)
+6 -1
View File
@@ -14,6 +14,7 @@ import datetime
import sys
import threading
import time
import platform
from util.log_info import logger
thead = []
@@ -97,7 +98,11 @@ def timeout(seconds = 300):
thd.setDaemon(True)
thd.start()
thd.join(seconds)
alive = thd.isAlive()
system_type = platform.system()
if system_type == "Windows":
alive = thd.isAlive()
else:
alive = thd.is_Alive()
thd.kill()
if alive:
raise Timeout(u"function run too long, timeout %d seconds." % seconds)