Exemple #1
0
    def __init__(self):
        """
        parameter to initialize this module.
        all possible load parameters are declared as public variables.

        this is to help to discharge or to apply load during a test and restart them
        NOT to test the load technology directly.
        """
        overmind = OverMind()
        self.__logger = LOGGER_TEST_SCRIPT
        self.__logger.info(self.__LOG_TAG + "INIT")
        self.__device = overmind.get_instance(overmind.DEVICE)
        self.__tc_parameters = overmind.get_instance(overmind.TC_PARAMETERS)
        bench_config = overmind.get_instance(overmind.BENCH_CONFIG)
        self.__load = {}
        self.__load_list_priority = [LoadModule.SCREEN_ON, LoadModule.TORCHLIGHT, LoadModule.WIFI_ON, LoadModule.WIFI_STANDBY, LoadModule.GPS_ON,
                              LoadModule.BLUETOOTH_ON, LoadModule.VIDEO, LoadModule.VIDEO_CAPTURE, LoadModule.AUDIO, LoadModule.VIBRA]

        # check if a default configuration is present on the board
        if bench_config.has_parameter(self.EM_BENCHCONFIG_TAG):
            default_conf = bench_config.get_parameters(self.EM_BENCHCONFIG_TAG)
            self.__default_load_from_bench = default_conf.get_param_value("DefaultLoad", "")
            self.__media_to_use = default_conf.get_param_value("MediaPath", "")
            self.__volume_to_use = default_conf.get_param_value("MediaVolume", "")
            self.__wifi_ap_to_use = default_conf.get_param_value("WifiAP", "")
        else:
            self.__default_load_from_bench = ""
Exemple #2
0
    def __init__(self):
        """
        parameter to initialize this module.
        :type mode: str
        """
        self.__logger = LOGGER_TEST_SCRIPT
        self.__logger.info(self.__LOG_TAG + "INIT")
        overmind = OverMind()
        device = overmind.get_instance(overmind.DEVICE)
        tc_parameters = overmind.get_instance(overmind.TC_PARAMETERS)
        self.__bench_config = overmind.get_instance(overmind.BENCH_CONFIG)

        #-----------------------------------------------------------------------
        self.__ssid = ""
        self.__security = None
        self.__security_found = None
        self.__passphrase = None
        self.__is_router_name_found = False
        self.__is_router_found = False
        self.__setup_needed = True
        self.__wifi_router_name = None

        # Retrieve wifi access point from testcase
        wifi_router_name_from_tc = tc_parameters.get_param_value("WIFI_ACCESS_POINT", "")
        if not wifi_router_name_from_tc in [ None, "", "NONE"]:
            self.configure_wifi_ap(wifi_router_name_from_tc)
        # Get UECmdLayer
        self.__networking_api = device.get_uecmd("Networking", True)
