def test_update_do_not_ignore_failures_and_failures_occur(self): device = MockAndroidDevice('serial') runner = MockOtaRunner() runner.set_failure(True) ota_updater.ota_runners = {device: runner} with self.assertRaises(ota_runner.OtaError): ota_updater.update(device)
def _ota_upgrade(self, ad): result = True self._set_user_profile_before_ota() config_profile_before = get_user_config_profile(ad) ad.log.info("Before OTA user config is: %s", config_profile_before) try: ota_updater.update(ad) except Exception as e: ad.log.error("OTA upgrade failed with %s", e) raise if is_sim_locked(ad): ad.log.info("After OTA, SIM keeps the locked state") elif getattr(ad, "is_sim_locked", False): ad.log.error("After OTA, SIM loses the locked state") result = False if not unlock_sim(ad): ad.log.error(ad.log, "unable to unlock SIM") if not ad.droid.connectivityCheckAirplaneMode(): if not ensure_phone_subscription(self.log, ad): ad.log.error("Subscription check failed") result = False if config_profile_before.get("WFC Enabled", False): self._check_wfc_enabled(ad) result = False config_profile_after = get_user_config_profile(ad) ad.log.info("After OTA user config is: %s", config_profile_after) if config_profile_before != config_profile_after: ad.log.error("Before: %s, After: %s", config_profile_before, config_profile_after) ad.log.error("User config profile changed after OTA") result = False return result
def setup_class(self): super(WifiTethering2GOpenOTATest, self).setup_class() ota_updater.initialize(self.user_params, self.android_devices) self.hotspot_device = self.android_devices[0] self.tethered_device = self.android_devices[1] req_params = ("wifi_hotspot_open", ) self.unpack_userparams(req_params) # verify hotspot device has lte data and supports tethering nutils.verify_lte_data_and_tethering_supported(self.hotspot_device) # Save a wifi soft ap configuration and verify that it works wutils.save_wifi_soft_ap_config(self.hotspot_device, self.wifi_hotspot_open, WIFI_CONFIG_APBAND_2G) self._verify_wifi_tethering() # Run OTA below, if ota fails then abort all tests. try: ota_updater.update(self.hotspot_device) except Exception as err: raise signals.TestAbortClass( "Failed up apply OTA update. Aborting tests")
def test_update_ignore_failures_and_failures_occur(self): device = MockAndroidDevice('serial') runner = MockOtaRunner() runner.set_failure(True) ota_updater.ota_runners = {device: runner} try: ota_updater.update(device, ignore_update_errors=True) except ota_runner.OtaError: self.fail('OtaError was raised when errors are to be ignored!')
def setup_class(self): super(BtOtaTest, self).setup_class() ota_updater.initialize(self.user_params, self.android_devices) self.dut = self.android_devices[0] self.pre_ota_name = self.dut.droid.bluetoothGetLocalName() self.pre_ota_address = self.dut.droid.bluetoothGetLocalAddress() self.sec_address = self.android_devices[ 1].droid.bluetoothGetLocalAddress() # Pairing devices if not pair_pri_to_sec(self.dut, self.android_devices[1]): raise signals.TestAbortClass( "Failed to bond devices prior to update") #Run OTA below, if ota fails then abort all tests try: ota_updater.update(self.dut) except Exception as err: raise signals.TestAbortClass( "Failed up apply OTA update. Aborting tests")
def setup_class(self): super(WifiAutoUpdateTest, self).setup_class() ota_updater.initialize(self.user_params, self.android_devices) self.dut = self.android_devices[0] wutils.wifi_test_device_init(self.dut) req_params = [] opt_param = [ "open_network", "reference_networks", "iperf_server_address" ] self.unpack_userparams(req_param_names=req_params, opt_param_names=opt_param) if "AccessPoint" in self.user_params: self.legacy_configure_ap_and_start() asserts.assert_true( len(self.reference_networks) > 0, "Need at least two reference network with psk.") asserts.assert_true( len(self.open_network) > 0, "Need at least two open network with psk.") wutils.wifi_toggle_state(self.dut, True) self.wifi_config_list = [] # Disabling WiFi setup before OTA for debugging. # Setup WiFi and add few open and wpa networks before OTA. # self.add_network_and_enable(self.open_network[0]['2g']) # self.add_network_and_enable(self.reference_networks[0]['5g']) # Add few dummy networks to the list. # self.add_and_enable_dummy_networks() # Run OTA below, if ota fails then abort all tests. try: ota_updater.update(self.dut) except Exception as err: raise signals.TestAbortClass( "Failed up apply OTA update. Aborting tests")
def test_my_test(self): self.pre_ota() ota_updater.update(self.dut) self.post_ota()