def setup_class(self): super().setup_class() self.dut = self.android_devices[0] self.dut_client = self.android_devices[1] # Do a simple version of init - mainly just sync the time and enable # verbose logging. This test will fail if the DUT has a sim and cell # data is disabled. We would also like to test with phones in less # constrained states (or add variations where we specifically # constrain). utils.require_sl4a(self.android_devices) for ad in self.android_devices: wutils.wifi_test_device_init(ad) utils.sync_device_time(ad) # Set country code explicitly to "US". wutils.set_wifi_country_code(ad, WifiEnums.CountryCode.US) # Enable verbose logging on the duts. ad.droid.wifiEnableVerboseLogging(1) req_params = [ "dbs_supported_models", "iperf_server_address", "iperf_server_port" ] self.unpack_userparams(req_param_names=req_params, ) asserts.abort_class_if( self.dut.model not in self.dbs_supported_models, "Device %s does not support dual interfaces." % self.dut.model)
def wifi_test_device_init(ad): """Initializes an android device for wifi testing. 0. Make sure SL4A connection is established on the android device. 1. Disable location service's WiFi scan. 2. Turn WiFi on. 3. Clear all saved networks. 4. Set country code to US. 5. Enable WiFi verbose logging. 6. Sync device time with computer time. 7. Turn off cellular data. """ require_sl4a((ad, )) ad.droid.wifiScannerToggleAlwaysAvailable(False) msg = "Failed to turn off location service's scan." assert not ad.droid.wifiScannerIsAlwaysAvailable(), msg msg = "Failed to turn WiFi on %s" % ad.serial assert wifi_toggle_state(ad, True), msg reset_wifi(ad) msg = "Failed to clear configured networks." assert not ad.droid.wifiGetConfiguredNetworks(), msg ad.droid.wifiEnableVerboseLogging(1) msg = "Failed to enable WiFi verbose logging." assert ad.droid.wifiGetVerboseLoggingLevel() == 1, msg ad.droid.wifiScannerToggleAlwaysAvailable(False) # We don't verify the following settings since they are not critical. sync_device_time(ad) ad.droid.telephonyToggleDataConnection(False) # TODO(angli): need to verify the country code was actually set. No generic # way to check right now. ad.adb.shell("halutil -country %s" % WifiEnums.CountryCode.US)
def setup_class(self): """It will setup the required dependencies from config file and configure the devices for softap mode testing. Returns: True if successfully configured the requirements for testing. """ self.dut = self.android_devices[0] self.dut_client = self.android_devices[1] # Do a simple version of init - mainly just sync the time and enable # verbose logging. This test will fail if the DUT has a sim and cell # data is disabled. We would also like to test with phones in less # constrained states (or add variations where we specifically # constrain). utils.require_sl4a((self.dut, self.dut_client)) utils.sync_device_time(self.dut) utils.sync_device_time(self.dut_client) # Enable verbose logging on the duts self.dut.droid.wifiEnableVerboseLogging(1) msg = "Failed to enable WiFi verbose logging on the softap dut." asserts.assert_true(self.dut.droid.wifiGetVerboseLoggingLevel() == 1, msg) self.dut_client.droid.wifiEnableVerboseLogging(1) msg = "Failed to enable WiFi verbose logging on the client dut." asserts.assert_true(self.dut_client.droid.wifiGetVerboseLoggingLevel() == 1, msg)
def setup_class(self): self.dut = self.android_devices[0] self.dut_client = self.android_devices[1] wutils.wifi_test_device_init(self.dut) wutils.wifi_test_device_init(self.dut_client) utils.require_sl4a((self.dut, self.dut_client)) utils.sync_device_time(self.dut) utils.sync_device_time(self.dut_client) # Set country code explicitly to "US". self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US) self.dut_client.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US) # Enable verbose logging on the duts self.dut.droid.wifiEnableVerboseLogging(1) asserts.assert_equal(self.dut.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the softap dut.") self.dut_client.droid.wifiEnableVerboseLogging(1) asserts.assert_equal(self.dut_client.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the client dut.") req_params = [] opt_param = ["iperf_server_address", "reference_networks"] self.unpack_userparams( req_param_names=req_params, opt_param_names=opt_param) if "iperf_server_address" in self.user_params: self.iperf_server = self.iperf_servers[0] if hasattr(self, 'iperf_server'): self.iperf_server.start()
def setup_class(self): super().setup_class() self.dut = self.android_devices[0] self.dut_client = self.android_devices[1] wutils.wifi_test_device_init(self.dut) wutils.wifi_test_device_init(self.dut_client) utils.require_sl4a((self.dut, self.dut_client)) utils.sync_device_time(self.dut) utils.sync_device_time(self.dut_client) # Set country code explicitly to "US". wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US) wutils.set_wifi_country_code(self.dut_client, wutils.WifiEnums.CountryCode.US) # Enable verbose logging on the duts self.dut.droid.wifiEnableVerboseLogging(1) asserts.assert_equal( self.dut.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the softap dut.") self.dut_client.droid.wifiEnableVerboseLogging(1) asserts.assert_equal( self.dut_client.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the client dut.") req_params = [] opt_param = [ "iperf_server_address", "reference_networks", "iperf_server_port" ] self.unpack_userparams(req_param_names=req_params, opt_param_names=opt_param) self.chan_map = { v: k for k, v in hostapd_constants.CHANNEL_MAP.items() } self.pcap_procs = None
def wifi_test_device_init(ad): """Initializes an android device for wifi testing. 0. Make sure SL4A connection is established on the android device. 1. Disable location service's WiFi scan. 2. Turn WiFi on. 3. Clear all saved networks. 4. Set country code to US. 5. Enable WiFi verbose logging. 6. Sync device time with computer time. 7. Turn off cellular data. 8. Turn off ambient display. """ utils.require_sl4a((ad, )) ad.droid.wifiScannerToggleAlwaysAvailable(False) msg = "Failed to turn off location service's scan." asserts.assert_true(not ad.droid.wifiScannerIsAlwaysAvailable(), msg) wifi_toggle_state(ad, True) reset_wifi(ad) ad.droid.wifiEnableVerboseLogging(1) msg = "Failed to enable WiFi verbose logging." asserts.assert_equal(ad.droid.wifiGetVerboseLoggingLevel(), 1, msg) # We don't verify the following settings since they are not critical. # Set wpa_supplicant log level to EXCESSIVE. output = ad.adb.shell("wpa_cli -i wlan0 -p -g@android:wpa_wlan0 IFNAME=" "wlan0 log_level EXCESSIVE") ad.log.info("wpa_supplicant log change status: %s", output) utils.sync_device_time(ad) ad.droid.telephonyToggleDataConnection(False) # TODO(angli): need to verify the country code was actually set. No generic # way to check right now. ad.adb.shell("halutil -country %s" % WifiEnums.CountryCode.US) utils.set_ambient_display(ad, False)
def setup_test(self): # Reset bluetooth reset_bluetooth(self.android_devices) for ad in self.android_devices: if not clear_bonded_devices(ad): logging.error("Failed to unbound device") return False # Sync device time for timestamp comparison sync_device_time(ad) return super(BtMetricsTest, self).setup_test()
def setup_class(self): if not super(BtFunhausBaseTest, self).setup_class(): return False for ad in self.android_devices: sync_device_time(ad) # Disable Bluetooth HCI Snoop Logs for audio tests ad.adb.shell("setprop persist.bluetooth.btsnoopenable false") if not bypass_setup_wizard(ad): self.log.debug( "Failed to bypass setup wizard, continuing test.") # Add music to the Android device return self._add_music_to_android_device(ad)
def setup_class(self): for ad in self.android_devices: sync_device_time(ad) # Disable Bluetooth HCI Snoop Logs for audio tests ad.droid.bluetoothConfigHciSnoopLog(False) if not bypass_setup_wizard(ad): self.log.debug( "Failed to bypass setup wizard, continuing test.") if not "bt_config" in self.user_params.keys(): self.log.error("Missing mandatory user config \"bt_config\"!") return False bt_config_map_file = self.user_params["bt_config"] return self._setup_bt_config(bt_config_map_file)
def setup_class(self): if "reboot_between_test_class" in self.user_params: threads = [] for a in self.android_devices: thread = threading.Thread(target=self._reboot_device, args=([a])) threads.append(thread) thread.start() for t in threads: t.join() for a in self.android_devices: set_location_service(a, False) sync_device_time(a) return setup_multiple_devices_for_bt_test(self.android_devices)
def dut_rockbottom(self): """Set the phone into Rock-bottom state. """ self.dut.log.info('Now set the device to Rockbottom State') utils.require_sl4a((self.dut, )) self.dut.droid.connectivityToggleAirplaneMode(False) time.sleep(2) self.dut.droid.connectivityToggleAirplaneMode(True) time.sleep(2) utils.set_ambient_display(self.dut, False) utils.set_auto_rotate(self.dut, False) utils.set_adaptive_brightness(self.dut, False) utils.sync_device_time(self.dut) utils.set_location_service(self.dut, False) utils.set_mobile_data_always_on(self.dut, False) utils.disable_doze_light(self.dut) utils.disable_doze(self.dut) wutils.reset_wifi(self.dut) wutils.wifi_toggle_state(self.dut, False) try: self.dut.droid.nfcDisable() except acts.controllers.sl4a_lib.rpc_client.Sl4aApiError: self.dut.log.info('NFC is not available') self.dut.droid.setScreenBrightness(0) self.dut.adb.shell(AOD_OFF) self.dut.droid.setScreenTimeout(2200) self.dut.droid.wakeUpNow() self.dut.adb.shell(LIFT) self.dut.adb.shell(DOUBLE_TAP) self.dut.adb.shell(JUMP_TO_CAMERA) self.dut.adb.shell(RAISE_TO_CAMERA) self.dut.adb.shell(FLIP_CAMERA) self.dut.adb.shell(ASSIST_GESTURE) self.dut.adb.shell(ASSIST_GESTURE_ALERT) self.dut.adb.shell(ASSIST_GESTURE_WAKE) self.dut.adb.shell(SCREENON_USB_DISABLE) self.dut.adb.shell(UNLOCK_SCREEN) self.dut.adb.shell(SETTINGS_PAGE) self.dut.adb.shell(SCROLL_BOTTOM) self.dut.adb.shell(MUSIC_IQ_OFF) self.dut.adb.shell(AUTO_TIME_OFF) self.dut.adb.shell(AUTO_TIMEZONE_OFF) self.dut.adb.shell(FORCE_YOUTUBE_STOP) self.dut.adb.shell(FORCE_DIALER_STOP) self.dut.droid.wifiSetCountryCode('US') self.dut.droid.wakeUpNow() self.dut.log.info('Device has been set to Rockbottom state') self.dut.log.info('Screen is ON')
def __init__(self, configs): self.tests = [] if not self.TAG: self.TAG = self.__class__.__name__ # Set all the controller objects and params. for name, value in configs.items(): setattr(self, name, value) self.results = records.TestResult() self.current_test_name = None self.log = tracelogger.TraceLogger(self.log) if 'android_devices' in self.__dict__: for ad in self.android_devices: if ad.droid: utils.set_location_service(ad, False) utils.sync_device_time(ad)
def setup_class(self): if not super(BtFunhausBaseTest, self).setup_class(): return False for ad in self.android_devices: sync_device_time(ad) # Disable Bluetooth HCI Snoop Logs for audio tests ad.adb.shell("setprop persist.bluetooth.btsnoopenable false") if not bypass_setup_wizard(ad): self.log.debug( "Failed to bypass setup wizard, continuing test.") if not "bt_config" in self.user_params.keys(): self.log.error("Missing mandatory user config \"bt_config\"!") return False bt_config_map_file = self.user_params["bt_config"] return self._setup_bt_config(bt_config_map_file)
def test_multipath_preference_data_download(self): """ Verify multipath preference when large file is downloaded Steps: 1. DUT has WiFi and LTE data 2. WiFi is active network 3. Download large file over cell network 4. Verify multipath preference on cell network is 0 """ # set vars ad = self.android_devices[1] self.dut = ad self._clear_netstats(ad) utils.sync_device_time(ad) self.tcpdump_pid = nutils.start_tcpdump(ad, self.test_name) cell_network = ad.droid.connectivityGetActiveNetwork() self.log.info("cell network %s" % cell_network) wutils.wifi_connect(ad, self.wifi_network) wifi_network = ad.droid.connectivityGetActiveNetwork() self.log.info("wifi network %s" % wifi_network) # verify multipath preference for wifi and cell networks self._verify_multipath_preferences(ad, RELIABLE, RELIABLE, wifi_network, cell_network) # download file with cell network ad.droid.connectivityNetworkOpenConnection(cell_network, self.download_file) file_folder, file_name = _generate_file_directory_and_file_name( self.download_file, DOWNLOAD_PATH) file_path = os.path.join(file_folder, file_name) self.log.info("File path: %s" % file_path) if _check_file_existance(ad, file_path): self.log.info("File exists. Removing file %s" % file_name) ad.adb.shell("rm -rf %s%s" % (DOWNLOAD_PATH, file_name)) # verify multipath preference values curr_time = time.time() while time.time() < curr_time + TIMEOUT: try: self._verify_multipath_preferences(ad, RELIABLE, NONE, wifi_network, cell_network) return True except signals.TestFailure as e: self.log.debug("%s" % e) time.sleep(1) return False
def test_multipath_preference_low_data_limit(self): """ Verify multipath preference when mobile data limit is low Steps: 1. DUT has WiFi and LTE data 2. Set mobile data usage limit to low value 3. Verify that multipath preference is 0 for cell network """ # set vars ad = self.android_devices[0] self.dut = ad self._clear_netstats(ad) utils.sync_device_time(ad) self.tcpdump_pid = nutils.start_tcpdump(ad, self.test_name) sub_id = str(ad.droid.telephonyGetSubscriberId()) cell_network = ad.droid.connectivityGetActiveNetwork() self.log.info("cell network %s" % cell_network) wutils.wifi_connect(ad, self.wifi_network) wifi_network = ad.droid.connectivityGetActiveNetwork() self.log.info("wifi network %s" % wifi_network) # verify mulipath preference values self._verify_multipath_preferences(ad, RELIABLE, RELIABLE, wifi_network, cell_network) # set low data limit on mobile data total_pre = self._get_total_data_usage_for_device(ad, 0, sub_id) self.log.info("Setting data usage limit to %sMB" % (total_pre + 5)) ad.droid.connectivitySetDataUsageLimit( sub_id, int((total_pre + 5) * 1000.0 * 1000.0)) self.log.info("Setting data warning limit to %sMB" % (total_pre + 5)) ad.droid.connectivitySetDataWarningLimit( sub_id, int((total_pre + 5) * 1000.0 * 1000.0)) # verify multipath preference values curr_time = time.time() while time.time() < curr_time + TIMEOUT: try: self._verify_multipath_preferences(ad, RELIABLE, NONE, wifi_network, cell_network) return True except signals.TestFailure as e: self.log.debug("%s" % e) time.sleep(1) return False
def setup_class(self): # Not to call Base class setup_class() # since it removes the bonded devices for ad in self.android_devices: sync_device_time(ad) self.ad = self.android_devices[0] self.mon = self.monsoons[0] self.mon.set_voltage(self.MONSOON_OUTPUT_VOLTAGE) self.mon.set_max_current(self.MONSOON_MAX_CURRENT) # Monsoon phone self.mon.attach_device(self.ad) self.monsoon_log_path = os.path.join(self.log_path, "MonsoonLog") create_dir(self.monsoon_log_path) asserts.assert_true(self.mon.usb("auto"), "Failed to turn USB mode to auto on monsoon.") asserts.assert_true( force_airplane_mode(self.ad, True), "Can not turn on airplane mode on: %s" % self.ad.serial) asserts.assert_true(bluetooth_enabled_check(self.ad), "Failed to set Bluetooth state to enabled") set_location_service(self.ad, False) set_adaptive_brightness(self.ad, False) set_ambient_display(self.ad, False) self.ad.adb.shell("settings put system screen_brightness 0") set_auto_rotate(self.ad, False) set_phone_screen_on(self.log, self.ad, self.SCREEN_TIME_OFF) wutils.wifi_toggle_state(self.ad, False) # Start PMC app. self.log.info("Start PMC app...") self.ad.adb.shell(self.START_PMC_CMD) self.ad.adb.shell(self.PMC_VERBOSE_CMD) self.log.info("Check to see if PMC app started") for _ in range(self.WAIT_TIME): time.sleep(1) try: self.ad.adb.shell('ps -A | grep "S com.android.pmc"') break except adb.AdbError as e: self.log.info("PMC app is NOT started yet")
def setup_class(self): self.dut = self.android_devices[0] self.dut_client = self.android_devices[1] wutils.wifi_test_device_init(self.dut) wutils.wifi_test_device_init(self.dut_client) # Do a simple version of init - mainly just sync the time and enable # verbose logging. This test will fail if the DUT has a sim and cell # data is disabled. We would also like to test with phones in less # constrained states (or add variations where we specifically # constrain). utils.require_sl4a((self.dut, self.dut_client)) utils.sync_device_time(self.dut) utils.sync_device_time(self.dut_client) # Set country code explicitly to "US". self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US) self.dut_client.droid.wifiSetCountryCode( wutils.WifiEnums.CountryCode.US) # Enable verbose logging on the duts self.dut.droid.wifiEnableVerboseLogging(1) asserts.assert_equal( self.dut.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the softap dut.") self.dut_client.droid.wifiEnableVerboseLogging(1) asserts.assert_equal( self.dut_client.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the client dut.") req_params = ["AccessPoint", "dbs_supported_models"] opt_param = ["iperf_server_address"] self.unpack_userparams(req_param_names=req_params, opt_param_names=opt_param) if self.dut.model not in self.dbs_supported_models: asserts.skip(("Device %s does not support dual interfaces.") % self.dut.model) if "iperf_server_address" in self.user_params: self.iperf_server = self.iperf_servers[0] if hasattr(self, 'iperf_server'): self.iperf_server.start() # Set the client wifi state to on before the test begins. wutils.wifi_toggle_state(self.dut_client, True)
def setup_class(self): """ Sets up the required dependencies from the config file and configures the device for WifiService API tests. Returns: True is successfully configured the requirements for testig. """ self.dut = self.android_devices[0] # Do a simple version of init - mainly just sync the time and enable # verbose logging. We would also like to test with phones in less # constrained states (or add variations where we specifically # constrain). utils.require_sl4a((self.dut, )) utils.sync_device_time(self.dut) # Enable verbose logging on the dut self.dut.droid.wifiEnableVerboseLogging(1) if self.dut.droid.wifiGetVerboseLoggingLevel() != 1: raise signals.TestFailure( "Failed to enable WiFi verbose logging on the dut.")
def setup_class(self): for ad in self.android_devices: ad.droid.wakeLockAcquireBright() ad.droid.wakeUpNow() required_params = () optional_params = ("skip_read_factory_mac", "pixel_models", "cnss_diag_file") self.unpack_userparams(required_params, optional_params, skip_read_factory_mac=0) self.dut1 = self.android_devices[0] self.dut2 = self.android_devices[1] if self.skip_read_factory_mac: self.dut1_mac = None self.dut2_mac = None else: self.dut1_mac = self.get_p2p_mac_address(self.dut1) self.dut2_mac = self.get_p2p_mac_address(self.dut2) #init location before init p2p acts.utils.set_location_service(self.dut1, True) acts.utils.set_location_service(self.dut2, True) wutils.wifi_test_device_init(self.dut1) utils.sync_device_time(self.dut1) self.dut1.droid.wifiP2pInitialize() time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME) asserts.assert_true(self.dut1.droid.wifiP2pIsEnabled(), "DUT1's p2p should be initialized but it didn't") self.dut1.name = "Android_" + self.dut1.serial self.dut1.droid.wifiP2pSetDeviceName(self.dut1.name) wutils.wifi_test_device_init(self.dut2) utils.sync_device_time(self.dut2) self.dut2.droid.wifiP2pInitialize() time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME) asserts.assert_true(self.dut2.droid.wifiP2pIsEnabled(), "DUT2's p2p should be initialized but it didn't") self.dut2.name = "Android_" + self.dut2.serial self.dut2.droid.wifiP2pSetDeviceName(self.dut2.name) if len(self.android_devices) > 2: self.dut3 = self.android_devices[2] acts.utils.set_location_service(self.dut3, True) wutils.wifi_test_device_init(self.dut3) utils.sync_device_time(self.dut3) self.dut3.droid.wifiP2pInitialize() time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME) asserts.assert_true( self.dut3.droid.wifiP2pIsEnabled(), "DUT3's p2p should be initialized but it didn't") self.dut3.name = "Android_" + self.dut3.serial self.dut3.droid.wifiP2pSetDeviceName(self.dut3.name) if hasattr(self, "cnss_diag_file"): if isinstance(self.cnss_diag_file, list): self.cnss_diag_file = self.cnss_diag_file[0] if not os.path.isfile(self.cnss_diag_file): self.cnss_diag_file = os.path.join( self.user_params[Config.key_config_path.value], self.cnss_diag_file)
def setup_class(self): """It will setup the required dependencies from config file and configure the devices for softap mode testing. Returns: True if successfully configured the requirements for testing. """ self.dut = self.android_devices[0] self.dut_client = self.android_devices[1] req_params = [] opt_param = ["open_network"] 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() self.open_network = self.open_network[0]["2g"] # Do a simple version of init - mainly just sync the time and enable # verbose logging. This test will fail if the DUT has a sim and cell # data is disabled. We would also like to test with phones in less # constrained states (or add variations where we specifically # constrain). utils.require_sl4a((self.dut, self.dut_client)) utils.sync_device_time(self.dut) utils.sync_device_time(self.dut_client) # Set country code explicitly to "US". self.dut.droid.wifiSetCountryCode(wutils.WifiEnums.CountryCode.US) self.dut_client.droid.wifiSetCountryCode( wutils.WifiEnums.CountryCode.US) # Enable verbose logging on the duts self.dut.droid.wifiEnableVerboseLogging(1) asserts.assert_equal( self.dut.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the softap dut.") self.dut_client.droid.wifiEnableVerboseLogging(1) asserts.assert_equal( self.dut_client.droid.wifiGetVerboseLoggingLevel(), 1, "Failed to enable WiFi verbose logging on the client dut.")
def setup_class(self): self.dut1 = self.android_devices[0] self.dut2 = self.android_devices[1] self.dut1_mac = self.get_p2p_mac_address(self.dut1) self.dut2_mac = self.get_p2p_mac_address(self.dut2) #init location before init p2p acts.utils.set_location_service(self.dut1, True) acts.utils.set_location_service(self.dut2, True) wutils.wifi_test_device_init(self.dut1) utils.sync_device_time(self.dut1) self.dut1.droid.wifiP2pInitialize() time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME) asserts.assert_true(self.dut1.droid.wifiP2pIsEnabled(), "DUT1's p2p should be initialized but it didn't") self.dut1.name = "Android_" + self.dut1.serial self.dut1.droid.wifiP2pSetDeviceName(self.dut1.name) wutils.wifi_test_device_init(self.dut2) utils.sync_device_time(self.dut2) self.dut2.droid.wifiP2pInitialize() time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME) asserts.assert_true(self.dut2.droid.wifiP2pIsEnabled(), "DUT2's p2p should be initialized but it didn't") self.dut2.name = "Android_" + self.dut2.serial self.dut2.droid.wifiP2pSetDeviceName(self.dut2.name) if len(self.android_devices) > 2: self.dut3 = self.android_devices[2] acts.utils.set_location_service(self.dut3, True) wutils.wifi_test_device_init(self.dut3) utils.sync_device_time(self.dut3) self.dut3.droid.wifiP2pInitialize() time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME) asserts.assert_true( self.dut3.droid.wifiP2pIsEnabled(), "DUT3's p2p should be initialized but it didn't") self.dut3.name = "Android_" + self.dut3.serial self.dut3.droid.wifiP2pSetDeviceName(self.dut3.name)
def setup_class(self): for a in self.android_devices: sync_device_time(a) return setup_multiple_devices_for_bt_test(self.android_devices)
def setup_class(self): self.log = logging.getLogger() self.tests = self.get_existing_test_names() # Obtain test parameters from user_params TEST_PARAMS = self.TAG + '_params' self.test_params = self.user_params.get(TEST_PARAMS, {}) if not self.test_params: self.log.warning(TEST_PARAMS + ' was not found in the user ' 'parameters defined in the config file.') # Override user_param values with test parameters self.user_params.update(self.test_params) # Unpack user_params with default values. All the usages of user_params # as self attributes need to be included either as a required parameter # or as a parameter with a default value. req_params = ['custom_files', 'mon_duration'] self.unpack_userparams(req_params, mon_freq=DEFAULT_MONSOON_FREQUENCY, mon_offset=0, bug_report=False, extra_wait=None, iperf_duration=None, pass_fail_tolerance=THRESHOLD_TOLERANCE_DEFAULT, mon_voltage=PHONE_BATTERY_VOLTAGE_DEFAULT) # Setup the must have controllers, phone and monsoon self.dut = self.android_devices[0] self.mon_data_path = os.path.join(self.log_path, 'Monsoon') os.makedirs(self.mon_data_path, exist_ok=True) # Initialize the power monitor object that will be used to measure self.initialize_power_monitor() # Unpack the thresholds file or fail class setup if it can't be found for file in self.custom_files: if 'pass_fail_threshold_' + self.dut.model in file: self.threshold_file = file break else: raise RuntimeError('Required test pass/fail threshold file is ' 'missing') # Unpack the rockbottom script or fail class setup if it can't be found for file in self.custom_files: if 'rockbottom_' + self.dut.model in file: self.rockbottom_script = file break else: raise RuntimeError('Required rockbottom script is missing.') # Unpack optional custom files for file in self.custom_files: if 'attenuator_setting' in file: self.attenuation_file = file elif 'network_config' in file: self.network_file = file if hasattr(self, 'attenuators'): self.num_atten = self.attenuators[0].instrument.num_atten self.atten_level = self.unpack_custom_file(self.attenuation_file) self.threshold = self.unpack_custom_file(self.threshold_file) self.mon_info = self.create_monsoon_info() # Sync device time, timezone and country code utils.require_sl4a((self.dut, )) utils.sync_device_time(self.dut) wutils.set_wifi_country_code(self.dut, 'US') screen_on_img = self.user_params.get('screen_on_img', []) if screen_on_img: img_src = screen_on_img[0] img_dest = '/sdcard/Pictures/' success = self.dut.push_system_file(img_src, img_dest) if success: self.img_name = os.path.basename(img_src)