Пример #1
0
 def ACOffAdviseAppare(cls, sn):
     logger.log_info("Energy Management page has showed ", \
                     sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     d = u2.connect(sn)
     logger.log_debug(d.info, \
                      sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     pcan_object = SC.PCAN()
     logger.log_debug("send hideball signal", \
                      sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     for i in range(50):
         pcan_object.send_arry(SL.HideBall)
         time.sleep(0.2)
     Check_Result.delete_tracker_log(sn)
     time.sleep(random.randint(3, 5))
     logger.log_debug("send showball signal", \
                      sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     for i in range(50):
         pcan_object.send_arry(SL.ShowBall)
         time.sleep(0.2)
Пример #2
0
 def EnergyRecovery(cls, sn):
     logger.log_info("Energy Management page has showed ", \
                     sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     d = u2.connect(sn)
     logger.log_debug(d.info, \
                      sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     pcan_object = SC.PCAN()
     logger.log_debug("send showball signal", \
                      sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     for i in range(50):
         pcan_object.send_arry(SL.ShowBall)
         time.sleep(0.2)
     Check_Result.delete_tracker_log(sn)
     time.sleep(random.randint(3, 5))
     d.xpath('//*[@resource-id="com.wm.launcher:id/view_root"]/android.widget.FrameLayout[2]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]').click()
     time.sleep(random.randint(3, 5))
     logger.log_debug("send hideball signal", \
                      sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno)
     for i in range(50):
         pcan_object.send_arry(SL.HideBall)
         time.sleep(0.2)
Пример #3
0
    def test_driver_model_ssh(self,module_name):
        try:

            logger.log_debug("start driver model test", \
                             sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                             sys._getframe().f_lineno)
            time.sleep(random.randint(3, 5))
            logger.log_info("start send two groups signal", \
                            sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                            sys._getframe().f_lineno)
            sc = SC.PCAN()
            sc.send_signal_to_qnx(200, SL.REBOOT_SELF_INSPECTION)

            logger.log_debug("set ip address for ping_object", \
                             sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                             sys._getframe().f_lineno)
            ping_object.set_ip_address(package.update_fota_package()[1])
            if ping_object.ping_qnx_system() == 0:
                time.sleep(random.randint(1,3))
                self.start_collect_log(command=[root_read_write,collect_icu_log])
                self.start_collect_log(command=[root_read_write,collect_mcu_log])
                logger.log_info("send many groups signal to qnx system", \
                                sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                child_thread = threading.Thread(target=sc.send_signal_to_qnx, name="send_qnx_thread",
                                                    args=(2500,SL.DRIVE_MODEL_ICU_SELF_INSPECTION,))
                child_thread.start()
                time.sleep(random.randint(40, 50))
                logger.log_info("get expect picture directory", \
                                sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                sys._getframe().f_lineno)
                local_screen_path = self.create_screen_file_name(module_name)
                orign_compare_picture = self.exist_expect_screen_file_name(module_name)
                for i in range(10):
                    date_time = time.strftime('%Y-%m-%d_%H_%M_%S', time.localtime(time.time()))

                    self.screen_shot_and_transfer_to_local(port, password="", username=username,
                                                           ip_address=package.update_fota_package()[1],
                                                           command=screen_command, command1=delete_screen_picture,
                                                           orign_path=udisk_path + date_time + ".png",
                                                           later_path=local_screen_path + date_time + ".png")
                    time.sleep(random.randint(1,3))

                    CPP.modify_driver_expect_picture(orign_compare_picture)
                    CPP.modify_driver_expect_picture(local_screen_path + date_time + ".png")
                    if CPP.compare_picture(orign_compare_picture, local_screen_path + date_time + ".png",
                                           local_screen_path) == 0:
                        logger.log_info("compare picture successfully", \
                                        sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                        sys._getframe().f_lineno)
                        child_thread.join()
                        time.sleep(random.randint(3,5))
                        sc.clean()
                        self.end_collect_log()
                        self.copy_log_to_local(local_screen_path)
                        self.delete_logfile()
                        self.ssh_close()
                        self.sftp_close()
                        return 0
                child_thread.join()
                time.sleep(random.randint(3,5))
                sc.clean()
                self.end_collect_log()
                self.copy_log_to_local(local_screen_path)
                self.delete_logfile()
                self.ssh_close()
                self.sftp_close()
                return 1
            else:
                sc.clean()
                logger.log_error("can not ping network", \
                                 sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                 sys._getframe().f_lineno
                                 )
                return 1
        except Exception as e:

            # self.copy_log_to_local(local_screen_path)
            try:
                self.end_collect_log()
                logger.log_info("antony@@@debug", \
                                sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                sys._getframe().f_lineno)
                child_thread.join()
            except Exception as e:
                logger.log_error("%s" % (e), \
                                 sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                 sys._getframe().f_lineno)
                sc.clean()
                return 1
            sc.clean()
            logger.log_error("%s" % (e), \
                             sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                             sys._getframe().f_lineno)
            return 1
Пример #4
0
    def test_no_speed_model(self, module_name):
        try:
            logger.log_debug("start no speed model test",\
                            sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)

            # init_qnx_system = init_environment(package.update_fota_package()[1], package.update_fota_package()[4])
            # init_qnx_system()
            logger.log_info("activation network",\
                            sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
            sc=SC.PCAN()
            sc = self.send_signal_to_qnx(SL.REBOOT_SELF_INSPECTION)
            time.sleep(random.randint(3,5))
            
            logger.log_debug("set ip address for ping_object",\
                             sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
            ping_object.set_ip_address(package.update_fota_package()[1])
            
            if ping_object.ping_qnx_system() == 0:
                logger.log_info("send pcan signal to qnx system",\
                                sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                child_multi = multiprocessing.Process(target=self.send_signal_to_qnx_system, name="send_qnx_thread",
                                                      args=(SL.NO_SPEED_ICU_SELF_INSPECTION,))
                child_multi.start()
                time.sleep(random.randint(40, 50))
                logger.log_info("screen picture and copy to local", \
                                sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                sys._getframe().f_lineno)
                local_screen_path = self.create_screen_file_name(module_name)
                # print(local_screen_path)
                orign_compare_picture = self.exist_expect_screen_file_name(module_name)
                # print(orign_compare_picture)
                for i in range(10):
                    date_time = time.strftime('%Y-%m-%d_%H_%M_%S', time.localtime(time.time()))
                    self.excute_qnx_command(port, password="", username=username,
                                            ip_address=package.update_fota_package()[1],
                                            command=create_screen_directory)
                    time.sleep(random.randint(1,3))
                    self.excute_qnx_command(port, password="", username=username,
                                            ip_address=package.update_fota_package()[1],
                                            command=screen_command + save_picture_directory + date_time + ".png")
                    time.sleep(random.randint(1,3))
                    self.screen_shot_and_transfer_to_local(port, password="", username=username,
                                                           ip_address=package.update_fota_package()[1],
                                                           command=screen_command, command1=deltet_screen_picture,
                                                           orign_path=save_picture_directory + date_time + ".png",
                                                           later_path=local_screen_path + date_time + ".png")
                    time.sleep(random.randint(1,3))
                    CPP.modify_no_sepeed_expect_picture(orign_compare_picture)
                    CPP.modify_no_sepeed_expect_picture(local_screen_path + date_time + ".png")
                    if CPP.compare_picture(orign_compare_picture, local_screen_path + date_time + ".png",
                                           local_screen_path) == 0:
                        logger.log_info("compare picture successfully", \
                                        sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                        sys._getframe().f_lineno)
                        child_multi.join()
                        self.ssh_close()
                        self.sftp_close()
                        return 0
                    time.sleep(random.randint(2, 5))
                child_multi.join()
                self.ssh_close()
                self.sftp_close()
                return 1
        except Exception as e:
            logger.log_error("%s" % (e), \
                             sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                             sys._getframe().f_lineno)
            return 1