Exemple #3
0
    def __init__(self, execution_temp, simulator_name="TEMPERATURE_CHAMBER1"):
        """
        describe basic parameters to set up temperature chamber
        """
        overmind = OverMind()
        self.__logger = LOGGER_TEST_SCRIPT
        self.__logger.info(self.__LOG_TAG + "INIT")
        device = overmind.get_instance(overmind.DEVICE)
        eq_manager = overmind.get_instance(overmind.EQUIPMENT_MANAGER)
        # DECLARE OPTIONAL GLOBAL PARAMETER HERE
        self.__tct = execution_temp
        # get temperature chamber & init var
        self.__logger.info(self.__LOG_TAG +
                           "Used of temperature chamber requested")
        self.__temperature_chamber = eq_manager.get_temperature_chamber(
            simulator_name)
        # Set thermal test to DEFAULT else it will be SPECIFIC to your test
        self.__thermal_test = "DEFAULT"

        self.__chamber_tag = EMConstant.CHAMBER_TAG
        if self.__temperature_chamber is not None:
            self.__chamber_tag = self.__chamber_tag + "_" + \
                self.__temperature_chamber.get_measurement_unit()

        em_params = device.get_em_parameters()

        self.__low_charging_lim = em_params["BATTERY"][
            "THERMAL_CHARGING_LOW_LIMIT"]
        self.__high_charging_lim = em_params["BATTERY"][
            "THERMAL_CHARGING_HIGH_LIMIT"]
        self.__ambient_temperature = 25
    def __init__(self, mode=None):
        """
        parameter to initialize this module.
        currently consider that you cant have video and music playing at the same time
        that why testcase parameters for both are the same.

        :type mode: str
        :param mode: choose the mode to use with this module, 'audio' or 'video'
        """
        # DECLARE OPTIONAL GLOBAL PARAMETER HERE
        overmind = OverMind()
        self.__logger = LOGGER_TEST_SCRIPT
        self.__logger.info(self.__LOG_TAG + "INIT")
        self.__device = overmind.get_instance(overmind.DEVICE)
        tc_parameters = overmind.get_instance(overmind.TC_PARAMETERS)

        #-----------------------------------------------------------------------
        # Audio and video
        self.__multimedia_file = tc_parameters.get_param_value("MULTIMEDIA_FILE")
        self.__volume = tc_parameters.get_param_value("VOLUME", 100, default_cast_type=int)

        if self.__multimedia_file is not None:
            self.__multimedia_file = self.__device.multimedia_path + self.__multimedia_file

        # get multimedia uecmd
        self.multimedia_api = None
        if mode is not None:
            self.multimedia_api = self.__device.get_uecmd(str(mode).capitalize(), True)
        self.__system_api = self.__device.get_uecmd("System", True)
        self.__phonesystem_api = self.__device.get_uecmd("PhoneSystem", True)
    def __init__(self):
        """
        parameter to initialize this module.
        currently consider that you cant have video and music playing at the same time
        that why testcase parameters for both are the same.
        """
        # DECLARE OPTIONAL GLOBAL PARAMETER HERE
        overmind = OverMind()
        self.__logger = LOGGER_TEST_SCRIPT
        self.__logger.info(self.__LOG_TAG + "INIT")
        self.__device = overmind.get_instance(overmind.DEVICE)
        bench_config = overmind.get_instance(overmind.BENCH_CONFIG)
        tc_parameters = overmind.get_instance(overmind.TC_PARAMETERS)

        #-----------------------------------------------------------------------
        self.__bk_test_name = tc_parameters.get_param_value(
            "BENCHMARK_TEST_NAME", default_cast_type=str)
        # you have the choice to base the test on a number of iteration
        self.__bk_run_number = tc_parameters.get_param_value(
            "BENCHMARK_NB_OF_RUN", 1, default_cast_type=int)
        self.__bk_duration_for_one_exec = tc_parameters.get_param_value(
            "BENCHMARK_DURATION_OF_ONE_EXEC", default_cast_type=int)
        # or a duration
        bk_duration = tc_parameters.get_param_value("BENCHMARK_DURATION",
                                                    None,
                                                    default_cast_type=int)

        if bk_duration in [None, ""]:
            self.__bk_iteration_mode = True
            self.__bk_whole_duration = self.__bk_duration_for_one_exec * self.__bk_run_number
        else:
            self.__bk_iteration_mode = False
            self.__bk_run_number = 100
            self.__bk_whole_duration = bk_duration
        # custom option
        self.__bk_min_wait_time = tc_parameters.get_param_value(
            "BENCHMARK_MIN_WAIT_TIME", default_cast_type=int)
        self.__bk_max_wait_time = tc_parameters.get_param_value(
            "BENCHMARK_MAX_WAIT_TIME", default_cast_type=int)
        self.__bk_custom_op = tc_parameters.get_param_value(
            "BENCHMARK_CUSTOM_OPTION", "")

        if bench_config.has_parameter("DROIDBOT"):
            droid_bot_conf = bench_config.get_parameters("DROIDBOT")
            self.__installation_folder = droid_bot_conf.get_param_value(
                "InstallationFolder", "/data/local/tmp/com.intel.droidbot/")
        else:
            self.__installation_folder = "/data/local/tmp/com.intel.droidbot/"

        self.__core_lib_path = self.__installation_folder + "droidbot-emcorelib.jar"
        self.__pnp_test_path = self.__installation_folder + "droidbot-emtests.jar"
        self.__file_api = self.__device.get_uecmd("File", True)
