def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) # run specific test for ALL charger available or for only one if self._charger_type == "ALL": for charger in self._io_card.SUPPORTED_DEVICE_TYPE: if charger not in [ self._io_card.USB_HOST_PC, self._io_card.OTG, self._io_card.WALL_CHARGER ]: self.run_specific_test(charger) # switch off the board self._device.soft_shutdown(False) time.sleep(20) # Remove the battery self._io_card.battery_connector(False) # add case where no charger is plugged self.run_specific_test("None") else: self.run_specific_test(self._charger_type) # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) # Run the sub test about power on with power button status = self._boot_on_power_button() if status != Global.SUCCESS: self._logger.error( "Phone has can't start on power button press. " + "Test STOPS!") # Save data report in xml file self._error.Code = self._em_meas_verdict.get_global_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg # Run the sub test about User Alarm self._no_boot_on_alarm() # Run the sub test about Not booting under critical Voltage self._no_boot_under_critical_voltage() # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._meas_list.clean() self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) # Run Watchdog test self._run_watchdog_test() # Run cold reset test self._run_cold_reset_test() # Run Transition OS test self._run_transition_os_test() # Run Start MOS test self._run_start_mos_test() # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._meas_list.clean() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): EmUsecaseBase.run_test_body(self) # charge board self.__charge_phase_mos() # setting for discharge loop # set CMU cell phone ON self.__data_2g.set_data_cell_on() # register phone self.__data_2g.data_register_dut(None, self._registration_timeout) # Check registration status on DUT self.modem_api.check_cdk_registration_bfor_timeout( self._registration_timeout) # establish call if self.__call_origin == "SIMULATOR": self.__data_2g.data_call(self.__data_call_mode) self.__data_2g.check_data_call_connected(60) elif self.__call_origin == "PHONE": self.voicecall_api.dial("OOOO12121121") # discharge the board self.__discharge_phase() return(self._em_meas_verdict.get_global_result(), self._em_meas_verdict.generate_msg_verdict())
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Init function EmUsecaseBase.run_test_body(self) # do the test for the loop for i in range(self._loop_number): self._logger.info("-*-*Test Iteration %s*-*-" % str(i + 1)) # compute the time to wait after we start to boot timing_after_turn_on = self._first_turn_off_timing + i * self._turn_off_step # begin to boot the board and return after pressing the power button self._begin_boot_board(self._pwr_button_press_time) # wait the good time self._logger.info("***Wait %s second before initiating a shutdown***" % str(timing_after_turn_on)) time.sleep(timing_after_turn_on) # Turn off the board self._turn_off_board(self._turn_off_way) # check the board status self._check_board(self._pwr_button_press_time) # add measure to the verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets, True) self._em_meas_verdict.judge(ignore_blocked_tc=True) # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg += self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test Check the end of the main battery charge """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) # Check the battery capacity to 0% self._logger.info( "BEGIN OF THE TEST : Battery capacity is equal to %d%%" % self.batt_capacity) # if registration has been lost, register again if self.modem_api.get_network_registration_status() not in [ "registered", "roaming" ]: self.__telmodule.register_to_network() # if fake number has been lost restore it here if self.__fake_emergency_phone_number not in self.modem_api.get_emergency_numbers( ): self.modem_api.set_emergency_numbers( [self.__fake_emergency_phone_number], False) # First Part, Check emergency call alone # establish voice call self._logger.info("Board is in MOS, Initiate the call !") self.voicecall_api.emergency_dial(self.__fake_emergency_phone_number) # Add the hands free if self.__hands_free_activation: self._logger.info("Activate the Speaker !") self.phonesystem_api.switch_audio_output("speaker") # Discharge the board return self.__discharge_when_data(0)
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) # get ibatt with display on ibatt_screen_on = self.em_core_module.get_battery_current() self._logger.info("Screen On : IBatt = %s %s" % (ibatt_screen_on[0], ibatt_screen_on[1])) # switch off the screen by pressing power on button during 0.5 second self._io_card.press_power_button(0.5) # sleep 5 s time.sleep(5) # check_screen status screen_status = self.phonesystem_api.get_screen_status() self._meas_list.add("SCREEN_STATUS", screen_status, "") # now get ibatt value with display off ibatt_screen_off = self.em_core_module.get_battery_current() self._logger.info("Screen Off : IBatt = %s %s" % (ibatt_screen_off[0], ibatt_screen_off[1])) self._meas_list.add( "SAVED_IBATT", (ibatt_screen_on[0] - ibatt_screen_off[0], ibatt_screen_off[1])) # Close connection self._device.disconnect_board() # Remove data cable self._io_card.usb_connector(False) # turn screen off time.sleep(2) self._io_card.press_power_button(0.5) # now just wait x second min and check IBATT value self._logger.info( "Wait %ss in order to stabilize the battery current" % str(self.__stabilization_time)) time.sleep(self.__stabilization_time) # now get ibatt value with display off ibatt_screen_off_after_waiting = self.em_core_module.get_battery_current( ) self._meas_list.add("WAIT_FOR_MIN_IBATT", (ibatt_screen_off_after_waiting[0], ibatt_screen_off_after_waiting[1])) # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._em_meas_verdict.judge() self._meas_list.clean() return self._em_meas_verdict.get_current_result_v2()
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE_PS Run function EmUsecaseBase.run_test_body(self) # Wait the Hardware charging Setup self._logger.info("Wait %ss for hardware charging mode" % self.__hardware_boot_timeout_value) time.sleep(self.__hardware_boot_timeout_value) # Measure current from Vbatt meas_ibatt = self.em_core_module.get_battery_current() # Check if the hardware charging is ok current_threshold = -(self.__hardware_charge_current) if (meas_ibatt[0] > current_threshold): txt = "Current value %s is below Hardware current Threshold %s => Hardware Charging Failed" \ % (str(meas_ibatt[0]), str(current_threshold)) self._logger.error(txt) raise AcsConfigException(AcsConfigException.OPERATION_FAILED, txt) # Second Part => Test the Charging OS # set the vbatt voltage to the Charging OS threshold self.em_core_module.get_eq_emulated_battery().set_current_voltage(self.__charging_os_voltage, self.em_core_module.ps_properties["BATT"]["PortNumber"]) # Check the power button activation if (self.__power_button_press_activation == True): self._io_card.press_power_button(3) # Wait the Boot of the board => Charging OS Expected self._logger.info("Wait %ss for booting board" % self.__cos_boot_timeout_value) mode = self._device.get_boot_mode() end_time = time.time() + self.__cos_boot_timeout_value while (time.time() < end_time) and (mode == "UNKNOWN"): mode = self._device.get_boot_mode() time.sleep(1) # Check if the board boots in COS if mode != "UNKNOWN": if mode != "COS": txt = "Board does not boot in COS before the COS Timeout. boot %s" % mode self._logger.error(txt) raise DeviceException(DeviceException.OPERATION_FAILED, txt) else: txt = "Board boot mode is COS => This test is PASS" self._logger.info(txt) else: txt = "Board boot mode is UNKNOWN => Problem during the boot" self._logger.error(txt) raise DeviceException(DeviceException.OPERATION_FAILED, txt) return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Init function EmUsecaseBase.run_test_body(self) # init error Msg self._error.Msg = "" # init vbatt to the emergency battery voltage self._logger.info("START THE TEST BY SETTING THE EMERGENCY " + "BATTERY VOLTAGE (%s V)" % self._emergency_voltage) self.em_core_module.pwrs_vbatt.set_current_voltage( self._emergency_voltage, self.em_core_module.ps_properties["BATT"]["PortNumber"]) time.sleep(15) # measure battery current ibatt = self.em_core_module.get_battery_current() # store result in dict for later comparison self._meas_list.add("IBATT_AFTER_EMERGENCY", ibatt) # test the value in order to return a good error message result = self._em_meas_verdict.test_value( self._meas_list, self._em_targets["IBATT_AFTER_EMERGENCY"]) if result is False: self._error.Msg += "the board shall be OFF after a voltage drop " \ + "to %s\n" % self._emergency_voltage # set a normal battery voltage self._logger.info("RESTORE A NORMAL BATTERY VOLTAGE AND CHECK LOG") self.em_core_module.pwrs_vbatt.set_current_voltage( self._normal_battery_voltage, self.em_core_module.ps_properties["BATT"]["PortNumber"]) # record time before booting the board before_boot_time = time.time() # boot the board self.em_core_module.boot_board("MOS") # check shutdown confirmation shutdown_reason = self.phonesystem_api.check_message_in_log( "SHUTDOWN_REASON2", before_boot_time, time.time(), True) # store result in dict for later comparison self._meas_list.add("SHUTDOWN_REASON", shutdown_reason[0], "none") # test the value in order to return a good error message result = self._em_meas_verdict.test_value( self._meas_list, self._em_targets["SHUTDOWN_REASON"]) if result is False: self._error.Msg += "The shutdown reason is not good in the device logs\n" # compare values with targets self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._em_meas_verdict.judge(ignore_blocked_tc=True) self._meas_list.clean() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg += self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test Check the end of the main battery charge """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) self.__heat_board() self._em_meas_verdict.judge() return self._em_meas_verdict.get_current_result_v2()
def run_test_body(self): EmUsecaseBase.run_test_body(self) self._logger.info("Start to discharge battery until %s%%" % self.em_core_module.batt_min_capacity) while (self.batt_capacity > self.em_core_module.batt_min_capacity and self.measurement_fail < self._consecutive_meas_error): self.stress_discharge(self.hard_stress_time) self.soft_discharge(self.soft_stress_time) return (self._em_meas_verdict.get_global_result(), self._em_meas_verdict.save_data_report_file())
def run_test_body(self): """ here we discharge twice to compare the voltage at shutdown level. Shutdown level is at 0% of capacity on android system. it may change on other """ EmUsecaseBase.run_test_body(self) msic = self.update_battery_info() # get voltage unit unit = msic["BATTERY"]["VOLTAGE"][1] def __discharge_part(load, load_timeout, text): self.__load_module.stop_load() self.__load_module.start_load(load) self.__discharge_to_off_without_data(load_timeout) error_text = "" # plug a data cable to see if the board boot in COS or MOS self.__retrieve_the_board_to_mos() if self.is_board_and_acs_ok(): voltage = self.__retrieve_autolog_result(text) # exit here if we fail to get the voltage at 0% if voltage is None: error_text = "load %s never reach 0%% of capacity" % str(load) if error_text != "": # leave here as test is KO if 0% not seen self._meas_list.add("DELTA_BETWEEN_HIGH_AND_LIGHT_LOAD", "CAPACITY_AT_ZERO_NEVER_REACHED", "") self._logger.error(error_text) raise DeviceException(DeviceException.OPERATION_FAILED, error_text) return voltage # First discharge with the load that take more time to discharge light_voltage = __discharge_part(self.__light_load, self.__light_load_timeout, "light_load") if self.is_board_and_acs_ok() and light_voltage is not None: # if board capacity is too low then charge a little bit if self.batt_capacity + 1 < int(self.em_core_module.batt_start_capacity): self.em_core_module.monitor_charging(self.em_core_module.batt_start_capacity, 120, self.__em_meas_tab) # Discharge with high load high_voltage = __discharge_part(self.__high_load, self.__high_load_timeout, "high_load") if high_voltage is not None: # generate em verdict self._meas_list.add("DELTA_BETWEEN_HIGH_AND_LIGHT_LOAD", high_voltage - light_voltage, unit) self._em_meas_verdict.compare_list(self._meas_list, self._em_targets, True) self._em_meas_verdict.judge(ignore_blocked_tc=True) # Save data report in xml file return(self._em_meas_verdict.get_current_result(), self._em_meas_verdict.save_data_report_file())
def run_test_body(self): """ Execute the test """ EmUsecaseBase.run_test_body(self) # compare values with targets self.__load_module.stop_load() self.em_api.clean_autolog() self.em_api.clean_daemon_files() return Global.SUCCESS, "No errors"
def run_test_body(self): EmUsecaseBase.run_test_body(self) # device is in initial state self._logger.info("Starting discharge to %s percent of capacity " % self.__min_range) _, discharging_result = self._start_logged_discharging() if self.__target == "capacity_jump": is_a_capacity_jump_while_discharge, msg = self._seek_capajump_and_log_values( discharging_result) msg += " While discharging" if is_a_capacity_jump_while_discharge: raise DeviceException(DeviceException.OPERATION_FAILED, msg) elif self.__target == "voltage_ocv": is_vocv_ok = self._check_vocv_and_log_value( discharging_result, self.__min_range) if not is_vocv_ok: msg = "Discharging : Voltage ocv at %s is not at the expected value" % self.__min_range raise DeviceException(DeviceException.OPERATION_FAILED, msg) else: msg = "Discharging : Voltage OCV is at the expected value at %s of capacity" % self.__min_range # charge self._logger.info("Starting charge to %s percent of capacity " % self.__max_range) _, charging_result = self._start_logged_charging() if self.__target == "capacity_jump": # result and save to file is_a_capacity_jump_while_charge, msg = self._seek_capajump_and_log_values( charging_result) msg += "While charging" if is_a_capacity_jump_while_charge: raise DeviceException(DeviceException.OPERATION_FAILED, msg) elif self.__target == "voltage_ocv": is_vocv_ok = self._check_vocv_and_log_value( discharging_result, self.__max_range) if not is_vocv_ok: msg += " - Charging :Voltage ocv at %s is not at the expected value" % self.__max_range raise DeviceException(DeviceException.OPERATION_FAILED, msg) else: msg += " - Charging :Voltage OCV is at the expected value at %s of capacity" % self.__max_range return Global.SUCCESS, msg
def run_test_body(self): """ Execute the test Check the end of the main battery charge """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) # first of all charge to full em_info_list = self.__charge_without_data() start_index = None full_seen = False index = 0 # search for the first iteration of the capacity at which full appear for em_dico in em_info_list: if em_dico["BATTERY"]["CAPACITY"][ 0] == self.__first_full_capacity and start_index is None: start_index = index if em_dico["BATTERY"]["STATUS"][0] == "FULL": full_seen = True break index += 1 # all the test above consider that the FULL status has already been seen # else an error is raised here if not full_seen: txt = "Battery FULL status was not reached after waiting %ss with %s plugged" % ( self.__charge_full_timeout, self.__charger_type) self._logger.error(txt) raise DeviceException(DeviceException.OPERATION_FAILED, txt) if self.__what_to_check == "CAPACITY_AT_WHICH_FIRST_FULL_APPEAR": self.__check_first_full_capacity(em_info_list) elif self.__what_to_check == "TIME_TO_SEE_FULL_AT_MAX_CAPACITY": self.__check_first_full_timeout(em_info_list, start_index) elif self.__what_to_check == "TIME_TO_CHARGE_TO_FULL_FROM_START_CAPACITY": self.__check_charge_to_full_timeout(em_info_list) elif self.__what_to_check == "CAPACITY_JUMP_NEAR_FULL": self.__check_capacity_jump(em_info_list, start_index) elif self.__what_to_check == "CHARGE_STOP_ONCE_FULL": self.__check_charge_stop(em_info_list) # compare values with targets self._em_meas_verdict.compare_list(self._meas_list, self._em_targets, clean_meas_list=True) self._em_meas_verdict.judge() return self._em_meas_verdict.get_current_result_v2()
def run_test_body(self): """ Execute the test """ # Cpt Initializa cpt = 1 new_voltage = self.__start_battery_voltage # Call LAB_EM_BASE_PS Run function EmUsecaseBase.run_test_body(self) while new_voltage >= self.__end_battery_voltage: # set the vbatt voltage self.em_core_module.get_eq_emulated_battery().set_current_voltage( new_voltage, self.em_core_module.ps_properties["BATT"]["PortNumber"]) # Plug the right USB Charger self._io_card.simulate_insertion(self.__charger_type) # Wait during wait_time value self._logger.info("Wait %d seconds..." % self.__wait_time) time.sleep(self.__wait_time) # Measure current from Vbatt meas_ibatt = self.em_core_module.get_battery_current() # Disconnect USB self.em_core_module.plug_charger("None") if float(meas_ibatt[0]) > self.__expected_charge_current: txt = "Current value %f is out of range for voltage : %f V => Wrong charge current" \ % (float(meas_ibatt[0]), new_voltage) self._logger.error(txt) raise DeviceException(DeviceException.OPERATION_FAILED, txt) else: txt = "Current value %f A is good" % meas_ibatt[0] self._logger.info(txt) # Set a the voltage value cpt += 1 new_voltage = self.__start_battery_voltage - (float(cpt) * self.__battery_step) self._logger.info("New voltage value : %f V" % new_voltage) time.sleep(5) return Global.SUCCESS, "no error"
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) self.__fail_to_get_em_info = False # if we reach here it means that we have the correct value in behavior sorted_behavior = self.__raw_behavior.split("_") for action in sorted_behavior: action = action.strip() # Charge/discharge battery depending of fuel gauging option used if action == "CHARGE": # after a discharge board may be totally off , try to charge it a little bit if not self.is_board_and_acs_ok(): if self.__boot_in_mos_board( self.em_core_module.charge_time): self.__bring_board_above_vbatt_MOS_boot() self.__retrieve_lost_em_info() # Update Battery Information em_info = self.update_battery_info() if self.em_core_module.is_batt_capacity_below_target( em_info, self.em_core_module.batt_max_capacity): self.em_core_module.monitor_charging( self.em_core_module.batt_max_capacity, self.em_core_module.charge_time, self.__em_meas_tab) else: self._logger.info( "Cant charge the board as battery capacity is above the max capacity" ) elif action == "DISCHARGE": # Update Battery Information em_info = self.update_battery_info() if self.em_core_module.is_batt_capacity_above_target( em_info, self.em_core_module.batt_min_capacity): self.__monitor_discharging_with_load( self.em_core_module.batt_min_capacity, self.em_core_module.discharge_time, self.__em_meas_tab, self.__load_module) else: self._logger.info( "Cant discharge the board as battery capacity is below the min capacity" ) return Global.SUCCESS, "No errors"
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) if self.__charger_is_data_cable: self.__test_with_data(self.__temperature) else: self.__test_without_data(self.__temperature) # value comparing are done in private function self._em_meas_verdict.judge() return self._em_meas_verdict.get_current_result_v2()
def run_test_body(self): """ Execute the test """ EmUsecaseBase.run_test_body(self) self._run_charging_sequence_control() self._run_cc_cv_charge_mode() # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._meas_list.clean() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the tests """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) if "MOS" in self._test_os: # boot the board in MOS self._MOS_boot_time = time.time() self.em_core_module.boot_board("MOS") # Set screen timeout to 30 minutes self.phonesystem_api.set_screen_timeout(60 * 60) # run mos sequence self._run_mos_sequence() if "POS" in self._test_os: # boot the board in POS self._before_pos_boot_time = time.time() self.em_core_module.boot_board("POS") # run pos sequence self._run_pos_sequence() if "ROS" in self._test_os: # boot the board in POS self.em_core_module.boot_board("ROS") # run pos sequence self._run_ros_sequence() if not (("MOS" in self._test_os) or ("POS" in self._test_os) or ("ROS" in self._test_os)): raise AcsConfigException( AcsConfigException.INVALID_PARAMETER, "parameter test_os %s is invalid" % self._test_os) # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._meas_list.clean() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE_PS Run function EmUsecaseBase.run_test_body(self) # Call UECmd in order to verify the DMESG logs uecmd_result = self.em_api.is_digital_battery_valid() # Verify the verdict if not uecmd_result: txt = "the Battery charging profile may have not been load in the board" self._logger.error(txt) raise DeviceException(DeviceException.OPERATION_FAILED, txt) else: txt = "Digital Battery is Valid" self._logger.info(txt) return Global.SUCCESS, "the battery charging profile was well loaded"
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Init function EmUsecaseBase.run_test_body(self) # run the test: self.__run_zone_to_threshold_test() self.__run_critical_shutdown_test() # compare values with targets self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._em_meas_verdict.judge(ignore_blocked_tc=True) self._meas_list.clean() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() self._logger.debug("[THERMAL] Thermal test end") return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) crash_counter = 0 # Call the fast freeze board function while crash_counter <= 2: self.phonesystem_api.freeze_boot_board( self._wait_end_freeze_timeout, self._crash_type) crash_counter += 1 self._logger.info("Crashes are OK, the board should be in ROS !") time.sleep(30) time_value = time.time() # Check the OS boot_mode = self._device.get_boot_mode() self._meas_list.add("BOOT_MODE", boot_mode, "none") self._device.reboot(self._start_os) value_logs = self.phonesystem_api.check_message_in_log( "BOOT_REASON", time_value - 30, time_value, True) self._logger.info("The value of the boot is equal to %s " % value_logs[0]) self._meas_list.add("BOOT_REASON", value_logs[0], "none") # compare values with targets self._em_meas_verdict.compare_list(self._meas_list, self._em_targets, clean_meas_list=True) self._em_meas_verdict.judge() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) if self._test_type == "CRITICAL_BATT" or self._test_type == "BOTH": self._run_power_down_upon_charger_removal() if self._test_type == "BELOW_CRITICAL" or self._test_type == "BOTH": self._run_no_poweron_on_critical_vbatt() # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._meas_list.clean() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) if self._charger_type == "ALL": for charger in self._io_card.SUPPORTED_DEVICE_TYPE: if charger not in [ self._io_card.USB_HOST_PC, self._io_card.OTG, self._io_card.WALL_CHARGER ]: self._run_test_for_specific_charger(charger) else: self._run_test_for_specific_charger(self._charger_type) # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ Execute the test """ EmUsecaseBase.run_test_body(self) if "THERMAL" in self.__uecmd_type: # test thermal self.__thermal_test() if "MSIC" in self.__uecmd_type: # test msic uecmd self.__msic_test() if "BCU" in self.__uecmd_type: # test bcu uecmd self.__bcu_test() if "AUTOLOG" in self.__uecmd_type: # test autolog uecmd self.__autolog_test() if "SCREEN" in self.__uecmd_type: # test screen uecmd self.__screen_test() if "STATUS" in self.__uecmd_type: # test status uecmd self.__status_test() if "CONSUMPTION" in self.__uecmd_type: # test consumption uecmd self.__consumption_test() if "MULTIMEDIA" in self.__uecmd_type: # test multimedia uecmd self.__multimedia_test() # compare values with targets self._em_meas_verdict.compare_list(self._meas_list, self._em_targets, True) self._em_meas_verdict.judge(True) return self._em_meas_verdict.get_current_result_v2()
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) self._logger.debug(" run API get_misc_register") # Set API to start in x seconds to read and store all MSIC registers time1_before = time.time() pid1 = self.em_api.get_msic_registers("scheduled", self._scheduled_timer_1) time1_after = time.time() # Set API to start in x seconds to read and store all MSIC registers time2_before = time.time() pid2 = self.em_api.get_msic_registers("scheduled", self._scheduled_timer_2) time2_after = time.time() # disconnect usb and close connection self._io_card.usb_connector(False) self._device.disconnect_board() # Select usb device DCP and connect usb self._io_card.simulate_insertion(self._charger_type) # Change the charger voltage to the test voltage condition self.em_core_module.get_eq_emulated_charger().set_current_voltage( self._vusb_test_voltage, self.em_core_module.ps_properties["USB"]["PortNumber"]) self._logger.debug(" set VUSB to %s" % self._vusb_test_voltage) time.sleep(1) # wake up or put the the board in idle upon test configuration if self._idle_state_during_test: self._io_card.press_power_button(0.3) # Wait time between command if (time.time() - time1_before) > self._scheduled_timer_1: return Global.FAILURE, "Test implementation incorrect (increase MSIC_REGISTER1 / scheduled_time constant)" self._wait_smart_time(time1_after, self._scheduled_timer_1) time.sleep(3) # Measure current from Vbatt meas_ibatt = self.em_core_module.get_battery_current() # Measure current from Vusb meas_iusb = self.em_core_module.get_charger_current(self._charger_type) self._logger.info( "Charger %s plugged : IBatt = %s %s , IUsb = %s %s " % (self._charger_type, meas_ibatt[0], meas_ibatt[1], meas_iusb[0], meas_iusb[1])) # Compare ibatt value with limit parameters self._meas_list.add("IBATT1", meas_ibatt) # Compare iusb value with limit parameters self._meas_list.add("IUSB1", meas_iusb) # Change back the charger voltage to the normal voltage condition self.em_core_module.get_eq_emulated_charger().set_current_voltage( self._vusb, self.em_core_module.ps_properties["USB"]["PortNumber"]) self._logger.debug(" set VUSB to %s" % self._vusb) # Wait time between command if (time.time() - time2_before) > self._scheduled_timer_2: return Global.FAILURE, "Test implementation incorrect (increase MSIC_REGISTER2 / scheduled_time constant)" self._wait_smart_time(time2_after, self._scheduled_timer_2) # wake up the screen self._io_card.press_power_button(0.3) time.sleep(2) # Measure current from Vbatt meas_ibatt = self.em_core_module.get_battery_current() # Measure current from Vusb meas_iusb = self.em_core_module.get_charger_current(self._charger_type) self._logger.info( "Charger %s plugged : IBatt = %s %s , IUsb = %s %s " % (self._charger_type, meas_ibatt[0], meas_ibatt[1], meas_iusb[0], meas_iusb[1])) # Compare ibatt value with limit parameters self._meas_list.add("IBATT2", meas_ibatt) # Compare iusb value with limit parameters self._meas_list.add("IUSB2", meas_iusb) # Connect USB PC/Host and DUT self.em_core_module.check_board_connection(only_reconnect=True) self._logger.debug(" get misc register") # Read Platform OS and compare MSIC registers with expected values msic_registers = self.em_api.get_msic_registers("read", pid1) self._meas_list.add_dict("MSIC_REGISTER1", msic_registers, msic_registers["TIME_STAMP"][0]) # Read Platform OS and compare MSIC registers with expected values msic_registers = self.em_api.get_msic_registers("read", pid2) self._meas_list.add_dict("MSIC_REGISTER2", msic_registers, msic_registers["TIME_STAMP"][0]) # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._em_meas_verdict.judge() self._meas_list.clean() return self._em_meas_verdict.get_current_result_v2()
def run_test_body(self): """ Execute the test """ # Call LAB_EM_BASE Run function EmUsecaseBase.run_test_body(self) # Connect USB PC/Host and DUT self.em_core_module.check_board_connection(only_reconnect=True) # Measure current from Vbatt meas_ibatt = self.em_core_module.get_battery_current() # Compare Vbatt value with limit parameters self._meas_list.add("IBATT1", meas_ibatt) # Wait time between command time.sleep(self._scheduled_timer_1) # get the delta_time result and compare it result1 = self.em_api.get_fuel_gauging_monitoring_time_result() self._meas_list.add("DELTA_TIME1", (result1[0], "none")) # switch on /off the charge self.em_core_module.plug_charger(self._io_card.WALL_CHARGER) time.sleep(15) self.em_core_module.unplug_charger(self._io_card.WALL_CHARGER) # Plug SDP self.em_core_module.check_board_connection(only_reconnect=True) time.sleep(5) # Wait time between command time.sleep(self._scheduled_timer_1) # get the delta_time result and compare it result2 = self.em_api.get_fuel_gauging_monitoring_time_result() # check if it is a new delta time if result2[1] == result1[1]: self._logger.info(" no new delta time in aplog") self._meas_list.add("DELTA_TIME2", ("no new delta time in aplog", "none")) else: self._meas_list.add("DELTA_TIME2", (result2[0], "none")) # Wait time between command time.sleep(self._scheduled_timer_1) # Read Platform OS and compare MSIC registers with expected values msic_registers = self.em_api.get_msic_registers() self._meas_list.add_dict("MSIC_REGISTER1", msic_registers, msic_registers["TIME_STAMP"][0]) # switch on /off the charge self.em_core_module.plug_charger(self._io_card.WALL_CHARGER) time.sleep(15) # Measure current from Vbatt meas_ibatt = self.em_core_module.get_battery_current() # Compare Vbatt value with limit parameters self._meas_list.add("IBATT2", meas_ibatt) self.em_core_module.unplug_charger(self._io_card.WALL_CHARGER) # Plug SDP self.em_core_module.check_board_connection(only_reconnect=True) time.sleep(5) # Wait time between command time.sleep(self._scheduled_timer_1) # get the delta_time result and compare it result3 = self.em_api.get_fuel_gauging_monitoring_time_result() # check if it is a new delta time if result3[1] == result2[1]: self._logger.info(" no new delta time in aplog") self._meas_list.add("DELTA_TIME3", ("no new delta time in aplog", "none")) else: self._meas_list.add("DELTA_TIME3", (result3[0], "none")) # switch on /off the charge self.em_core_module.plug_charger(self._io_card.WALL_CHARGER) time.sleep(15) self.em_core_module.unplug_charger(self._io_card.WALL_CHARGER) # Plug SDP self.em_core_module.check_board_connection(only_reconnect=True) time.sleep(5) # Wait time between command time.sleep(self._scheduled_timer_1) # get the delta_time result and compare it result4 = self.em_api.get_fuel_gauging_monitoring_time_result() # check if it is a new delta time if result4[1] == result3[1]: self._logger.info(" no new delta time in aplog") self._meas_list.add("DELTA_TIME4", ("no new delta time in aplog", "none")) else: self._meas_list.add("DELTA_TIME4", (result4[0], "none")) # Wait time between command time.sleep(self._scheduled_timer_1) # Read Platform OS and compare MSIC registers with expected values msic_registers = self.em_api.get_msic_registers() self._meas_list.add_dict("MSIC_REGISTER2", msic_registers, msic_registers["TIME_STAMP"][0]) # check read only file system try: self.phonesystem_api.write_file("hello", self.em_api._batt_capacity) # pylint:disable=W0212 self._meas_list.add("FILE_SYSTEM", ("write on file system", "none")) except AcsBaseException as e: if str(e).find("no write permission"): # expected behavior self._meas_list.add("FILE_SYSTEM", ("READ-ONLY FILE SYSTEM", "none")) else: self._meas_list.add("FILE_SYSTEM", ("unknown file system", "none")) # generate em verdict self._em_meas_verdict.compare_list(self._meas_list, self._em_targets) self._meas_list.clean() # Save data report in xml file self._error.Code = self._em_meas_verdict.get_current_result() self._error.Msg = self._em_meas_verdict.save_data_report_file() return self._error.Code, self._error.Msg
def run_test_body(self): """ run test """ EmUsecaseBase.run_test_body(self) # inject a start tag with the host date as unique id start_tag = "START_WAITING_FOR_INTENT-" + time.strftime( "-%Y-%m-%d_%Hh%M.%S") if not self.__parser_api.inject_tag(start_tag): error_msg = "The tag [%s] failed to be injected on logs" % ( start_tag) self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) # start HOST Video if not self.__media_player is None: self.__media_player.play(self.__host_media, self.__host_monitor) # media may take time to start start_time = time.time() while time.time() - start_time < 10: time.sleep(1) if self.__media_player.is_playing(): break if not self.__media_player.is_playing(): error_msg = "Fail to start the video playback on the HOST side" self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) # start video recording self.phonesystem_api.wake_screen() self.phonesystem_api.set_phone_lock(False) raw_video_filename, _ = self.__video_capture_mod.start_recording() # Check if the video file exist if not self.__video_record_api.check_video_exist(raw_video_filename): self._logger.error("Recording fail to start, retry again") raw_video_filename, _ = self.__video_capture_mod.start_recording() # Check if the video file exist if not self.__video_record_api.check_video_exist( raw_video_filename): screen_path = self._device.screenshot(filename=os.path.join( self.__pic_folder, "camera_record_start_fail.png")) error_msg = "Fail to see the raw video file generated during the record, it seems that the video record may has not started." if screen_path is not None: error_msg += "\nPlease check the screenshot at %s." % screen_path self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) # remove any cable self._device.disconnect_board() self._io_card.remove_cable("ALL") self._logger.info("waiting %ss to let the video recording be done" % str(self.__record_duration)) time.sleep(self.__record_duration) # reconnect usb cable self._io_card.usb_host_pc_connector(True) time.sleep(self.usb_sleep) self._device.connect_board() # check if board did not went off during the test boot_mode = self._device.get_boot_mode() if boot_mode != "MOS": error_msg = "The board is seen not booted in MOS but in %s at the end of the test , cant compute result" % ( boot_mode) self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) # get a screenshot to check if camera is still recording self._device.screenshot(filename=os.path.join( self.__pic_folder, "test_end_board_screen.png")) self.__video_capture_mod.stop_recording() # inject a stop tag with the host date as unique id stop_tag = "STOP_WAITING_FOR_INTENT-" + time.strftime( "-%Y-%m-%d_%Hh%M.%S") if not self.__parser_api.inject_tag(stop_tag): error_msg = "The tag [%s] failed to be injected on logs " % ( stop_tag) self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) # stop HOST Video if not self.__media_player is None: self.__media_player.stop() # get start intent to extract the time start_intent = self.__parser_api.find_txt_between_tag( start_tag, stop_tag, self.__video_record_api.CAMERA_TAG.get("RECORD_START"), raise_error=True)[0] # "ACS_TAG_INJECTOR: START_WAITING_FOR_INTENT--2014-12-22_11h40.22" cooling_intents = self.__parser_api.find_txt_between_tag( start_tag, stop_tag, self.__parser_api.THERMAL_TAG.get("COOLING_INTENT"), raise_error=False) action_seen = False local_msg = "" action_before_video = False # parse every zone to analyze only the wanted one for cooling_intent in cooling_intents: result = self.__parser_api.parse_thermal_cooling_event( cooling_intent) if result is not None: zone, level, temperature = result zone = zone.upper() # this way allow to compare simple str to several monitored zone # if we are in ANY case, compute the first seen and leave the test here if self.__zone_to_inspect in ["ANY", zone]: # get the time structure for the cooling intent thermal_time_structure, thermal_millisec = self.__parser_api.get_log_date( cooling_intent) time_cooling_happen = float( calendar.timegm(thermal_time_structure)) + ( float(thermal_millisec) * 0.001) # get the time structure for start intent start_time_structure, start_millisec = self.__parser_api.get_log_date( start_intent) time_intent_sent = float( calendar.timegm(start_time_structure)) + ( float(start_millisec) * 0.001) # if the time between cooling action and the video camera start is < 0 then it is a pass but with a warning spend_time = time_cooling_happen - time_intent_sent if spend_time < 0: self._meas_list.add( "TIME_TAKEN_TO_SEE_FIRST_COOLING_ACTION", spend_time, "SECOND") local_msg += "A cooling action has been seen %ss before video recording start: zone=%s level=%s temperature=%s.\n" % ( abs(spend_time), zone, level, temperature) action_before_video = True else: self._meas_list.add( "TIME_TAKEN_TO_SEE_FIRST_COOLING_ACTION", spend_time, "SECOND") local_msg += "First cooling action seen %ss after video recording start: zone=%s level=%s temperature=%s.\n" % ( spend_time, zone, level, temperature) action_seen = True break msg = "no cooling action seen." if local_msg != "": msg = local_msg if action_before_video == True: msg += "A manual check on cooling actions before video start is required to see if it is a real FAIL or PASS.." # generate em verdict if not action_seen: self._meas_list.add("TIME_TAKEN_TO_SEE_FIRST_COOLING_ACTION", self.__record_duration, "SECOND") self._em_meas_verdict.compare_list(self._meas_list, self._em_targets, True) self._em_meas_verdict.judge() verdict, verdict_msg = self._em_meas_verdict.get_current_result_v2() msg = msg + "\n" + verdict_msg return verdict, msg
def run_test_body(self): """ run test """ EmUsecaseBase.run_test_body(self) ####################################### TAG TEST START, WAIT FOR TEST, THEN TAG TEST END ########################################### # inject a start tag with the host date as unique id start_tag = "START_WAITING_FOR_INTENT-" + time.strftime( "-%Y-%m-%d_%Hh%M.%S") if not self.__parser_api.inject_tag(start_tag): error_msg = "The tag [%s] failed to be injected on logs" % ( start_tag) self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) # remove any cable self._device.disconnect_board() self._io_card.remove_cable("ALL") bk_duration = self.__benchmark_module.get_exec_whole_duration() delay_left = self.__bk_delay - (time.time() - self.__host_test_start_time) if delay_left > 1: self._logger.info( "Waiting %ss to align benckmark launching time with beginning of waiting duration" % str(delay_left)) time.sleep(delay_left) start_time = time.time() self._logger.info("waiting %ss of benchmark execution" % str(bk_duration)) time.sleep(bk_duration) stop_time = time.time() # reconnect usb cable warning_crash = False self._io_card.usb_host_pc_connector(True) time.sleep(self.usb_sleep) self._device.connect_board() # check if board did not went off during the test boot_mode = self._device.get_boot_mode() if boot_mode != "MOS": error_msg = "The board is seen not booted in MOS but in %s at the end of the test , cant compute result" % ( boot_mode) self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) self._device.screenshot(filename=os.path.join( self.__pic_folder, "test_end_board_screen.png")) # inject a stop tag with the host date as unique id stop_tag = "STOP_WAITING_FOR_INTENT-" + time.strftime( "-%Y-%m-%d_%Hh%M.%S") if not self.__parser_api.inject_tag(stop_tag): error_msg = "The tag [%s] failed to be injected on logs " % ( stop_tag) self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) ####################################### CHECK BENCHMARK CRASH ########################################### # first check that there were no crashes start_date = self.__benchmark_module.get_start_date() crash_date, _ = self.__benchmark_module.get_crash() # if a crash happen but after that the test end , then the test may be passed with a warning if start_date is not None: if crash_date is not None: bk_exact_duration = crash_date - start_date host_exact_duration = stop_time - start_time if bk_exact_duration <= host_exact_duration: self.__benchmark_module.check_crash() else: warning_crash = True else: error_msg = "Cant retrieve benchmark start date, it seems that the benchmark may have not been started" self._logger.error(error_msg) raise DeviceException(DeviceException.OPERATION_FAILED, error_msg) # try to stop the benchmark, if it fail, continue the measurement try: self.__benchmark_module.stop_execution() except Exception as e: self._logger.error("error happen when stopping benchmark %s" % str(e)) # upload benchmark result try: score_list = self.__benchmark_module.get_score() self.__push_score(score_list) except Exception as e: self._logger.error( "Error happen when trying to upload benchmark: %s" % str(e)) ####################################### SEARCH FOR COOLING ACTION ########################################### # get start intent to extract the time start_intent = self.__parser_api.find_txt_between_tag( start_tag, stop_tag, self.__benchmark_module.BENCHMARK_START_TAG, raise_error=True)[0] # "ACS_TAG_INJECTOR: START_WAITING_FOR_INTENT--2014-12-22_11h40.22" cooling_intents = self.__parser_api.find_txt_between_tag( start_tag, stop_tag, self.__parser_api.THERMAL_TAG.get("COOLING_INTENT"), raise_error=False) action_seen = False local_msg = "" action_before_benchmark = False # parse every zone to analyze only the wanted one for cooling_intent in cooling_intents: result = self.__parser_api.parse_thermal_cooling_event( cooling_intent) if result is not None: zone, level, temperature = result zone = zone.upper() # this way allow to compare simple str to several monitored zone # if we are in ANY case, compute the first seen and leave the test here if self.__zone_to_inspect in ["ANY", zone]: # get the time structure for the cooling intent thermal_time_structure, thermal_millisec = self.__parser_api.get_log_date( cooling_intent) time_cooling_happen = float( calendar.timegm(thermal_time_structure)) + ( float(thermal_millisec) * 0.001) # get the time structure for start intent start_time_structure, start_millisec = self.__parser_api.get_log_date( start_intent) time_intent_sent = float( calendar.timegm(start_time_structure)) + ( float(start_millisec) * 0.001) spend_time = time_cooling_happen - time_intent_sent if spend_time < 0: self._meas_list.add( "TIME_TAKEN_TO_SEE_FIRST_COOLING_ACTION", spend_time, "SECOND") local_msg += "A cooling action has been seen %ss before benchmark start and after board was cool down : zone=%s level=%s temperature=%s.\n" % ( abs(spend_time), zone, level, temperature) action_before_benchmark = True else: self._meas_list.add( "TIME_TAKEN_TO_SEE_FIRST_COOLING_ACTION", spend_time, "SECOND") local_msg += "First cooling action seen %ss after benchmark start: zone=%s level=%s temperature=%s.\n" % ( spend_time, zone, level, temperature) action_seen = True break msg = "no cooling action seen." if local_msg != "": msg = local_msg if action_before_benchmark == True: msg += "A manual check on cooling actions before benchmark is required to see if it is a real FAIL or PASS.." # generate em verdict if not action_seen: self._meas_list.add("TIME_TAKEN_TO_SEE_FIRST_COOLING_ACTION", bk_duration, "SECOND") self._em_meas_verdict.compare_list(self._meas_list, self._em_targets, True) self._em_meas_verdict.judge() verdict, verdict_msg = self._em_meas_verdict.get_current_result_v2() msg = msg + "\n" + verdict_msg if warning_crash: msg = "A crash happened but it was after the test end, result can be computed.\n" + msg msg += "\nBenchmark scores may be seen in file %s" % self.__benchamrk_tab.get_report_path( ) return verdict, msg