Exemplo n.º 1
0
    def set_up(self):
        """
        Charge the board to match the start capacity.
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # check battery state is in expected value
        if self.__expected_batt_state not in [
                "CHARGING", "DISCHARGING", "NOT CHARGING", "FULL"
        ]:
            tmp_txt = "unknown EXPECTED_BATT_STATE value : %s" % \
                str(self.__expected_batt_state)
            self._logger.error(tmp_txt)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     tmp_txt)

        if self.__multimedia_type in ["AUDIO", "VIDEO"]:
            self.__multimedia_type = self.__multimedia_type.capitalize()
            self.__multimedia_api = self._device.get_uecmd(
                self.__multimedia_type)
        elif self.__multimedia_type != "NONE":
            tmp_txt = "unknown multimedia type: %s" % \
                str(self.__multimedia_api)
            self._logger.error(tmp_txt)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     tmp_txt)

        # init capacity
        self.update_battery_info()

        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_MAINTENANCE_CHARGING",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # update battery temperature expected depending of TCT
        if self.tc_module is not None:
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_MAINTENANCE.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self._em_targets[
                        "THERMAL_MSIC_REGISTER_MAINTENANCE.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        return Global.SUCCESS, "No errors"
Exemplo n.º 2
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # init capacity
        msic = self.update_battery_info()

        # get capability targets
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_OFF_ON_NO_VC",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init verdict value
        if self._em_targets[
                "MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")

        if self.tc_module is not None:
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self.
                    _em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        return Global.SUCCESS, "No errors"
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # Configure CMU
        # Connect to cellular network simulator
        self._ns.init()

        # check that channel is allow for this band
        self._conversion_toolbox.convert_wcdma_channelscript_to_array(
            self._cell_band,
            self._ul_uarfcn)

        # Perform Full Preset
        self._ns.perform_full_preset()

        # Set cell band using CELL_BAND parameter
        self._ns_3g.set_band("BAND" + self._cell_band)

        # Set cell off
        self._ns_3g.set_cell_off()

        # Set Traffic Channel Arfcn using TCH_ARFCN parameter
        self._ns_3g.set_uplink_arfcn(self._ul_uarfcn)

        # Set mobile power using MOBILE_POWER parameter
        self._ns_3g.set_ms_power(self._mobile_power)

        # Set cell power using CELL_POWER parameter
        self._ns_3g.set_cell_power(self._cell_power)

        # init capacity
        msic = self.update_battery_info()

        # get capability targets
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_OFF_ON_VC_3G", self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init verdict value
        if self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")

        # init verdict value
        if self.tc_module is not None:
            if self._em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"] is None:
                EMUtil.update_conf(
                    self._em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(self.em_core_module.batt_max_capacity, self.em_core_module.charge_time,
                              self.__em_meas_tab)

        # set CMU cell phone ON
        self._ns_3g.set_cell_on()

        # register phone
        RegUtil.check_dut_registration_before_timeout(self._ns_3g,
                                                      self.networking_api,
                                                      self._logger,
                                                      None,
                                                      self._registration_timeout)

        # Check registration status on DUT
        self.modem_api.check_cdk_registration_bfor_timeout(
            self._registration_timeout)

        return Global.SUCCESS, "No errors"
    def run_test_body(self):
        EmUsecaseBase.run_test_body(self)

        # configure the board to discharge quicker
        self._logger.info("Start to discharge battery until %s%%" %
                          self.em_core_module.batt_min_capacity)

        # stop charging through usb
        self.em_api.set_usb_charging("off")
        # launch uecmd to help the discharge
        self.phonesystem_api.set_screen_timeout(3600)
        # deactivate set auto brightness
        self.phonesystem_api.set_brightness_mode("manual")
        # set display brightness to max value
        self.phonesystem_api.set_display_brightness(100)
        self.phonesystem_api.set_phone_lock(0)
        # reinitialize consecutive error
        measurement_fail = 0

        self.phone_as_reboot = False
        # discharge loop
        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:

            # update total test value
            self._total_test += 1
            self._logger.info("TEST iteration_%s" % str(self._total_test))

            batt_charge_Low = "FAILED_TO_COMPUTE"
            batt_charge_High = "FAILED_TO_COMPUTE"
            try:
                # get msic registers value after booting
                msic_reg = self.update_battery_info()
                msic_batt = msic_reg["BATTERY"]

                batt_charge_Low = msic_batt["CHARGE_NOW"][0] - \
                    5 * msic_batt["CURRENT_NOW"][0]
                batt_charge_High = msic_batt["CHARGE_NOW"][0] + \
                    5 * msic_batt["CURRENT_NOW"][0]

                if self._em_targets[
                        "MSIC_REGISTER_UNPLUG.BATTERY.CHARGE_NOW"] is not None:
                    EMUtil.update_conf(
                        self.
                        _em_targets["MSIC_REGISTER_UNPLUG.BATTERY.CHARGE_NOW"],
                        ["lo_lim"], batt_charge_Low, "=")
                    EMUtil.update_conf(
                        self.
                        _em_targets["MSIC_REGISTER_UNPLUG.BATTERY.CHARGE_NOW"],
                        ["hi_lim"], batt_charge_High, "=")

                thermal_conf = self.em_api.get_thermal_sensor_info()

                # store result on xml
                self.__em_meas_tab.add_dict_measurement(msic_reg)
                self.__em_meas_tab.add_dict_measurement(thermal_conf)

                # check thermal capabilities only if thermal chamber is used
                if self.tc_module is not None:
                    # Store various information
                    self.__em_meas_tab.add_measurement(
                        [self.tc_module.feed_meas_report()])
                    self._meas_list.add_dict("THERMAL_MSIC_REGISTER_PLUG",
                                             msic_reg)
                    self._meas_list.add_dict("THERMAL_CONF_PLUG", thermal_conf)

                # get the call state
                call_state = "BAND" + self._cell_band
                # Check cs call state
                call_state += "_CS_CALL_" + str(self.voicecall_api.get_state())

                # Store various information
                self.__em_meas_tab.add_measurement([
                    ("REGISTRATION",
                     self.modem_api.get_network_registration_status()),
                    ("VOICE_CALL", call_state)
                ])

            except AcsBaseException as e:
                # try to reconnect to the board if uecmd failed
                self._logger.error(
                    "fail to get measurement for OFF ON cycle SDP PLUG TEST: %s"
                    % str(e))
                measurement_fail += 0.5
            finally:
                # Store various information
                self.__em_meas_tab.add_measurement([
                    self.get_time_tuple(),
                    ("COMMENTS", "OFF ON cycle SDP PLUG TEST")
                ])

                # switch to next meas
                self.__em_meas_tab.switch_to_next_meas()
#------------------------------------------------------------------------------------------

            try:
                # start charging through usb
                self.em_api.set_usb_charging("on")

                # schedule commands
                if self._device.get_state() == "alive":
                    pid = self.em_api.get_msic_registers("scheduled", 15)
                    thermal_pid = self.em_api.get_thermal_sensor_info(
                        "scheduled", 15)

                # Charge board
                self.em_core_module.charge_battery(20)

                # read msic result
                msic_reg = self.em_api.get_msic_registers("read", pid)
                # stop charging through usb
                self.em_api.set_usb_charging("off")

                msic_batt = msic_reg["BATTERY"]
                self.batt_capacity = msic_batt["CAPACITY"][0]
                self.batt_voltage = msic_batt["VOLTAGE"][0]

                # get thermal information
                thermal_conf = self.em_api.get_thermal_sensor_info(
                    "read", thermal_pid)

                # create XML files
                self.__em_meas_tab.add_dict_measurement(msic_reg)
                self.__em_meas_tab.add_dict_measurement(thermal_conf)

                # compute verdict
                self._meas_list.add_dict("MSIC_REGISTER_UNPLUG", msic_reg)

                # get the call state
                call_state = "BAND" + self._cell_band
                # Check cs call state
                call_state += "_CS_CALL_" + str(self.voicecall_api.get_state())

                self.__em_meas_tab.add_measurement([
                    ("REGISTRATION",
                     self.modem_api.get_network_registration_status()),
                    ("VOICE_CALL", call_state)
                ])

                # clean scheduled task
                self.phonesystem_api.clean_daemon_files()
                measurement_fail = 0

            except AcsBaseException as e:
                # try to reconnect to the board if uecmd failed
                self._logger.error(
                    "fail to get measurement for OFF ON cycle SDP UNPLUG TEST:"
                    + str(e))
                measurement_fail += 0.5

                # stop the usecase if measurement fail several times.
                if measurement_fail >= self._consecutive_meas_error:
                    tmp_txt = "Measurement failed after %s times, stop usecase" % \
                        self._consecutive_meas_error
                    self._logger.error(tmp_txt)
                    if self.batt_voltage > self.vbatt_mos_shutdown or self.batt_voltage == -1:
                        raise DeviceException(
                            DeviceException.PROHIBITIVE_MEASURE, tmp_txt)
                    else:
                        self._logger.info(
                            "battery must be empty, stop usecase")
                        break

                # check the board connection
                self.em_core_module.check_board_connection()

            finally:
                self.__em_meas_tab.add_measurement([
                    self.get_time_tuple(),
                    ("COMMENTS", "OFF ON cycle CABLE UNPLUG TEST"),
                    ("REBOOT", self.phone_as_reboot)
                ])

                # generate em verdict
                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()

                # switch to next meas
                self.__em_meas_tab.switch_to_next_meas()

            # restart uecmds to help the discharge if phone as reboot
            if self.has_board_reboot():
                self.phonesystem_api.set_phone_lock(0)
                # stop charging through usb
                self.em_api.set_usb_charging("off")

                # establish a call
                self.voicecall_api.dial("OOOO12121121")

                self.phone_as_reboot = False

            self._logger.info("waiting board discharge during  %s seconds" %
                              self.em_core_module.discharge_time)
            time.sleep(self.em_core_module.discharge_time)

        return (self._em_meas_verdict.get_global_result(),
                self._em_meas_verdict.save_data_report_file())
Exemplo n.º 5
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # Configure CMU
        # Connect to cellular network simulator
        self._ns.init()
        # Perform Full Preset
        self._ns.perform_full_preset()

        # Set cell band using CELL_BAND parameter
        self._ns_2g.set_band(self._cell_band)

        # Set cell off
        self._ns_2g.set_cell_off()

        # Set cell service using CELL_SERVICE parameter
        self._ns_2g.set_cell_service(self._cell_service)

        # Set Traffic Channel Arfcn using TCH_ARFCN parameter
        self._ns_2g.set_tch_arfcn(self._tch_arfcn)

        # Set cell power using CELL_POWER parameter
        self._ns_2g.set_cell_power(self._cell_power)

        # set data uplink channel
        self._data_2g.set_data_channel(self._uplink_channel)

        # configure cellular network burst slots
        self._slots_conf = self.em_core_module.configure_slot()

        # Set main timeslot to 3 and set slot configs
        self._data_2g.set_custom_multislot_config(3,
                                                  self._slots_conf["DL_STATE"],
                                                  self._slots_conf["DL_VALUE"],
                                                  self._slots_conf["UL_STATE"],
                                                  self._slots_conf["UL_VALUE"])

        # init capacity
        msic = self.update_battery_info()

        # get capability targets
        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_OFF_ON_VC_2G",
            self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # init verdict value
        if self._em_targets[
                "MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_PLUG.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")

        # init verdict value
        if self.tc_module is not None:
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self.
                    _em_targets["THERMAL_MSIC_REGISTER_PLUG.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        # 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)

        return Global.SUCCESS, "No errors"
Exemplo n.º 6
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call the UseCaseBase Setup function
        EmUsecaseBase.set_up(self)

        # set usb charging on
        self.em_api.set_usb_charging("on")

        # Check LOAD option
        if self._load not in ["LIGHT", "MEDIUM", "HEAVY"]:
            tmp_txt = "unknown LOAD option value :" + str(self._load)
            self._logger.error(tmp_txt)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     tmp_txt)

        if self._load in ["HEAVY", "MEDIUM"]:
            # Configure CMU
            # Connect to cellular network simulator
            self._ns.init()

            # Perform Full Preset
            self._ns.perform_full_preset()

            # Set cell band using CELL_BAND parameter
            self._ns_2g.set_band(self._cell_band)

            # Set cell off
            self._ns_2g.set_cell_off()

            # Set cell service using CELL_SERVICE parameter
            self._ns_2g.set_cell_service(self._cell_service)

            # Set Traffic Channel Arfcn using TCH_ARFCN parameter
            self._ns_2g.set_tch_arfcn(self._tch_arfcn)

            # Set cell power using CELL_POWER parameter
            self._ns_2g.set_cell_power(self._cell_power)

            # set data uplink channel
            self._data_2g.set_data_channel(self._uplink_channel)

            # configure cellular network burst slots
            self._slots_conf = self.em_core_module.configure_slot()

            # Set main timeslot to 3 and set slot configs
            self._data_2g.set_custom_multislot_config(
                3, self._slots_conf["DL_STATE"], self._slots_conf["DL_VALUE"],
                self._slots_conf["UL_STATE"], self._slots_conf["UL_VALUE"])

        if self._load in ["HEAVY"]:
            # Check initialization and raise exception if something went wrong
            if not self._is_router_name_found:
                msg = "No Wifi router has been specified by the user"
                raise AcsConfigException(
                    AcsConfigException.INVALID_BENCH_CONFIG, msg)

            if not self._is_router_found:
                msg = "router name" + self._wifi_router_name + "is missing"
                raise AcsConfigException(
                    AcsConfigException.INVALID_BENCH_CONFIG, msg)

            if self._ssid == "":
                msg = str(self._ssid) + ": wifi ssid is missing"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

            if self._standard is None:
                # unknown wifi security
                if self._standard_read == "":
                    msg = "wifi standard is missing"
                else:
                    msg = self._standard_read \
                        + ":Unknown wifi standard is missing"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

            if self._security is None:
                # unknown wifi security
                if self._security_read == "":
                    msg = "missing wifi security"
                else:
                    msg = self._security_read + ": unknown wifi security"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

            if (self._security in ("WEP", "WPA", "WPA2")
                    and self._passphrase in ("", None)):
                msg = "Passphrase %s is missing in bench configuration file"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

        # check keys on dict to avoid reading empty files
        msic = self.update_battery_info()

        self._em_targets = self._target_file.parse_energy_management_targets(
            "LAB_EM_BATT_VBATT_LOAD", self._tc_parameters.get_params_as_dict(),
            self._device.get_phone_model())

        # load targets in order to measure iteration
        self._em_meas_verdict.load_target(self._em_targets)

        # update charger full design value
        if self._em_targets[
                "MSIC_REGISTER_STRESS.BATTERY.CHARGE_NOW"] is not None:
            EMUtil.update_conf(
                self._em_targets["MSIC_REGISTER_STRESS.BATTERY.CHARGE_NOW"],
                "hi_lim", msic["BATTERY"]["CHARGE_FULL_DESIGN"][0], "=")
        if self.tc_module is not None:
            # update battery temperature expected depending of TCT
            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_STRESS.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self.
                    _em_targets["THERMAL_MSIC_REGISTER_STRESS.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

            if self._em_targets[
                    "THERMAL_MSIC_REGISTER_NO_STRESS.BATTERY.TEMP"] is not None:
                EMUtil.update_conf(
                    self._em_targets[
                        "THERMAL_MSIC_REGISTER_NO_STRESS.BATTERY.TEMP"],
                    ["lo_lim", "hi_lim"], self._tct, "*")

        # Charge battery
        self.em_core_module.monitor_charging(
            self.em_core_module.batt_max_capacity,
            self.em_core_module.charge_time, self.__em_meas_tab)

        if self._load in ["HEAVY", "MEDIUM"]:
            # set CMU cell phone ON
            self._data_2g.set_data_cell_on()

        # launch uecmd to help the discharge
        self.phonesystem_api.set_screen_timeout(3600)
        # deactivate set auto brightness
        self.phonesystem_api.set_brightness_mode("manual")
        # set display brightness to max value
        self.phonesystem_api.set_display_brightness(100)

        if self._load in ["HEAVY"]:
            # setup wifi connection
            self.__setup_wifi()

            # connect wifi
            self.networking_api.\
                wifi_connect(self._ssid)

        if self._load in ["HEAVY", "MEDIUM"]:
            # register phone
            self._data_2g.data_register_dut(None, self._registration_timeout)

        # reset consecutive error
        self.measurement_fail = 0

        return Global.SUCCESS, "No errors"