Exemple #6
0
    def __init__(self):
        """
        parameter to initialize this module.
        Different way to capture the video should be added in a generic way.
        :type mode: str
        """
        overmind = OverMind()
        self.__logger = LOGGER_TEST_SCRIPT
        self.__logger.info(self.__LOG_TAG + "INIT")
        device = overmind.get_instance(overmind.DEVICE)
        tc_parameters = overmind.get_instance(overmind.TC_PARAMETERS)

        #-----------------------------------------------------------------------
        # Get TC Parameters
        self.__camera_name = tc_parameters.get_param_value("CAMERA_NAME")
        self.__quality = tc_parameters.get_param_value("QUALITY", None)

        # Get UECmdLayer
        self.__video_record_api = device.get_uecmd("VideoRecorder", True)
        # var
        self.file_path = None
Exemple #7
0
    def __init__(self, simulator_name="NETWORK_SIMULATOR1"):
        """
        describe basic parameters to set up simulator in order to register to a network and do a circuit call.
        only support 1 equipment setting for now
        """
        #-----------------------------------------------------------------------
        overmind = OverMind()
        self.__logger = LOGGER_TEST_SCRIPT
        self.__logger.info(self.__LOG_TAG + "INIT")
        device = overmind.get_instance(overmind.DEVICE)
        tc_params = overmind.get_instance(overmind.TC_PARAMETERS)
        bench_config = overmind.get_instance(overmind.BENCH_CONFIG)
        dut_config = overmind.get_instance(overmind.DUT_CONFIGURATION)
        eq_manager = overmind.get_instance(overmind.EQUIPMENT_MANAGER)

        network = bench_config.get_parameters("CELLULAR_NETWORK")
        self.__apn = network.get_param_value("APN")
        self.__ssid = network.get_param_value("SSID")

        # band selection
        self.__cell_band = tc_params.get_param_value("CELL_BAND")
        # cell service like WCDMA
        self.__cell_service = tc_params.get_param_value("CELL_SERVICE")
        # Read TCH_ARFCN from test case xml file
        self.__ul_uarfcn = tc_params.get_param_value("UL_UARFCN",
                                                     default_cast_type=int)
        # cell power ,higher value mean better registration
        self.__cell_power = tc_params.get_param_value("CELL_POWER",
                                                      default_cast_type=int)
        # who do the call ? simulator or phone
        self.__call_origin = tc_params.get_param_value("CALL_ORIGIN", "PHONE")
        # number to call
        self.__phone_number = tc_params.get_param_value(
            "PHONE_NUMBER", "OOOO12121121")
        # codec for voicecall
        self.__voice_coder_rate = tc_params.get_param_value("VOICE_CODER_RATE")
        # registration timeout from device catalog
        self.__registration_timeout = int(
            dut_config.get("registrationTimeout"))

        # Create cellular network simulator and retrieve 3G voice call and data interfaces
        self.__ns = eq_manager.get_cellular_network_simulator(simulator_name)
        self.__ns_cell_3g = self.__ns.get_cell_3g()
        self.__ns_voice_call_3g = self.__ns_cell_3g.get_voice_call()
        self.__ns_data_3g = self.__ns_cell_3g.get_data()

        self.__voicecall_api = device.get_uecmd("VoiceCall", True)
        self.__modem_api = device.get_uecmd("Modem", True)
        self.__networking_api = device.get_uecmd("Networking", True)

        # persistent tag avoid doing some persistent operation during b2b
        self.__eq_setup_done = False
        self.__board_setup_done = False
