Ejemplo n.º 1
0
    def setup_class(self):
        TelephonyBaseTest.setup_class(self)

        self.stress_test_number = int(
            self.user_params.get("stress_test_number", 10))
        self.skip_reset_between_cases = False

        self.dut = self.android_devices[0]
        self.ad_reference = self.android_devices[1] if len(
            self.android_devices) > 1 else None
        self.dut_model = get_model_name(self.dut)
        self.user_params["check_crash"] = False
        self.skip_reset_between_cases = False

        self.dut_subID = get_outgoing_voice_sub_id(self.dut)
        self.dut_capabilities = self.dut.telephony["subscription"][
            self.dut_subID].get("capabilities", [])
        self.dut_wfc_modes = self.dut.telephony["subscription"][
            self.dut_subID].get("wfc_modes", [])
        self.default_testing_func_names = []
        for method in ("_check_volte", "_check_3g"):
            func = getattr(self, method)
            try:
                check_result = func()
            except Exception as e:
                self.dut.log.error("%s failed with %s", method, e)
                check_result = False
            self.dut.log.info("%s is %s before tests start", method,
                              check_result)
            if check_result:
                self.default_testing_func_names.append(method)
        self.dut.log.info("To be tested: %s", self.default_testing_func_names)
Ejemplo n.º 2
0
 def setup_class(self):
     TelephonyBaseTest.setup_class(self)
     self.dut = self.android_devices[0]
     self.number_of_devices = 1
     self.stress_test_number = self.get_stress_test_number()
     self.carrier_configs = dumpsys_carrier_config(self.dut)
     self.dut_subID = get_outgoing_voice_sub_id(self.dut)
     self.dut_capabilities = self.dut.telephony["subscription"][
         self.dut_subID].get("capabilities", [])
    def setup_class(self):
        TelephonyBaseTest.setup_class(self)
        self.user_params["enable_connectivity_metrics"] = False
        self.user_params["telephony_auto_rerun"] = 0
        self.consecutive_failure_limit = 5

        self.dut = self.android_devices[0]
        self.ad_reference = self.android_devices[1]
        self.dut_model = get_model_name(self.dut)
        self.dut_operator = get_operator_name(self.log, self.dut)
        self.dut_subID = get_outgoing_voice_sub_id(self.dut)
        self.dut_capabilities = self.dut.telephony["subscription"][self.dut_subID].get("capabilities", [])
        self.dut_wfc_modes = self.dut.telephony["subscription"][self.dut_subID].get("wfc_modes", [])
        self.ad_reference_subID = get_outgoing_voice_sub_id(self.ad_reference)
        self.reference_capabilities = self.ad_reference.telephony["subscription"][self.ad_reference_subID].get(
            "capabilities", [])
        self.dut.log.info("DUT capabilities: %s", self.dut_capabilities)
        self.skip_reset_between_cases = False
        self.user_params["telephony_auto_rerun"] = 0
        self.number_of_devices = 1
        self.call_drop_override_code = self.user_params.get(
            "call_drop_override_code", 373)
Ejemplo n.º 4
0
    def test_check_carrier_id(self):
        """Verify mobile_data_always_on can be enabled.

        Steps:
        1. Enable mobile_data_always_on by adb.
        2. Verify the mobile data_always_on state.

        Expected Results: mobile_data_always_on return 1.
        """
        result = True
        if self.dut.adb.getprop("ro.build.version.release")[0] in ("8", "O",
                                                                   "7", "N"):
            raise signals.TestSkip("Not supported in this build")
        old_carrier_id = self.dut.droid.telephonyGetSimCarrierId()
        old_carrier_name = self.dut.droid.telephonyGetSimCarrierIdName()
        self.result_detail = "carrier_id = %s, carrier_name = %s" % (
            old_carrier_id, old_carrier_name)
        self.dut.log.info(self.result_detail)
        sub_id = get_outgoing_voice_sub_id(self.dut)
        slot_index = get_slot_index_from_subid(self.log, self.dut, sub_id)

        if self.dut.model in ("angler", "bullhead", "marlin", "sailfish"):
            msg = "Power off SIM slot is not supported"
            self.dut.log.warning("%s, test finished", msg)
            self.result_detail = "%s, %s" % (self.result_detail, msg)
            return result

        if power_off_sim(self.dut, slot_index):
            for i in range(3):
                carrier_id = self.dut.droid.telephonyGetSimCarrierId()
                carrier_name = self.dut.droid.telephonyGetSimCarrierIdName()
                msg = "After SIM power down, carrier_id = %s(expecting -1), " \
                      "carrier_name = %s(expecting None)" % (carrier_id, carrier_name)
                if carrier_id != -1 or carrier_name:
                    if i == 2:
                        self.dut.log.error(msg)
                        self.result_detail = "%s, %s" % (self.result_detail,
                                                         msg)
                        result = False
                    else:
                        time.sleep(5)
                else:
                    self.dut.log.info(msg)
                    break
        else:
            msg = "Power off SIM slot is not working"
            self.dut.log.error(msg)
            result = False
            self.result_detail = "%s, %s" % (self.result_detail, msg)

        if not power_on_sim(self.dut, slot_index):
            self.dut.log.error("Fail to power up SIM")
            result = False
            setattr(self.dut, "reboot_to_recover", True)
        else:
            if is_sim_locked(self.dut):
                self.dut.log.info("Sim is locked")
                carrier_id = self.dut.droid.telephonyGetSimCarrierId()
                carrier_name = self.dut.droid.telephonyGetSimCarrierIdName()
                msg = "In locked SIM, carrier_id = %s(expecting -1), " \
                      "carrier_name = %s(expecting None)" % (carrier_id, carrier_name)
                if carrier_id != -1 or carrier_name:
                    self.dut.log.error(msg)
                    self.result_detail = "%s, %s" % (self.result_detail, msg)
                    result = False
                else:
                    self.dut.log.info(msg)
                unlock_sim(self.dut)
            elif getattr(self.dut, "is_sim_locked", False):
                self.dut.log.error(
                    "After SIM slot power cycle, SIM in not in locked state")
                return False

            if not ensure_phone_subscription(self.log, self.dut):
                self.dut.log.error("Unable to find a valid subscription!")
                result = False
            new_carrier_id = self.dut.droid.telephonyGetSimCarrierId()
            new_carrier_name = self.dut.droid.telephonyGetSimCarrierIdName()
            msg = "After SIM power up, new_carrier_id = %s, " \
                  "new_carrier_name = %s" % (new_carrier_id, new_carrier_name)
            if old_carrier_id != new_carrier_id or (old_carrier_name !=
                                                    new_carrier_name):
                self.dut.log.error(msg)
                self.result_detail = "%s, %s" % (self.result_detail, msg)
                result = False
            else:
                self.dut.log.info(msg)
        return result
