def call_drop_test_after_wipe(self, setup=None):
     if setup:
         setup_func = getattr(self, "setup_%s" % setup)
         if not setup_func(): return False
     fastboot_wipe(self.dut)
     bring_up_connectivity_monitor(self.dut)
     return self.forced_call_drop_test(setup=setup)
Esempio n. 2
0
    def _fdr_stress_test(self, *args):
        """Fdr Reliability Test

        Arguments:
            function_name: function to be checked

        Expected Results:
            No crash happens in stress test.

        Returns:
            True is pass, False if fail.
        """
        self.number_of_devices = 2
        fail_count = collections.defaultdict(int)
        test_result = True

        for i in range(1, self.stress_test_number + 1):
            begin_time = get_current_epoch_time()
            test_name = "%s_iteration_%s" % (self.test_name, i)
            log_msg = "[Test Case] %s" % test_name
            self.log.info("%s begin", log_msg)
            self.dut.droid.logI("%s begin" % log_msg)
            test_msg = "FDR Stress Test %s Iteration <%s> / <%s>" % (
                self.test_name, i, self.stress_test_number)
            self.log.info(test_msg)
            fastboot_wipe(self.dut)
            self.log.info("%s wait %s secs for radio up.", self.dut.serial,
                          WAIT_TIME_AFTER_FDR)
            time.sleep(WAIT_TIME_AFTER_FDR)
            failed_tests = self.feature_validator(*args)
            for test in failed_tests:
                fail_count[test] += 1

            crash_report = self.dut.check_crash_report("%s_%s" %
                                                       (self.test_name, i),
                                                       begin_time,
                                                       log_crash_report=True)
            if crash_report:
                fail_count["crashes"] += 1
            if failed_tests or crash_report:
                self.log.error("%s FAIL with %s and crashes %s", test_msg,
                               failed_tests, crash_report)
                self._take_bug_report(test_name, begin_time)
            else:
                self.log.info("%s PASS", test_msg)
            self.log.info("Total failure count: %s", dict(fail_count))
            self.log.info("%s end", log_msg)
            self.dut.droid.logI("%s end" % log_msg)

        for failure, count in fail_count.items():
            if count:
                self.log.error("%s failure count = %s in total %s iterations",
                               failure, count, self.stress_test_number)
                test_result = False
        return test_result
    def test_factory_reset_by_fastboot_wipe(self):
        """Verify the network setting after factory reset by wipe.

        Steps:
        1. Config VoLTE, WFC, APM, data_roamingn, mobile_data,
           preferred_network_mode to non-factory default.
        2. Factory reset by fastboot wipe.
        3. Verify network configs back to factory default.

        """
        self.dut.log.info("Set VoLTE off, WFC wifi preferred, APM on")
        toggle_volte(self.log, self.dut, False)
        revert_default_telephony_setting(self.dut)
        self.change_ims_setting(True, True, False, True,
                                WFC_MODE_WIFI_PREFERRED)
        self.dut.log.info("Wipe in fastboot")
        fastboot_wipe(self.dut)
        return verify_default_telephony_setting(
            self.dut) and (self.verify_default_ims_setting())
    def test_usb_tethering_after_wipe(self):
        """Enable usb tethering after wipe.

        Steps:
        1. Enable usb tethering.
        2. Wipe device.
        3. Wake up device and unlock screen.
        4. Enable usb tethering.
        5. Run ping test through usb tethering interface.
        """
        self.enable_usb_tethering()
        tutils.fastboot_wipe(self.dut)
        time.sleep(DEFAULT_SETTLE_TIME)
        # Skip setup wizard after wipe.
        self.dut.adb.shell('am start -a com.android.setupwizard.EXIT',
                           ignore_status=True)
        self.dut.droid.setMobileDataEnabled()
        self.dut.droid.wakeUpNow()
        self.dut.unlock_screen()
        self.enable_usb_tethering()
        self.can_ping_through_usb_interface()