Exemple #8
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call UseCase base Init function
        UseCaseBase.__init__(self, tc_name, global_config)
        self._overmind = None
        # init em stamp
        self.em_stamp = self._name
        self._uc_id_logged = False
        # override IO CARD with a not None type but not implemented type
        if self._io_card is None:
            self._io_card = IIOCard()

        # get em parameter from device catalog here
        self.phone_info = self._device.get_em_parameters()
        # feed the overmind
        self._overmind = OverMind()
        self._overmind.init(device=self._device,
                            tc_parameters=self._tc_parameters,
                            equipment_manager=self._em,
                            bench_config=global_config.benchConfig,
                            dut_config=self._dut_config)

        # Get uecmd api
        self.em_api = self._device.get_uecmd("EnergyManagement")
        self.phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self.modem_api = self._device.get_uecmd("Modem")
        self.voicecall_api = self._device.get_uecmd("VoiceCall")
        self.networking_api = self._device.get_uecmd("Networking")
        self.bt_api = self._device.get_uecmd("LocalConnectivity")

        # init temperature chamber
        self._tct = self._tc_parameters.get_param_value("TCT",
                                                        default_cast_type=int)
        if self._tct is not None:
            self.tc_module = ThermalChamberModule(self._tct)
        else:
            self.tc_module = None

        # Each raw measurement data & xml files are
        # stored in a folder bearing the name
        # of the TC + a time stamp
        directory_name = self._name + "_" + time.strftime("%Y-%m-%d_%Hh%M.%S")
        report_tree = global_config.campaignConfig.get("campaignReportTree")
        self._saving_directory = report_tree.create_subfolder(directory_name)
        campaign_pass_rate = float(
            global_config.campaignConfig.get("targetB2bPassRate"))
        # resume file
        self._campaign_folder = report_tree.get_report_path()
        # verdict file
        self._em_meas_verdict = EMUtil.EMMeasurement(self._saving_directory,
                                                     campaign_pass_rate)

        # Call ConfigsParser to parse Energy_Management
        external_target_path = self._device.get_config("EMExternalTarget")
        if external_target_path is not None and os.path.exists(
                external_target_path):
            # Call ConfigsParser to parse Energy_Management
            self._logger.info("[EM BASE] External EM target file found : %s" %
                              external_target_path)
            self._target_file = ConfigsParser(external_target_path,
                                              config_folder="")
        else:
            # If no external target file , parse default one
            self._logger.info(
                "[EM BASE] No external target file found, use default EM target file"
            )
            self._target_file = ConfigsParser("Energy_Management")

        # Enable ACS secondary reports
        self._secondary_report = SecondaryTestReport(
            self._device.get_report_tree().get_report_path())

        # init variables
        # var for robustness
        self.start_time = time.time()
        self.__phone_date = ""
        self._ambient_temperature = 25
        self.phone_as_reboot = False
        self._consecutive_meas_error = 5
        # pylint: disable=W0212
        # Ignore used of protected member, will be change if a getter is created later
        self.pwr_btn_boot = self._device._prss_pwr_btn_time_switch_on
        self.pwr_btn_off = self._device._prss_pw_btn_time_switch_off

        # INIT PARAMETERS HERE
        # param related to usecase
        self._em_cst = EMUtil.EMConstant
        self._em_targets = None
        # add usb sleep for avoiding to lost connection during usb recognition
        self.usb_sleep = self._device._usb_sleep_duration  # pylint: disable=w0212

        # param related to device
        self.vbatt_mos_shutdown = self.phone_info["BATTERY"][
            "VBATT_MOS_SHUTDOWN"] + 0.1
        self.vbatt_mos_boot = self.phone_info["BATTERY"]["VBATT_MOS_BOOT"] + 0.1

        # param that are designed to be updated
        self.batt_capacity = -1
        self.batt_voltage = -1
        # measurement list where we store measurement inside
        self._meas_list = EMUtil.MeasurementList()

        # init core module at the end
        self.em_core_module = None
        bench_type = self._tc_parameters.get_param_value(
            "BENCH_TYPE", self.DEDICATED_BENCH).upper()
        if bench_type == "POWER_SUPPLY_BENCH":
            self.em_core_module = UcPowerSupplyModule(self)
        elif bench_type == "BATTERY_BENCH":
            self.em_core_module = UcBatteryModule(self)
        self._logger.info("Loaded EM TEST_SCRIPT configuration for %s" %
                          self.DEDICATED_BENCH)
        # get the list of TCD to test, it can have several entries
        # if the parameter is missing or empty ( meaning None) the old verdict system will be used.
        self.tcd_to_test = self._tc_parameters.get_param_value(
            EMConstant.TC_PARAMETER_TO_CHECK, "")
        if type(self.tcd_to_test) is str:
            self.tcd_to_test = filter(None, self.tcd_to_test.split(";"))
            self.tcd_to_test = map(str.strip, self.tcd_to_test)