Ejemplo n.º 5
0
    def _crash_recovery_test(self, process, *args):
        """Crash Recovery Test

        Arguments:
            process: the process to be killed. For example:
                "rild", "netmgrd", "com.android.phone", "imsqmidaemon",
                "imsdatadaemon", "ims_rtp_daemon",
                "com.android.ims.rcsservice", "system_server", "cnd",
                "modem"

        Expected Results:
            All Features should work as intended post crash recovery

        Returns:
            True is pass, False if fail.
        """
        self.number_of_devices = 2

        try:
            self.dut.droid.logI("======== Trigger %s crash ========" % process)
        except:
            pass
        if process == "modem":
            self.user_params["check_crash"] = False
            self.dut.log.info("======== Crash modem from kernal ========")
            trigger_modem_crash(self.dut)
        elif process == "modem-crash":
            self.user_params["check_crash"] = False
            self.dut.log.info("======== Crash modem from modem ========")
            trigger_modem_crash_by_modem(self.dut)
        elif process == "sim":
            self.dut.log.info("======== Power cycle SIM slot ========")
            self.user_params["check_crash"] = True
            sub_id = get_outgoing_voice_sub_id(self.dut)
            slot_index = get_slot_index_from_subid(self.log, self.dut, sub_id)
            if not power_off_sim(self.dut, slot_index):
                self.dut.log.warning("Fail to power off SIM")
                raise signals.TestSkip("Power cycle SIM not working")
            if not power_on_sim(self.dut, slot_index):
                self.dut.log.error("Fail to power on SIM slot")
                setattr(self.dut, "reboot_to_recover", True)
                return False
        else:
            if process == "rild":
                if int(self.dut.adb.getprop(
                        "ro.product.first_api_level")) >= 28:
                    process = "qcrild"
            self.dut.log.info("======== Killing process <%s> ========",
                              process)
            process_pid = self.dut.adb.shell("pidof %s" % process)
            self.dut.log.info("Pid of %s is %s", process, process_pid)
            if not process_pid:
                self.dut.log.error("Process %s not running", process)
                return False
            if process in ("netd", "system_server"):
                self.dut.stop_services()
            self.dut.adb.shell("kill -9 %s" % process_pid, ignore_status=True)
            self.dut.log.info("Wait %s sec for process %s come up.",
                              WAIT_TIME_AFTER_CRASH, process)
            time.sleep(WAIT_TIME_AFTER_CRASH)
            if process in ("netd", "system_server"):
                self.dut.ensure_screen_on()
                try:
                    self.dut.start_services()
                except Exception as e:
                    self.dut.log.warning(e)
            process_pid_new = self.dut.adb.shell("pidof %s" % process)
            if process_pid == process_pid_new:
                self.dut.log.error(
                    "Process %s has the same pid: old:%s new:%s", process,
                    process_pid, process_pid_new)
        try:
            self.dut.droid.logI(
                "======== Start testing after triggering %s crash ========" %
                process)
        except Exception:
            self.dut.ensure_screen_on()
            self.dut.start_services()
            if is_sim_locked(self.dut):
                unlock_sim(self.dut)

        if process == "ims_rtp_daemon":
            if not self._check_wfc_enabled:
                failed_tests = ["_check_wfc_enabled"]
            else:
                failed_tests = []
        else:
            failed_tests = []

        begin_time = get_current_epoch_time()
        failed_tests.extend(self.feature_validator(*args))
        crash_report = self.dut.check_crash_report(self.test_name,
                                                   begin_time,
                                                   log_crash_report=True)
        if failed_tests or crash_report:
            if failed_tests:
                self.dut.log.error("%s failed after %s restart", failed_tests,
                                   process)
                setattr(self.dut, "reboot_to_recover", True)
            if crash_report:
                self.dut.log.error("Crash %s found after %s restart",
                                   crash_report, process)
            return False
        else:
            return True