コード例 #1
0
def test():
    logger.log_info("start tbox active upgrade test", \
                    sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
    co.ADB_SN().check_adb_device_isalive()
    sn = tbox_common.check_sn_status()
    count_pass = 0
    count_fail = 0
    Result = tbox_common.check_activeupgrade(sn, "mcu", "mpu")
    if Result == 0:
        count_pass = count_pass + 1
        logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
                              os.path.basename(__file__).strip('.py'))
        return 0
    elif Result == 1:
        co.ADB_SN().check_adb_device_isalive()
        co.open_tbox_adb()
        time.sleep(10)
        tb_c.Tbox_Information.modify_tbox_config(sn)
        count_fail = count_fail + 1
        scp = co.Set_Screencap_Message(sn)
        # co.Get_Logcat_Message(sn, co.logcat_object)
        co.Get_Screencap_Message(sn, scp)
        co.Get_libHU_Message(sn)
        logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
                              os.path.basename(__file__).strip('.py'))
        return 1
コード例 #2
0
ファイル: Hu_Common.py プロジェクト: v-anjia/Fota
from bs4 import BeautifulSoup
import os
import sys
import uiautomator2 as u2
import subprocess
from log import logger as loger
import threading
import re,sys
import random
from atexit import register
from Common_Public import Common as co
from Common_Public import Signal_List as SL
from Common_Public import Signal_Common as SC
action = ["check_sn_status","upgrade_udisk_package","check slience package download and install","reboot and check version","install old package"]
package = co.Install_Package()
adb_sn  = co.ADB_SN()
prepare_ui = co.Prepare_Ui()
check_message = co.Check_message()
platform_information = co.Platform_Information()
logger = loger.Current_Module()
retry_times = 5

class hu_common(object):
    def __init__(self):
        pass

    def check_sn_status(self):
        '''
        function:check device status
        :return: sn serial number
        '''
コード例 #3
0
def test():
    logger.log_info("start tbox active upgrade reboot test", \
                    sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
    co.ADB_SN().check_adb_device_isalive()
    sn = tbox_common.check_sn_status()
    count_pass = 0
    count_fail = 0
    if tbox_common.prepare_activeupgrade_environment(sn, "mcu", "mpu") == 0:
        Result = tbox_common.cancleinstall_through_setting(sn)
        if Result == 0:
            count_pass = count_pass + 1
            # scp = co.Set_Screencap_Message(sn)
            # # co.Get_Logcat_Message(sn, co.logcat_object)
            # co.Get_Screencap_Message(sn, scp)
            # co.Get_libHU_Message(sn)
            logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
                                  os.path.basename(__file__).strip('.py'))
            return 0
        elif Result == 1:
            co.ADB_SN().check_adb_device_isalive()
            co.open_tbox_adb()
            time.sleep(10)
            tb_c.Tbox_Information.modify_tbox_config(sn)
            count_fail = count_fail + 1
            scp = co.Set_Screencap_Message(sn)
            # co.Get_Logcat_Message(sn, co.logcat_object)
            co.Get_Screencap_Message(sn, scp)
            co.Get_libHU_Message(sn)
            logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
                                  os.path.basename(__file__).strip('.py'))
            return 1
    else:
        count_fail = count_fail + 1
        scp = co.Set_Screencap_Message(sn)
        # co.Get_Logcat_Message(sn, co.logcat_object)
        co.Get_Screencap_Message(sn, scp)
        co.Get_libHU_Message(sn)
        logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
                              os.path.basename(__file__).strip('.py'))
        logger.log_error("prepare environemnt fail", \
                         sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
        return 1

# def test(date_time = None, loop_count = None):
# 
#     logger.log_info("start active upgrade reboot test", \
#                     sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
#     count_pass = 0
#     count_fail = 0
#     sn = tbox_common.check_sn_status()
#     if date_time == None and loop_count == None:
#         logger.log_error("has no right argument",\
#                          sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
#         sys.exit(-1)
#     elif date_time != None and loop_count == None:
#         current_time = int(time.time())
#         loop_time = current_time + date_time*3600
#         time.sleep(1)
#         if tbox_common.prepare_activeupgrade_environment(sn, "mcu", "mpu") == 0:
#             while current_time <= loop_time:
#                 Result = tbox_common.cancleinstall_through_setting(sn)
#                 if Result == 0:
#                     count_pass = count_pass + 1
#                     scp = co.Set_Screencap_Message(sn)
#                     # co.Get_Logcat_Message(sn, co.logcat_object)
#                     co.Get_Screencap_Message(sn, scp)
#                     co.Get_libHU_Message(sn)
#                     logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
#                                         os.path.basename(__file__).strip('.py'))
#                 elif Result == 1:
#                     count_fail = count_fail + 1
#                     scp = co.Set_Screencap_Message(sn)
#                     # co.Get_Logcat_Message(sn, co.logcat_object)
#                     co.Get_Screencap_Message(sn, scp)
#                     co.Get_libHU_Message(sn)
#                     logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
#                                           os.path.basename(__file__).strip('.py'))
#                 current_time = int(time.time())
#         else:
#             count_fail = count_fail + 1
#             scp = co.Set_Screencap_Message(sn)
#             # co.Get_Logcat_Message(sn, co.logcat_object)
#             co.Get_Screencap_Message(sn, scp)
#             co.Get_libHU_Message(sn)
#             logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
#                                   os.path.basename(__file__).strip('.py'))
#             logger.log_error("prepare environemnt fail",\
#                              sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,sys._getframe().f_lineno)
#     elif date_time == None and loop_count != None:
#         time.sleep(1)
#         if tbox_common.prepare_activeupgrade_environment(sn, "mcu", "mpu") == 0:
#             while loop_count > 0:
#                 Result = tbox_common.cancleinstall_through_setting(sn)
#                 if Result == 0:
#                     count_pass = count_pass + 1
#                     logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
#                                           os.path.basename(__file__).strip('.py'))
#                     # print(count_pass)
#                 elif Result == 1:
#                     count_fail = count_fail + 1
#                     scp = co.Set_Screencap_Message(sn)
#                     # co.Get_Logcat_Message(sn, co.logcat_object)
#                     co.Get_Screencap_Message(sn, scp)
#                     co.Get_libHU_Message(sn)
#                     logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
#                                           os.path.basename(__file__).strip('.py'))
#                 loop_count = loop_count - 1
#         else:
#             count_fail = count_fail + 1
#             scp = co.Set_Screencap_Message(sn)
#             # co.Get_Logcat_Message(sn, co.logcat_object)
#             co.Get_Screencap_Message(sn, scp)
#             co.Get_libHU_Message(sn)
#             logger.Current_Result(count_fail + count_pass, count_pass, count_fail,
#                                   os.path.basename(__file__).strip('.py'))
#             loop_count = loop_count - 1
#             logger.log_error("prepare environemnt fail",\
#                              sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,sys._getframe().f_lineno)
#     print ("summary:\n")
#     logger.Total_Result(count_fail + count_pass,count_pass,count_fail,os.path.basename(__file__).strip('.py'))