Exemple #9
0
class EmUsecaseBase(UseCaseBase):
    """
    Lab Energy Management base class.
    """
    # by default test are set to be run with only normal battery
    DEDICATED_BENCH = "BASIC_BENCH"

    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call UseCase base Init function
        UseCaseBase.__init__(self, tc_name, global_config)
        self._overmind = None
        # init em stamp
        self.em_stamp = self._name
        self._uc_id_logged = False
        # override IO CARD with a not None type but not implemented type
        if self._io_card is None:
            self._io_card = IIOCard()

        # get em parameter from device catalog here
        self.phone_info = self._device.get_em_parameters()
        # feed the overmind
        self._overmind = OverMind()
        self._overmind.init(device=self._device,
                            tc_parameters=self._tc_parameters,
                            equipment_manager=self._em,
                            bench_config=global_config.benchConfig,
                            dut_config=self._dut_config)

        # Get uecmd api
        self.em_api = self._device.get_uecmd("EnergyManagement")
        self.phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self.modem_api = self._device.get_uecmd("Modem")
        self.voicecall_api = self._device.get_uecmd("VoiceCall")
        self.networking_api = self._device.get_uecmd("Networking")
        self.bt_api = self._device.get_uecmd("LocalConnectivity")

        # init temperature chamber
        self._tct = self._tc_parameters.get_param_value("TCT",
                                                        default_cast_type=int)
        if self._tct is not None:
            self.tc_module = ThermalChamberModule(self._tct)
        else:
            self.tc_module = None

        # Each raw measurement data & xml files are
        # stored in a folder bearing the name
        # of the TC + a time stamp
        directory_name = self._name + "_" + time.strftime("%Y-%m-%d_%Hh%M.%S")
        report_tree = global_config.campaignConfig.get("campaignReportTree")
        self._saving_directory = report_tree.create_subfolder(directory_name)
        campaign_pass_rate = float(
            global_config.campaignConfig.get("targetB2bPassRate"))
        # resume file
        self._campaign_folder = report_tree.get_report_path()
        # verdict file
        self._em_meas_verdict = EMUtil.EMMeasurement(self._saving_directory,
                                                     campaign_pass_rate)

        # Call ConfigsParser to parse Energy_Management
        external_target_path = self._device.get_config("EMExternalTarget")
        if external_target_path is not None and os.path.exists(
                external_target_path):
            # Call ConfigsParser to parse Energy_Management
            self._logger.info("[EM BASE] External EM target file found : %s" %
                              external_target_path)
            self._target_file = ConfigsParser(external_target_path,
                                              config_folder="")
        else:
            # If no external target file , parse default one
            self._logger.info(
                "[EM BASE] No external target file found, use default EM target file"
            )
            self._target_file = ConfigsParser("Energy_Management")

        # Enable ACS secondary reports
        self._secondary_report = SecondaryTestReport(
            self._device.get_report_tree().get_report_path())

        # init variables
        # var for robustness
        self.start_time = time.time()
        self.__phone_date = ""
        self._ambient_temperature = 25
        self.phone_as_reboot = False
        self._consecutive_meas_error = 5
        # pylint: disable=W0212
        # Ignore used of protected member, will be change if a getter is created later
        self.pwr_btn_boot = self._device._prss_pwr_btn_time_switch_on
        self.pwr_btn_off = self._device._prss_pw_btn_time_switch_off

        # INIT PARAMETERS HERE
        # param related to usecase
        self._em_cst = EMUtil.EMConstant
        self._em_targets = None
        # add usb sleep for avoiding to lost connection during usb recognition
        self.usb_sleep = self._device._usb_sleep_duration  # pylint: disable=w0212

        # param related to device
        self.vbatt_mos_shutdown = self.phone_info["BATTERY"][
            "VBATT_MOS_SHUTDOWN"] + 0.1
        self.vbatt_mos_boot = self.phone_info["BATTERY"]["VBATT_MOS_BOOT"] + 0.1

        # param that are designed to be updated
        self.batt_capacity = -1
        self.batt_voltage = -1
        # measurement list where we store measurement inside
        self._meas_list = EMUtil.MeasurementList()

        # init core module at the end
        self.em_core_module = None
        bench_type = self._tc_parameters.get_param_value(
            "BENCH_TYPE", self.DEDICATED_BENCH).upper()
        if bench_type == "POWER_SUPPLY_BENCH":
            self.em_core_module = UcPowerSupplyModule(self)
        elif bench_type == "BATTERY_BENCH":
            self.em_core_module = UcBatteryModule(self)
        self._logger.info("Loaded EM TEST_SCRIPT configuration for %s" %
                          self.DEDICATED_BENCH)
        # get the list of TCD to test, it can have several entries
        # if the parameter is missing or empty ( meaning None) the old verdict system will be used.
        self.tcd_to_test = self._tc_parameters.get_param_value(
            EMConstant.TC_PARAMETER_TO_CHECK, "")
        if type(self.tcd_to_test) is str:
            self.tcd_to_test = filter(None, self.tcd_to_test.split(";"))
            self.tcd_to_test = map(str.strip, self.tcd_to_test)

