def run_prepare(platform): serial = DEVICE[platform] print "Pushing compass.conf" adb_steps.root_connect_device(serial = serial)() adb_steps.push_file(local = "/home/sensors/CTS/x86/android-cts/resource/compass.conf" , remote = "/data/compass.conf", serial = serial)() print "Unlocking device" adb_steps.wake_up_device(serial = serial)() adb_steps.menu_to_unlock(serial = serial)() print "Set location to False" cts_verifier_steps.set_location(serial = serial)() print "Set Adaptive brightness to False" cts_verifier_steps.set_display(serial = serial)() print "Set Stay Awake to False" adb_steps.enable_developer_options(serial = serial)() ui_steps.disable_options_from_developer_options(serial = serial, enabled = True, developer_options = ["Stay awake"])() print "Set airplane mode to True" wifi_steps.set_airplane_mode(state = "ON", serial = serial)() ui_steps.press_home(serial = serial)() print "Set Auto rotate to False" cts_verifier_steps.set_screen_rotation(serial = serial)() ui_steps.press_home(serial = serial)()
def do(self): adb_steps.root_connect_device(serial=self.serial)() device_prepair_for_repair(serial=self.serial, image_path=self.image_path, blocking=True)() adb_steps.reboot(serial=self.serial, blocking=True, reboot_timeout=600, command="recovery")() ssh_repair(ip=self.ip, blocking=True)() adb_steps.kill_server(serial=self.serial, blocking=True)() adb_steps.connect_device(serial=self.serial, blocking=True, timeout=50)() adb_steps.root_connect_device(serial=self.serial, blocking=True)()
from testlib.base.base_utils import get_args from testlib.scripts.android.adb import adb_steps from testlib.scripts.android.adb import adb_utils from testlib.scripts.gms.PlayGames import play_games_steps from testlib.scripts.android.ui import ui_steps from testlib.scripts.android.ui import ui_utils from testlib.scripts.gms import gms_utils ################################################################################ # Fetch parameters passed to the script ################################################################################ args = get_args(sys.argv) globals().update(vars(args)) globals().update(eval(script_args[0])) adb_steps.root_connect_device(serial=serial, port=adb_server_port)() globals().update({"version": adb_utils.get_android_version()}) ACCOUNT = account PASSWORD = password WHERE = 'name = "{0}"'.format(ACCOUNT) account_exists = ui_utils.google_account_exists(serial=serial, where=WHERE) total_account_no = gms_utils.get_google_account_number(serial=serial) if account_exists: account_synced = ui_steps.sync_google_account(serial=serial, account=ACCOUNT, password=PASSWORD)() if (total_account_no >= 2) or (not account_exists) or (account_exists
import os import sys import time from testlib.scripts.android.ui import ui_steps from testlib.scripts.android.adb import adb_steps from testlib.base.base_utils import get_args from testlib.scripts.android.ui.security import security_steps from testlib.scripts.android.ui.security import security_utils ##### initialization ##### globals().update(vars(get_args(sys.argv))) ##### test start ##### platform_name = security_utils.get_platform_name() adb_steps.root_connect_device(serial=serial)() time.sleep(5) command = "adb shell getprop | grep crypt" result = False r = os.popen(command) info = r.readlines() for line in info: line = line.strip("\r\n") if "[ro.crypto.state]: [encrypted]" in line: result = True if not result: raise Exception("The test result did not achieve the desired results") command = "adb shell cat /fstab." + platform_name + " | grep forceencrypt" result = False
'grep_for': 'i2c_hid', 'lsmod_output': ['i2c_hid 18717 0 - Live 0x0000000000000000'] }, "t100": { 'name': 'asus_nb_wmi', 'grep_for': 'wmi', 'lsmod_output': [ 'asus_nb_wmi 16862 0 - Live 0x00000000', 'asus_wmi 23517 1 asus_nb_wmi, Live 0x00000000', 'wmi 18356 1 asus_wmi, Live 0x00000000' ] }, "xps12": {} }] adb_steps.connect_device(serial=serial)() adb_steps.root_connect_device()() p = adb_steps.load_CPU()() time.sleep(2) for kmodule in kmodules: for i in range(iterations): print "Iteration {0}".format(i + 1) steps.kmod_remove_insert( kmodule=kmodule, media_path=media_path, )() time.sleep(3)
def do(self): # Create panic adb_steps.root_connect_device(serial=self.serial)() if self.create_crash_mode == "panic": # Using local_steps to run the command because adb_steps.command() does not create kernel panic local_steps.command("adb -s {0} shell {1}".format( self.serial, self.panic_command))() # Wait for the device to disconnect local_steps.wait_until_disconnected(serial=self.serial)() if self.use_combo_button == False: print "======================wait 120s=======================" time.sleep(120) else: adb_steps.kill_process(serial=self.serial, process_name=self.watchdog_process_name, with_reboot=True, reboot_timeout=60)() # Wait for a device state if self.wait_for_state == "fastboot": # Set the pass and error messages self.set_errorm( "", "The device with serial {0} is not in fastboot".format( self.serial)) self.set_passm("The device with serial {0} is in fastboot".format( self.serial)) # If the expected state is fastboot, we need to press the volume down button after the panic is created # This will boot the device in fastboot # Create a parallel step # use_control_process=False psteps = ParallelSteps(use_control_process=False) step_id_combo = psteps.add_step( local_steps.wait_for_fastboot, serial=self.serial, timeout=self.wait_for_fastboot_timeout) self.relay.relay.on(self.relay.v_down_port) time.sleep(self.wait_for_fastboot_timeout - 10) self.relay.relay.off(self.relay.v_down_port) # Interpret the parallel step result psteps.interpret_step(step_id_combo) elif self.wait_for_state == "android": # Set the pass and error messages self.set_errorm( "", "The device with serial {0} is not in MOS".format(self.serial)) self.set_passm("The device with serial {0} is in MOS".format( self.serial)) # Wait for adb connection local_steps.wait_for_adb(serial=self.serial)() # Wait for the UI processes adb_steps.wait_for_ui_processes(serial=self.serial)() elif self.wait_for_state == "crashmode": # Set the pass and error messages self.set_errorm( "", "The device with serial {0} is not in crash mode".format( self.serial)) self.set_passm( "The device with serial {0} is in crash mode".format( self.serial)) # Wait for crashmode local_steps.wait_for_crashmode(serial=self.serial, timeout=60)()
def do(self): adb_steps.connect_device(serial=self.serial, port=self.port)() adb_steps.root_connect_device(serial=self.serial, port=self.port)() adb_steps.reboot(serial=self.serial, port=self.port)() pnp_utils.wait_for_cooldown(self.adb_connection, "t100")