Esempio n. 5
0
    def test_fake_emergency_call_in_setupwizard_no_sim(self):
        """Test emergency call with emergency dialer in setupwizard.

        Wipe the device and then reboot upto setupwizard.
        Add storyline number to system emergency number list.
        Use the emergency dialer to call storyline.
        Verify DUT has in call activity.

        Returns:
            True if success.
            False if failed.
        """
        if not fastboot_wipe(self.dut, skip_setup_wizard=False):
            return False
        return self.fake_emergency_call_test()
    def test_fake_emergency_call_in_setupwizard_ecbm(self):
        """Test emergency call with emergency dialer in setupwizard.

        Wipe the device and then reboot upto setupwizard.
        Add system emergency number list with fake emergency number.
        Configure allow_non_emergency_calls_in_ecm_bool true.
        Call fake emergency number and hung up before connected.
        Verify DUT call and data activity in ecbm mode.

        Returns:
            True if success.
            False if failed.
        """
        if not fastboot_wipe(self.dut, skip_setup_wizard=False):
            return False
        if not wait_for_sim_ready_by_adb(self.log, self.dut):
            self.dut.log.error("SIM is not ready")
            return False
        return self.check_emergency_call_back_mode()
    def test_fake_emergency_call_in_setupwizard(self):
        """Test emergency call with emergency dialer in setupwizard.

        Wipe the device and then reboot upto setupwizard.
        Add system emergency number list with fake emergency number.
        Use the emergency dialer to call fake emergency number.
        Verify DUT has in call activity.
        Bring DUT to normal state and make regular call.

        Returns:
            True if success.
            False if failed.
        """
        if not fastboot_wipe(self.dut, skip_setup_wizard=False):
            return False
        if not wait_for_sim_ready_by_adb(self.log, self.dut):
            self.dut.log.error("SIM is not ready")
            return False
        return self.fake_emergency_call_test() and self.check_normal_call()
    def test_carrier_config_version_after_fdr(self):
        """Carrier Config Version Test after FDR

        1. Disable Verity, remount, push carriersettings apk
        2. WiFi is connected
        3. Perform FDR, and re-connect WiFi
        4. Wait for 45 mins and keep checking for version match

        """
        try:
            cc_version_mapping = {
                'vzw': VZW_CARRIER_CONFIG_VERSION,
                'Verizon': VZW_CARRIER_CONFIG_VERSION,
                'att': ATT_CARRIER_CONFIG_VERSION,
            }
            result_flag = False
            time_var = 1
            ad = self.android_devices[0]
            skip_setup_wizard = True

            # CarrierSettingsApk
            carriersettingsapk = self.user_params["carriersettingsapk"]
            if isinstance(carriersettingsapk, list):
                carriersettingsapk = carriersettingsapk[0]
            ad.log.info("Using file path %s", carriersettingsapk)

            if not ensure_wifi_connected(self.log, ad, self.wifi_network_ssid,
                                         self.wifi_network_pass):
                ad.log.error("connect WiFi failed")
                return False

            # Setup Steps
            adb_disable_verity(ad)
            install_carriersettings_apk(ad, carriersettingsapk)

            # FDR
            ad.log.info("Performing FDR")
            fastboot_wipe(ad)
            ad.log.info("FDR Complete")
            if not ensure_wifi_connected(self.log, ad, self.wifi_network_ssid,
                                         self.wifi_network_pass):
                ad.log.error("Connect WiFi failed")

            # Wait for 45 mins for CC version upgrade
            while (time_var < WAIT_TIME_FOR_CARRIERCONFIG_CHANGE):
                current_version = get_carrier_config_version(ad)
                if current_version == cc_version_mapping[self.dut_operator]:
                    ad.log.info("Carrier Config Version Match %s in %s mins",
                                current_version, time_var)
                    result_flag = True
                    break
                else:
                    ad.log.debug("Carrier Config Version Not Match")
                time.sleep(60)
                time_var += 1
            if not result_flag:
                ad.log.info("Carrier Config Failed to Update in %s mins",
                            WAIT_TIME_FOR_CARRIERCONFIG_CHANGE)
            return result_flag
        except Exception as e:
            ad.log.error(e)
            return False