#------------------------------------------------------------------------------

    def get_application_logs(self):
        """
        get the log from the board, zip it and store it on usecase result.
        """
        pulled_files = []
        directory = os.path.join(
            self._saving_directory,
            "aplogs_" + time.strftime("%Y-%m-%d_%Hh%M.%S"))
        # create the destination directory
        if not os.path.exists(directory):
            os.mkdir(directory)

        # try to pull application log from tag
        if self._uc_id_logged:
            pulled_files = self._device.get_application_logs(
                directory, self.em_stamp)

        # if fail to pull file for any reason then pull all file
        if pulled_files is None or len(pulled_files) == 0:
            # if tag not found pull all logs
            pulled_files = self._device.get_application_logs(directory)

        # zip only if there is file to zip
        if pulled_files is not None and len(pulled_files) > 0:
            archive_util.make_archive(directory, "zip", root_dir=directory)
            time.sleep(1)
            shutil.rmtree(directory, ignore_errors=True)
            if os.path.isdir(directory):
                self._logger.warning("fail do delete tempdir %s" % directory)

#------------------------------------------------------------------------------

    def get_time_tuple(self):
        """
        return a tuple for logging time in xml measurement.
        Time will be evaluate in hours.

        :rtype: tuple
        :return: (str name, float value, str unit)
        """
        result = (self._em_cst.TIME_TAG,
                  (time.time() - self.start_time) / 3600, self._em_cst.HR)
        return result

#------------------------------------------------------------------------------

    def get_time_from_board(self):
        """
        get the time from the board itself.

        :rtype: int
        :return: time taken from the board in seconds
        """
        result = self.phonesystem_api.get_date()
        time_tuple = time.strptime(result, "%Y %m-%d %H:%M:%S")
        return int(time.mktime(time_tuple))

#------------------------------------------------------------------------------

    def update_battery_info(self):
        """
        launch command to get battery info , return them as dict
        also update protected var that target voltage & capacity

        :rtype: dict
        :return: uevent charger & battery info
        """
        result = self.em_api.get_msic_registers()
        self.batt_capacity = result["BATTERY"]["CAPACITY"][0]
        self.batt_voltage = result["BATTERY"]["VOLTAGE"][0]
        return result

#------------------------------------------------------------------------------

    def is_board_and_acs_ok(self):
        """
        check if board is alive and ACS connected

        :rtype: bool
        :return: True if all is ok to communicate with board, False otherwise
        """
        result = False
        if self._device.get_boot_mode() == "MOS" and self._device.is_available(
        ):
            result = True

        return result

    def has_board_reboot(self):
        """
        check if board is alive and has rebooted

        :rtype: bool
        :return: True if board rebooted, False otherwise
        """
        result = False
        if self.phone_as_reboot and self._device.get_state() == "alive":
            result = True

        return result
#------------------------------------------------------------------------------

    def _wait_smart_time(self, origin, time_used_for_schedule_cmd):
        """
        Function used to wait a judicious time and let the read of the msic register to be executed.
        """
        now = time.time()
        safety_timer = 8
        if now < (origin + time_used_for_schedule_cmd + safety_timer):

            time2wait = int((origin + time_used_for_schedule_cmd +
                             safety_timer) - now)

            if time2wait > time_used_for_schedule_cmd + safety_timer:
                # this should never occurs
                self._logger.warning("Timer computing error " +
                                     "(time used for schedule cmd: %d)" %
                                     time_used_for_schedule_cmd)
                time2wait = time_used_for_schedule_cmd + safety_timer

            self._logger.debug(
                "waiting %s second(s) remaining to elapse the %s s timer" %
                (time2wait, time_used_for_schedule_cmd))
            time.sleep(time2wait)

        else:
            self._logger.debug("waiting 0 second(s) to elapse the %s s timer" %
                               time_used_for_schedule_cmd)

