def take_btsnoop_log(ad, testcase, testname): """Grabs the btsnoop_hci log on a device and stores it in the log directory of the test class. If you want grab the btsnoop_hci log, call this function with android_device objects in on_fail. Bug report takes a relative long time to take, so use this cautiously. Args: ad: The android_device instance to take bugreport on. testcase: Name of the test calss that triggered this snoop log. testname: Name of the test case that triggered this bug report. """ testname = "".join(x for x in testname if x.isalnum()) serial = ad.droid.getBuildSerial() device_model = ad.droid.getBuildModel() device_model = device_model.replace(" ", "") out_name = ','.join((testname, device_model, serial)) snoop_path = ad.log_path + "/BluetoothSnoopLogs" utils.create_dir(snoop_path) cmd = ''.join(("adb -s ", serial, " pull /sdcard/btsnoop_hci.log ", snoop_path + '/' + out_name, ".btsnoop_hci.log")) testcase.log.info( "Test failed, grabbing the bt_snoop logs on {} {}.".format( device_model, serial)) exe_cmd(cmd)
def start_tcpdump_gce_server(ad, test_name, dest_port, gce): """ Start tcpdump on gce server Args: ad: android device object test_name: test case name dest_port: port to collect tcpdump gce: dictionary of gce instance Returns: process id and pcap file path from gce server """ ad.log.info("Starting tcpdump on gce server") # pcap file name fname = "/tmp/%s_%s_%s_%s" % \ (test_name, ad.model, ad.serial, time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime(time.time()))) # start tcpdump tcpdump_cmd = "sudo bash -c \'tcpdump -i %s -w %s.pcap port %s > \ %s.txt 2>&1 & echo $!\'" % (gce["interface"], fname, dest_port, fname) gcloud_ssh_cmd = "%s --project=%s --zone=%s %s@%s --command " % \ (GCE_SSH, gce["project"], gce["zone"], gce["username"], gce["hostname"]) gce_ssh_cmd = '%s "%s"' % (gcloud_ssh_cmd, tcpdump_cmd) utils.exe_cmd(gce_ssh_cmd) # get process id ps_cmd = '%s "ps aux | grep tcpdump | grep %s"' % (gcloud_ssh_cmd, fname) tcpdump_pid = utils.exe_cmd(ps_cmd).decode("utf-8", "ignore").split() if not tcpdump_pid: raise signals.TestFailure("Failed to start tcpdump on gce server") return tcpdump_pid[1], fname
def __init__(self, config): self.config = config.copy() self.device_id = self.config['device_id'] self.log = logger.create_tagged_trace_logger('OtaChamber|{}'.format( self.device_id)) self.TURNTABLE_FILE_PATH = '/usr/local/bin/fnPerformaxCmd' utils.exe_cmd('sudo {} -d {} -i 0'.format(self.TURNTABLE_FILE_PATH, self.device_id)) self.current_mode = None
def test_modem_power_anomaly_file_existence(self): """Verify if the power anomaly file exists 1. Collect Bugreport 2. unzip bugreport 3. remane the .bin file to .tar 4. unzip dumpstate.tar 5. Verify if the file exists """ ad = self.android_devices[0] cmd = ("am broadcast -a " "com.google.gservices.intent.action.GSERVICES_OVERRIDE " "-e \"ce.cm.power_anomaly_data_enable\" \"true\"") ad.adb.shell(cmd) time.sleep(60) begin_time = get_current_epoch_time() for i in range(3): try: ad.take_bug_report(self.test_name, begin_time) bugreport_path = ad.device_log_path break except Exception as e: ad.log.error("bugreport attempt %s error: %s", i + 1, e) ad.log.info("Bugreport Path is %s" % bugreport_path) try: list_of_files = os.listdir(bugreport_path) ad.log.info(list_of_files) for filename in list_of_files: if ".zip" in filename: ad.log.info(filename) file_path = os.path.join(bugreport_path, filename) ad.log.info(file_path) unzip_maintain_permissions(file_path, bugreport_path) dumpstate_path = os.path.join(bugreport_path, "dumpstate_board.bin") if os.path.isfile(dumpstate_path): os.rename(dumpstate_path, bugreport_path + "/dumpstate_board.tar") os.chmod(bugreport_path + "/dumpstate_board.tar", 0o777) current_dir = os.getcwd() os.chdir(bugreport_path) exe_cmd("tar -xvf %s" % (bugreport_path + "/dumpstate_board.tar")) os.chdir(current_dir) else: ad.log.info("The dumpstate_path file %s does not exist" % dumpstate_path) if os.path.isfile(bugreport_path + "/power_anomaly_data.txt"): ad.log.info("Modem Power Anomaly File Exists!!") return True ad.log.info("Modem Power Anomaly File DO NOT Exist!!") return False except Exception as e: ad.log.error(e) return False
def _collect_bluetooth_manager_dumpsys_logs(self, ads): for ad in ads: serial = ad.serial out_name = "{}_{}".format(serial, "bluetooth_dumpsys.txt") dumpsys_path = ''.join((ad.log_path, "/BluetoothDumpsys")) create_dir(dumpsys_path) cmd = ''.join( ("adb -s ", serial, " shell dumpsys bluetooth_manager > ", dumpsys_path, "/", out_name)) exe_cmd(cmd)
def _collect_bluetooth_manager_dumpsys_logs(self, ads): """ Collect "adb shell dumpsys bluetooth_manager" logs :param ads: list of active Android devices :return: None """ for ad in ads: serial = ad.serial out_name = "{}_{}".format(serial, "bluetooth_dumpsys.txt") dumpsys_path = ''.join((ad.log_path, "/BluetoothDumpsys")) os.makedirs(dumpsys_path, exist_ok=True) cmd = ''.join( ("adb -s ", serial, " shell dumpsys bluetooth_manager > ", dumpsys_path, "/", out_name)) exe_cmd(cmd)
def convert_pem_key_to_pkcs8(in_file, out_file): """Converts the key file generated by us to the format required by Android using openssl. The input file must have the extension "pem". The output file must have the extension "der". Args: in_file: The original key file. out_file: The full path to the converted key file, including filename. """ cmd = ("openssl pkcs8 -inform PEM -in {} -outform DER -out {} -nocrypt" " -topk8").format(in_file, out_file) exe_cmd(cmd)
def convert_pem_key_to_pkcs8(in_file, out_file): """Converts the key file generated by us to the format required by Android using openssl. The input file must have the extension "pem". The output file must have the extension "der". Args: in_file: The original key file. out_file: The full path to the converted key file, including filename. """ asserts.assert_true(in_file.endswith(".pem"), "Input file has to be .pem.") asserts.assert_true( out_file.endswith(".der"), "Output file has to be .der.") cmd = ("openssl pkcs8 -inform PEM -in {} -outform DER -out {} -nocrypt" " -topk8").format(in_file, out_file) utils.exe_cmd(cmd)
def _pre_capture_config(self, override_configs=None): """Utility function which configures the wireless interface per the specified configurations. Operation is performed before every capture start using baseline configurations (specified when sniffer initialized) and override configurations specified here. """ final_configs = {} if self._base_configs: final_configs.update(self._base_configs) if override_configs: final_configs.update(override_configs) if sniffer.Sniffer.CONFIG_KEY_CHANNEL in final_configs: try: utils.exe_cmd("iwconfig", self._interface, "channel", str(final_configs[sniffer.Sniffer.CONFIG_KEY_CHANNEL])) except Exception as err: raise sniffer.ExecutionError(err)
def setup_class(self): super().setup_class() try: self.stress_test_number = int( self.user_params["stress_test_number"]) self.log.info( "Executing {} calls per test in stress test mode".format( self.stress_test_number)) except KeyError: self.stress_test_number = 0 self.log.info( "No 'stress_test_number' defined: running single iteration tests" ) self.ad = self.android_devices[0] self.ad.sim_card = getattr(self.ad, "sim_card", None) self.md8475a_ip_address = self.user_params[ "anritsu_md8475a_ip_address"] self.wlan_option = self.user_params.get("anritsu_wlan_option", False) self.md8475_version = self.user_params.get("md8475", "A") setattr(self, 'emergency_call_number', DEFAULT_EMERGENCY_CALL_NUMBER) if 'emergency_call_number' in self.user_params: self.emergency_call_number = self.user_params[ 'emergency_call_number'] self.log.info("Using provided emergency call number: {}".format( self.emergency_call_number)) if not self.emergency_call_number in EMERGENCY_CALL_NUMBERS: self.log.warning("Unknown Emergency Number {}".format( self.emergency_call_number)) # Check for all adb devices on the linux machine, and set APM ON cmd = "|".join(("adb devices", "grep -i device$", "cut -f1")) output = exe_cmd(cmd) list_of_devices = output.decode("utf-8").split("\n") if len(list_of_devices) > 1: for i in range(len(list_of_devices) - 1): self.log.info("Serial %s", list_of_devices[i]) if check_apm_mode_on_by_serial(self.ad, list_of_devices[i]): self.log.info("Device is already in APM ON") else: self.log.info("Device is not in APM, turning it ON") set_apm_mode_on_by_serial(self.ad, list_of_devices[i]) if check_apm_mode_on_by_serial(self.ad, list_of_devices[i]): self.log.info("Device is now in APM ON") if self.ad.sim_card == "VzW12349": set_preferred_apn_by_adb(self.ad, "VZWINTERNET") try: self.anritsu = MD8475A(self.md8475a_ip_address, self.wlan_option, self.md8475_version) except AnritsuError: self.log.error("Error in connecting to Anritsu Simulator") return False return True
def _get_serial_port(self): """Get the serial port for a given ArduinoWifiDongle serial number. Returns: Serial port in string if the dongle is attached. """ cmd = 'ls %s' % DEV serial_ports = utils.exe_cmd(cmd).decode('utf-8', 'ignore').split('\n') for port in serial_ports: if 'USB' not in port: continue tty_port = '%s%s' % (DEV, port) cmd = 'udevadm info %s' % tty_port udev_output = utils.exe_cmd(cmd).decode('utf-8', 'ignore') result = re.search('ID_SERIAL_SHORT=(.*)\n', udev_output) if self.serial == result.group(1): logging.info('Found wifi dongle %s at serial port %s' % (self.serial, tty_port)) return tty_port raise ArduinoWifiDongleError('Wifi dongle %s is specified in config' ' but is not attached.' % self.serial)
def iperf_setup(self): # Fetch IP address of the host machine cmd = "|".join(("ifconfig", "grep eth0 -A1", "grep inet", "cut -d ':' -f2", "cut -d ' ' -f 1")) destination_ip = exe_cmd(cmd) destination_ip = (destination_ip.decode("utf-8")).split("\n")[0] self.log.info("Dest IP is %s", destination_ip) if not adb_shell_ping(self.ad, DEFAULT_PING_DURATION, destination_ip): self.log.error("Pings failed to Destination.") return False return destination_ip
def collect_bluetooth_manager_dumpsys_logs(pri_ad, test_name): """Collect "adb shell dumpsys bluetooth_manager" logs. Args: pri_ad: An android device. test_name: Current test case name. Returns: Dumpsys file path. """ dump_counter = 0 dumpsys_path = os.path.join(pri_ad.log_path, test_name, "BluetoothDumpsys") os.makedirs(dumpsys_path, exist_ok=True) while os.path.exists( os.path.join(dumpsys_path, "bluetooth_dumpsys_%s.txt" % dump_counter)): dump_counter += 1 out_file = "bluetooth_dumpsys_%s.txt" % dump_counter cmd = "adb -s {} shell dumpsys bluetooth_manager > {}/{}".format( pri_ad.serial, dumpsys_path, out_file) exe_cmd(cmd) file_path = os.path.join(dumpsys_path, out_file) return file_path
def _process_tshark_dump(self, log_file): """ Process tshark dump for better readability. Processes tshark dump for better readability and saves it to a file. Adds an info column at the end of each row. Format of the info columns: subtype of the frame, sequence no and retry status. Args: log_file : unprocessed sniffer output Returns: log_file : processed sniffer output """ temp_dump_file = os.path.join(self.log_path, 'sniffer_temp_dump.csv') utils.exe_cmd('cp {} {}'.format(log_file, temp_dump_file)) with open(temp_dump_file, 'r') as input_csv, open(log_file, 'w') as output_csv: reader = csv.DictReader(input_csv, fieldnames=self.TSHARK_COLUMNS, delimiter='^') writer = csv.DictWriter(output_csv, fieldnames=self.TSHARK_OUTPUT_COLUMNS, delimiter='\t') writer.writeheader() for row in reader: if row['subtype'] in self.TYPE_SUBTYPE_DICT: row['Info'] = '{sub} S={seq} retry={retry_status}'.format( sub=self.TYPE_SUBTYPE_DICT[row['subtype']], seq=row['seq'], retry_status=row['retry']) else: row['Info'] = '{} S={} retry={}\n'.format( row['subtype'], row['seq'], row['retry']) writer.writerow(row) utils.exe_cmd('rm -f {}'.format(temp_dump_file)) return log_file
def _get_serial_port(self): """Get the serial port for a given ArduinoWifiDongle serial number. Returns: Serial port in string if the dongle is attached. """ if not self.serial: raise ArduinoWifiDongleError( "Wifi dongle's serial should not be empty") cmd = "ls %s" % DEV serial_ports = utils.exe_cmd(cmd).decode("utf-8", "ignore").split("\n") for port in serial_ports: if "USB" not in port: continue tty_port = "%s%s" % (DEV, port) cmd = "udevadm info %s" % tty_port udev_output = utils.exe_cmd(cmd).decode("utf-8", "ignore") result = re.search("ID_SERIAL_SHORT=(.*)\n", udev_output) if self.serial == result.group(1): logging.info("Found wifi dongle %s at serial port %s" % (self.serial, tty_port)) return tty_port raise ArduinoWifiDongleError("Wifi dongle %s is specified in config" " but is not attached." % self.serial)
def collect_bluetooth_manager_dumpsys_logs(pri_ad, test_name): """Collect "adb shell dumpsys bluetooth_manager" logs. Args: pri_ad : An android device. Returns: True if dumpsys is successful, False otherwise. """ dump_counter = 0 dumpsys_path = ''.join((pri_ad.log_path, "/BluetoothDumpsys_" + test_name)) create_dir(dumpsys_path) while os.path.exists(dumpsys_path + "/" + "bluetooth_dumpsys_%s.txt" % dump_counter): dump_counter += 1 out_file = "bluetooth_dumpsys_%s.txt" % dump_counter cmd = ''.join("adb -s {} shell dumpsys bluetooth_manager > {}/{}".format( pri_ad.serial, dumpsys_path, out_file)) exe_cmd(cmd) file_path = "{}/{}".format(dumpsys_path, out_file) if not a2dp_dumpsys_parser(file_path): logging.error("Could not parse dumpsys logs") return False return True
def connect_wifi(wd, network=None): """Connect wifi on arduino wifi dongle Args: wd - wifi dongle object network - wifi network to connect to """ wd.log.info("Flashing connect_wifi.ino onto dongle") cmd = "locate %s" % CONNECT_WIFI file_path = utils.exe_cmd(cmd).decode("utf-8", "ignore").rstrip() write_status = wd.write(ARDUINO, file_path, network) asserts.assert_true(write_status, "Failed to flash connect wifi") wd.log.info("Flashing complete") wifi_status = wd.wifi_status() asserts.assert_true(wifi_status, "Failed to connect to %s" % network) ping_status = wd.ping_status() asserts.assert_true(ping_status, "Failed to connect to internet")
def disconnect_wifi(wd): """Disconnect wifi on arduino wifi dongle Args: wd - wifi dongle object Returns: True - if wifi is disconnected False - if not """ wd.log.info("Flashing disconnect_wifi.ino onto dongle") cmd = "locate %s" % DISCONNECT_WIFI file_path = utils.exe_cmd(cmd).decode("utf-8", "ignore").rstrip() write_status = wd.write(ARDUINO, file_path) asserts.assert_true(write_status, "Failed to flash disconnect wifi") wd.log.info("Flashing complete") wifi_status = wd.wifi_status(False) asserts.assert_true(not wifi_status, "Failed to disconnect wifi")
def stop_tcpdump_gce_server(ad, tcpdump_pid, fname, gce): """ Stop and pull tcpdump file from gce server Args: ad: android device object tcpdump_pid: process id for tcpdump file fname: tcpdump file path gce: dictionary of gce instance Returns: pcap file from gce server """ ad.log.info("Stop and pull pcap file from gce server") # stop tcpdump tcpdump_cmd = "sudo kill %s" % tcpdump_pid gcloud_ssh_cmd = "%s --project=%s --zone=%s %s@%s --command " % \ (GCE_SSH, gce["project"], gce["zone"], gce["username"], gce["hostname"]) gce_ssh_cmd = '%s "%s"' % (gcloud_ssh_cmd, tcpdump_cmd) utils.exe_cmd(gce_ssh_cmd) # verify tcpdump is stopped ps_cmd = '%s "ps aux | grep tcpdump"' % gcloud_ssh_cmd res = utils.exe_cmd(ps_cmd).decode("utf-8", "ignore") if tcpdump_pid in res.split(): raise signals.TestFailure("Failed to stop tcpdump on gce server") if not fname: return None # pull pcap file gcloud_scp_cmd = "%s --project=%s --zone=%s %s@%s:" % \ (GCE_SCP, gce["project"], gce["zone"], gce["username"], gce["hostname"]) pull_file = '%s%s.pcap %s/' % (gcloud_scp_cmd, fname, ad.device_log_path) utils.exe_cmd(pull_file) if not os.path.exists( "%s/%s.pcap" % (ad.device_log_path, fname.split('/')[-1])): raise signals.TestFailure("Failed to pull tcpdump from gce server") # delete pcaps utils.exe_cmd('%s "sudo rm %s.*"' % (gcloud_ssh_cmd, fname)) # return pcap file pcap_file = "%s/%s.pcap" % (ad.device_log_path, fname.split('/')[-1]) return pcap_file
def __init__(self, interface, logger, base_configs=None): """See base class documentation """ self._base_configs = None self._capture_file_path = "" self._interface = "" self._logger = logger self._process = None self._temp_capture_file_path = "" if interface == "": raise sniffer.InvalidDataError("Empty interface provided") self._interface = interface self._base_configs = base_configs try: utils.exe_cmd("ifconfig", self._interface, "down") utils.exe_cmd("iwconfig", self._interface, "mode", "monitor") utils.exe_cmd("ifconfig", self._interface, "up") except Exception as err: raise sniffer.ExecutionError(err)
def _update_ino_wifi_network(self, arduino, file_path, network): """Update wifi network in the ino file. Args: arduino: path of the arduino executable. file_path: path of the ino file to flash onto the dongle network: wifi network to update the ino file with Returns: cmd: arduino command to run to flash the .ino file """ tmp_file = '%s%s' % (TMP_DIR, file_path.split('/')[-1]) utils.exe_cmd('cp %s %s' % (file_path, tmp_file)) ssid = network[SSID_KEY] pwd = network[PWD_KEY] sed_cmd = 'sed -i \'s/"wifi_tethering_test"/"%s"/\' %s' % (ssid, tmp_file) utils.exe_cmd(sed_cmd) sed_cmd = 'sed -i \'s/"password"/"%s"/\' %s' % (pwd, tmp_file) utils.exe_cmd(sed_cmd) cmd = "%s %s --upload --port %s" % (arduino, tmp_file, self.port) return cmd
def _setup_data(self, set_simulation_func, rat): try: [self.bts1] = set_simulation_func(self.anritsu, self.user_params, self.ad.sim_card) set_usim_parameters(self.anritsu, self.ad.sim_card) set_post_sim_params(self.anritsu, self.user_params, self.ad.sim_card) if self.lte_bandwidth == 20: self.bts1.bandwidth = BtsBandwidth.LTE_BANDWIDTH_20MHz elif self.lte_bandwidth == 15: self.bts1.bandwidth = BtsBandwidth.LTE_BANDWIDTH_15MHz elif self.lte_bandwidth == 10: self.bts1.bandwidth = BtsBandwidth.LTE_BANDWIDTH_10MHz else: self.bts1.bandwidth = BtsBandwidth.LTE_BANDWIDTH_5MHz self.anritsu.start_simulation() if rat == RAT_LTE: preferred_network_setting = NETWORK_MODE_LTE_CDMA_EVDO rat_family = RAT_FAMILY_LTE elif rat == RAT_WCDMA: preferred_network_setting = NETWORK_MODE_GSM_UMTS rat_family = RAT_FAMILY_UMTS elif rat == RAT_GSM: preferred_network_setting = NETWORK_MODE_GSM_ONLY rat_family = RAT_FAMILY_GSM elif rat == RAT_1XRTT: preferred_network_setting = NETWORK_MODE_CDMA rat_family = RAT_FAMILY_CDMA2000 else: self.log.error("No valid RAT provided for SMS test.") return False if not ensure_network_rat( self.log, self.ad, preferred_network_setting, rat_family, toggle_apm_after_setting=True): self.log.error( "Failed to set rat family {}, preferred network:{}".format( rat_family, preferred_network_setting)) return False self.anritsu.wait_for_registration_state() time.sleep(self.SETTLING_TIME) # Fetch IP address of the host machine cmd = "|".join(("ifconfig", "grep eth0 -A1", "grep inet", "cut -d ':' -f2", "cut -d ' ' -f 1")) destination_ip = exe_cmd(cmd) destination_ip = (destination_ip.decode("utf-8")).split("\n")[0] self.log.info("Dest IP is %s", destination_ip) if not adb_shell_ping(self.ad, DEFAULT_PING_DURATION, destination_ip): self.log.error("Pings failed to Destination.") return False self.bts1.output_level = self.start_power_level # Power, iperf, file output, power change for iteration in range(1, self.MAX_ITERATIONS + 1): self.log.info("------- Current Iteration: %d / %d -------", iteration, self.MAX_ITERATIONS) current_power = self.bts1.output_level self.log.info("Current Power Level is %s", current_power) self.ip_server.start() tput_dict = {"Uplink": 0, "Downlink": 0} if iperf_test_by_adb( self.log, self.ad, destination_ip, self.port_num, True, 10, rate_dict=tput_dict): uplink = tput_dict["Uplink"] downlink = tput_dict["Downlink"] else: self.log.error("iperf failed to Destination.") self.log.info("Iteration %d Failed", iteration) if float(current_power) < -55.0: return True else: return False self.ip_server.stop() self.log.info("Iteration %d Passed", iteration) self.logpath = os.path.join(logging.log_path, "power_tput.txt") line = "Power " + current_power + " DL TPUT " + str(downlink) with open(self.logpath, "a") as tput_file: tput_file.write(line) tput_file.write("\n") current_power = float(current_power) new_power = current_power - self.step_size self.log.info("Setting Power Level to %f", new_power) self.bts1.output_level = new_power except AnritsuError as e: self.log.error("Error in connection with Anritsu Simulator: " + str(e)) return False except Exception as e: self.log.error("Exception during Data procedure: " + str(e)) return False return True
def test_carrier_id_update_wifi_disconnected(self): """Carrier Id Version Test with WiFi disconnected 1. WiFi is connected 2. Perform setup steps to cleanup shared_prefs 3. Send P/H flag update to configUpdater 4. Wait for 5 mins and keep checking for version match """ try: result_flag = False time_var = 1 ad = self.android_devices[0] ad.log.info("Before - CarrierId is %s", get_carrier_id_version(ad)) # Wifi Disconnect cleanup_configupdater(ad) wifi_toggle_state(ad.log, ad, False) # Trigger Config Update ad.log.info("Triggering Config Update") ad.log.info("%s", CARRIER_ID_METADATA_URL) exe_cmd("adb -s %s shell %s" % (ad.serial, CARRIER_ID_METADATA_URL)) ad.log.info("%s", CARRIER_ID_CONTENT_URL) exe_cmd("adb -s %s shell %s" % (ad.serial, CARRIER_ID_CONTENT_URL)) # Wait for 5 mins for Carrier Id version upgrade while (time_var < WAIT_TIME_FOR_CARRIERID_CHANGE): current_version = get_carrier_id_version(ad) if current_version == CARRIER_ID_VERSION: ad.log.info("After CarrierId is %s in %s mins", current_version, time_var) return False else: ad.log.debug("Carrier Id Version Not Match") time.sleep(60) time_var += 1 time_var = 1 ad.log.info("Success - CarrierId not upgraded during WiFi OFF") # WiFi Connect if not ensure_wifi_connected(self.log, ad, self.wifi_network_ssid, self.wifi_network_pass): ad.log.error("connect WiFi failed") return False # Wait for 5 mins for Carrier Id version upgrade while (time_var < WAIT_TIME_FOR_CARRIERID_CHANGE): current_version = get_carrier_id_version(ad) if current_version == CARRIER_ID_VERSION: ad.log.info("After CarrierId is %s in %s mins", current_version, time_var) result_flag = True break else: ad.log.debug("Carrier Id Version Not Match") time.sleep(60) time_var += 1 if not result_flag: ad.log.info("Carrier Id Failed to Update in %s mins", WAIT_TIME_FOR_CARRIERID_CHANGE) # pb file check out = ad.adb.shell("ls -l data/misc/carrierid/carrier_list.pb") if not out or "No such" in out: ad.log.error("carrier_list.pb file is missing") result_flag = False else: ad.log.info("carrier_list.pb file is present") return result_flag except Exception as e: ad.log.error(e) return False finally: carrier_id_path = os.path.join(self.log_path, self.test_name, "CarrierId_%s" % ad.serial) pull_carrier_id_files(ad, carrier_id_path)
def set_orientation(self, orientation): self.log.info('Setting orientation to {} degrees.'.format(orientation)) utils.exe_cmd('sudo {} -d {} -p {}'.format(self.TURNTABLE_FILE_PATH, self.device_id, orientation))