#------------------------------------------------------------------------------

    def set_up(self):
        """
        setup is designed to be done only once
        put here settings that persist all along a test like :
         - equipment connection and configuration.
         - turning on feature
        """
        # before all, update and inject EM stamp
        self.em_stamp = self._name + time.strftime("-%Y-%m-%d_%Hh%M.%S")
        self._uc_id_logged = self._device.inject_device_log(
            "i", self._em_cst.EM_INJECT_TAG, self.em_stamp)
        # Call the UseCaseBase Setup function
        UseCaseBase.set_up(self)
        self.em_core_module.set_up()

        # temperature settings
        if self.tc_module is not None and self.tc_module.is_default_test():
            self.tc_module.set_up_eq()
            self.tc_module.adjust_temp_according_to_test_value()
        # one shot measurement
        if self._device.get_state() == "alive":
            # reset reboot var
            self.phone_as_reboot = False
        return Global.SUCCESS, "No errors"

#------------------------------------------------------------------------------

    def run_test(self):
        """
        the heart of your test.
        measurement should be done in this function.
        No test clean should be on it except if it is need by the test steps.
        """
        UseCaseBase.run_test(self)

        # temperature settings
        if self.tc_module is not None and self.tc_module.is_default_test():
            self.tc_module.adjust_temp_according_to_current_value()

        # implementation for B2B continuous
        # Do before_runtest without a try, if it can't be done then the DUT must be KO
        self.run_test_start()
        result = Global.FAILURE
        result_msg = ""
        import traceback
        try:
            result, result_msg = self.run_test_body()
        # the warning is known and left here to remember it
        except Exception as ee:
            _, exc_tb = sys.exc_info()[1:]
            self._logger.error("Error happen in RUN TEST BODY : %s" % str(ee))
            self._logger.error(str(traceback.format_tb(exc_tb)))
            self._logger.error(
                "Trying to execute RUN TEST STOP before finishing test")
            result_msg = str(ee)
        finally:
            # in any case do a cleaning
            try:
                self.run_test_stop()
                # the warning is known and left here to remember it
            except Exception as e:
                _, exc_tb = sys.exc_info()[1:]
                self._logger.error("Exception during RUN TEST BODY: %s" %
                                   str(e))
                self._logger.error(str(traceback.format_tb(exc_tb)))

        return result, result_msg

    def run_test_start(self):
        """
        put here non persistent settings like:
        - feature which need to be set again after a reboot
        - initialization of a boolean
        - establish a call
        """
        # Reset the global result
        self._logger.debug("\tRUN TEST BEGIN")
        self._em_meas_verdict.reset_current_verdict()

    def run_test_body(self):
        """
        the heart of your test.
        measurement should be done in this function.
        No test clean should be on it except if it is need by the test steps.
        """
        self._logger.debug("\tRUN TEST BODY")
        return Global.SUCCESS, "No actions"

    def run_test_stop(self):
        """
        put here temporary cleaning like :
        - emptying folder
        - reboot the board if KO
        - equipment settings necessary to re apply settings on before_runtest
        - verdict computing
        """
        self._logger.debug("\tRUN TEST END")

#------------------------------------------------------------------------------

    def tear_down(self):
        """
        tear down is here to clean your test for next testcase
        put here final cleaning like:
        - equipment release
        - board charging

        """
        # Call the UseCaseBase tear down function
        UseCaseBase.tear_down(self)
        self.em_core_module.tear_down()

        # sink last measurement and reset meas_dict
        self._em_meas_verdict.compare_list(self._meas_list, self._em_targets,
                                           True)
        self._em_meas_verdict.judge()

        # feed awr secondary reports
        result = self._em_meas_verdict.get_local_result_v2()
        self._secondary_report.add_result_from_dict(result, self.get_name(),
                                                    self.tc_order)
        # feed TCR
        LiveReporting.instance().update_running_tc_info(test_info=result)

        if self.tc_module is not None and self.tc_module.is_default_test():
            self.tc_module.release_eq()

        return Global.SUCCESS, "No errors"

    def finalize(self):
        UseCaseBase.finalize(self)
        if self._overmind is not None:
            del self._overmind

        return Global.SUCCESS, "No errors"