Exemple #1
0
 def do(self):
     after_wipe_prepare_device(serial=self.serial,
                               db_prop_list=self.db_prop_list,
                               env_prop_list=self.env_prop_list)()
     adb_steps.reboot(serial=self.serial)()
     time.sleep(10)
     local_steps.wait_for_ping(blocking=True, timeout=100, ip=self.ip)()
     after_wipe_prepare_ui(serial=self.serial)()
Exemple #2
0
    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)()
Exemple #3
0
    def do(self):
        print "{0}: {1}".format(self.serial, self.img_path)
        ################################################################################
        # Device has to be in fastboot
        #   - if already in fastboot, do nothing
        #   - if it has adb, reboot in fastboot via adb
        #   - for any other state:
        #       * force poweroff via relay
        #       * boot in fastboot via relay (poweron & volume down)
        ################################################################################
        print "{0}: reboot to fastboot".format(self.serial)
        if local_utils.has_fastboot_serial(self.serial):
            pass
        elif local_utils.has_adb_serial(self.serial):
            adb_steps.reboot(serial=self.serial, command="fastboot")()
        else:
            ############################################################################
            # device file should be made dynamic to support multiple relays
            ############################################################################
            print "{0}: Relay needed!!!!!!!!".format(self.serial)
            my_relay = Relay(port=self.device["relay"]["tty"])
            my_relay.power_on(self.device["relay"]["v_up_port"])
            my_relay.power_on(self.device["relay"]["power_port"])
            my_relay.close()
        print "{0}: Done rebooting for fastboot!".format(self.serial)

        print "{0}: Wait for fastboot".format(self.serial)
        local_steps.wait_for_fastboot(serial=self.serial, timeout=100)()
        print "{0}: Done waiting for fastboot!".format(self.serial)
        old_folder, err = local_steps.command("pwd")()

        local_steps.change_dir(new_folder=self.img_path)()
        print "{0}: Wait for flash-all.sh".format(self.serial)
        #TODO: add stdout_gprep for flash-all.sh
        sout, serr = local_steps.command(
            command="./flash-all.sh -s {0}".format(self.serial))()
        print "{0}: Done! Image flashed".format(self.serial)
        print "{0}: Wait for adb".format(self.serial)

        local_steps.wait_for_adb(serial=self.serial, timeout=720)()
        print "{0}: Done! adb connected".format(self.serial)
        local_steps.change_dir(new_folder=old_folder.strip())()
Exemple #4
0
# Test page should be opened succesfuly using chrome browser
browser_steps.open_chrome_proxy(url_to_open = test_page_url, valid_server=valid_server, serial=serial)()

# open and verify the bypass page
if proxy_bypass:
    browser_steps.open_specific_page(is_bad_url = False, url = bypass_url, url_title = "DD-WRT", wait_time = 4000, serial=serial)()

# check the Proxy configuration is kept after WiFi is turn on->off->on
if toggle_wifi:
    wifi_steps.toggle_wifi_switch_from_settings(wait_time = 3, iterations=1, serial=serial)()
    browser_steps.open_chrome_proxy(url_to_open = test_page_url, valid_server=valid_server, serial=serial)()

# check the Proxy configuration is kept after restarting DUT
if dut_reboot:
    adb_steps.reboot(command = "", no_ui = False, ip_enabled = False, disable_uiautomator = False, pin = wifi_defaults.wifi['pin'], serial=serial)()
    adb_steps.root_connect_device(serial = serial)()
    browser_steps.open_chrome_proxy(url_to_open = test_page_url, valid_server=valid_server, serial=serial)()

# check the Proxy configuration is kept after restarting  WiFi AP
if ap_reboot:
    ddwrt_steps.reload_ap()()
    browser_steps.open_chrome_proxy(url_to_open = test_page_url, valid_server=valid_server, serial=serial)()

# check the Proxy configuration is kept after AP_old to AP_new transition
if new_ssid:
    ddwrt_steps.setup(new_ssid = new_ssid, mode = "mixed", security="wpa_psk", wifi_password=passphrase, encryption=encryption)()
    wifi_steps.add_network(proxy=proxy_mode, proxy_hostname = proxy_server, proxy_port=proxy_port,proxy_bypass=proxy_bypass,
                               ssid = new_ssid,
                               security = dut_security,
                               password = passphrase,
Exemple #5
0
relay_type = args["relay_type"]
relay_port = args["relay_port"]
power_port = args["power_port"]
app_to_find = args["app_to_find"]

# Test start #
relay_steps.reboot_main_os(serial=serial,
                           relay_type=relay_type,
                           relay_port=relay_port,
                           power_port=power_port)()

ui_steps.wake_up_device(serial=serial)()
ui_steps.unlock_device(serial=serial)()

# Reboot in safe mode
relay_steps.reboot_safe_mode(serial=serial,
                             app_to_find=app_to_find,
                             relay_type=relay_type,
                             relay_port=relay_port,
                             power_port=power_port)()

# Reboot in normal mode
adb_steps.reboot(serial=serial)()

# Check the app is displayed in normal mode
ui_steps.find_app_from_allapps(serial=serial,
                               view_to_find={"text": app_to_find},
                               presence=True)()

# Test end #
Exemple #6
0
if 'ap-pass' in gts_config:
    gts_ap_pass = gts_config['ap-pass']

if no_prepare == False:
    return_data = gts_steps.prepare_device_for_gts(serial=device["serial"],
                                                   gts_base_path=gts_base_path,
                                                   gts_tcs_dir=gts_tcs_dir,
                                                   platform=build_platform,
                                                   update=update,
                                                   hidden_ap=True,
                                                   ap_name=gts_ap_name,
                                                   ap_pass=gts_ap_pass,
                                                   intent=True)()
    #TODOO
    adb_steps.reboot(serial=device["serial"],
                     ip_enabled=False,
                     enable_uiautomator=False)()
########################################################################

########################################################################
# GTS RUN
########################################################################
print "Start with the GTS"
report_config_file = args['report-config-file']
report_config = eval(open(report_config_file, 'r').read())
gts_mail_report_path = report_config['mail-report-path']
gts_mail_report_template = report_config['mail-report-template']
report_recipients = report_config['report-recipients']
debug_recipients = report_config['debug-recipients']
email_sender = report_config['email-sender']
email_host = report_config['email-sender-host']
Exemple #7
0
# @filename:    test_04_sp_update_repairOS.py
# @description: Checks sp_update is available on DUT in repairOS
# @author:      [email protected]
#
#######################################################################

from testlib.scripts.connections.ssh import ssh_steps
from testlib.scripts.connections.local import local_steps
from testlib.scripts.android.adb import adb_steps

import sys
import time

adb_steps.connect_device(serial=sys.argv[1] + ":5555", port=sys.argv[2])()

adb_steps.reboot(command="recovery", reboot_timeout=200, blocking=True)()

ssh_steps.command(command="ls /usr/bin/sp_update",
                  stdout_grep="/usr/bin/sp_update",
                  stdout_not_grep="No such file or directory",
                  host=sys.argv[1],
                  user="******",
                  password="",
                  verbose=True,
                  sftp_enabled=False)()

ssh_steps.command(command="reboot",
                  timeout=200,
                  host=sys.argv[1],
                  user="******",
                  password="",
# Test start #
try:
    relay_steps.reboot_main_os(serial=serial,
                               relay_type=relay_type,
                               relay_port=relay_port,
                               power_port=power_port,
                               v_down_port=v_down_port,
                               v_up_port=v_up_port,
                               wait_ui=True)()

    ui_steps.wake_up_device(serial=serial)()
    ui_steps.unlock_device(serial=serial)()

    # Reboot into fastboot #
    adb_steps.reboot(command="fastboot", serial=serial)()

    # Check the vars
    fastboot_steps.check_all_vars(serial=serial)()
except:
    raise
finally:
    relay_steps.reboot_main_os(serial=serial,
                               relay_type=relay_type,
                               relay_port=relay_port,
                               power_port=power_port,
                               v_down_port=v_down_port,
                               v_up_port=v_up_port,
                               wait_ui=True)()
# Test end #
# @description: Checks of screen lock appears at boot time.
#
# @author:      [email protected]
#
##############################################################################

from testlib.scripts.android.adb import adb_steps
from testlib.scripts.security.scripts import prerequisites
from testlib.base.base_utils import get_args
import sys
import time
globals().update(vars(get_args(sys.argv)))

# Run Prerequisites
prerequisites.run_prereq(serial=serial,
                         pin="1234",
                         set_screen_lock=True,
                         require_pin_to_start_device=True)()
time.sleep(5)

adb_steps.reboot(serial=serial,
                 no_ui=True,
                 boot_to_Android=False,
                 pin="1234",
                 blocking=True)()

adb_steps.wait_for_ui_processes(serial=serial, imeout=30000)()

adb_steps.wait_for_text(serial=serial,
                        text_to_find="To start Android, enter your PIN")()
Exemple #10
0
 def do(self):
     if local_utils.has_adb_serial(serial = self.serial):
         adb_steps.reboot(serial = self.serial,
                          command = "fastboot",
                          ip_enabled = False)()
Exemple #11
0
#!/usr/bin/env python

# #############################################################################
#
# @filename:    keymaster.py
#
# @description: Provide a basic set of cryptrographic primitives to allow the
#		implementation of protocols using access-controlled,
#		hardware-backed keys
#
# @author:      [email protected]
#
##############################################################################

from testlib.scripts.android.adb import adb_steps
from testlib.base.base_utils import get_args
import sys

globals().update(vars(get_args(sys.argv)))

adb_steps.reboot(serial=serial,
                 disable_uiautomator=True,
                 boot_to_Android=False,
                 no_ui=True)()
adb_steps.wait_for_ui_processes(serial=serial)()
adb_steps.command(serial=serial,
                  command="logcat -d | grep -i keymaster",
                  stdout_grep="Found keymaster1 module,"
                  " using keymaster1 API")()
    ui_steps.close_all_app_from_recent(serial=serial)()
    ui_steps.press_home(serial=serial)()

    #   Ensure PIN is enabled
    telephony_steps.set_sim_pin(serial=serial,
                                state="ON",
                                pin=telephony_defaults.sim['default_pin'])()

    #   Test: PIN - Enabling PIN - PIN1 is asked when setting flight mode off after rebooting in flight mode
    #   Step 1: Set flight mode on
    wifi_steps.set_airplane_mode(serial=serial, state="ON")()

    #   Step 2: Reboot DUT
    adb_steps.reboot(serial=serial,
                     reboot_timeout=200,
                     sim_pin=telephony_defaults.sim['default_pin'],
                     sim_pin_enabled=True,
                     no_ui=True)()

    adb_steps.check_device_reboots(serial=serial, reboot_timeout=120)()
    local_steps.wait_for_adb(serial=serial, reboot_timeout=120)()
    adb_steps.wait_for_ui(serial=serial,
                          boot_to_Android=False,
                          sim_pin_enabled=True)()
    telephony_steps.check_pin_is_requested(serial=serial,
                                           enabled_pin=True,
                                           with_reboot=False)()

    #   Step 3: Allow System Boot completion
    #   Step 4: If PIN1 is requested after step 3, enter correct PIN1
    telephony_steps.wake_up_device_with_sim_pin(
Exemple #13
0
 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")
                         pin="1234",
                         set_screen_lock=True,
                         blocking=True)()

# CREATE 1GB file
file_steps.create_random_file(file_name="testfile",
                              size=1024**3,
                              blocking=True)()

# SEND 1GB file to DUT
adb_steps.push_file(serial=serial,
                    local="testfile",
                    remote="/data/local/tmp",
                    timeout=5000,
                    blocking=True)()

# Reboot DUT
adb_steps.reboot(serial=serial, pin="1234", ip_enabled=False)()

# Check for sent file
adb_steps.command(serial=serial,
                  command="ls -l /data/local/tmp/testfile",
                  stdout_grep=str(1024**3))()

# Remake initial state
adb_steps.command(serial=serial,
                  command="rm /data/local/tmp/testfile",
                  timeout=50000)()

file_steps.remove_file(file_name="testfile")()
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.adb import adb_utils
from testlib.scripts.android.fastboot import fastboot_steps
from testlib.scripts.android.ui import ui_steps
from testlib.scripts.security.scripts import prerequisites
from testlib.base.base_utils import get_args
import sys
globals().update(vars(get_args(sys.argv)))

dut_dessert = adb_utils.get_android_version(serial = serial)

# Run Prerequisites
prerequisites.run_prereq(serial = serial,
                         pin = "1234")()

ui_steps.enable_oem_unlock(serial = serial, enabled = False, blocking = True)()

# reboot to fastboot
adb_steps.reboot(serial = serial,
                command = "fastboot",
                ip_enabled = False,
                blocking = True)()

fastboot_steps.change_state(serial = serial,
                            unlock_bootloader = "no",
                            dessert = dut_dessert)()

fastboot_steps.continue_to_adb(serial = serial)()
adb_steps.wait_for_ui(serial = serial)()
# Used defined libraries
from testlib.base.base_utils import get_args
from testlib.base import base_step
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.ui import ui_steps

# ############# Get parameters ############

globals().update(vars(get_args(sys.argv)))
args = {}
for entry in script_args:
    key, val = entry.split("=")
    args[key] = val
###############################

adb_steps.reboot(reboot_timeout=400, serial=serial)()

ui_steps.press_home(serial=serial)()
ui_steps.press_car(serial=serial)()
ui_steps.open_settings(serial=serial)()
ui_steps.click_button_common(view_to_find={"text": "System"},
                             view_to_check={"textContains": "Languages"},
                             serial=serial)()
ui_steps.click_button_common(view_to_find={"text": "About phone"},
                             view_to_check={"text": "Status"},
                             serial=serial)()
ui_steps.click_button_common(view_to_find={"text": "Status"},
                             view_to_check={"text": "Up time"},
                             serial=serial)()

uptime = ui_steps.wait_for_view_common(
        line = line.strip("\r\n")
        line = line.split()
        for s in line:
            if "bxtp_abl" in s:
                return True
            if "gordon_peak" in s:
                return False

wait_ui = get_devices_info("adb shell getprop ro.product.device")

try:
    if local_utils.get_device_boot_state(serial = serial) == "fastboot":
        fastboot_steps.continue_to_adb(serial = serial)()

    adb_steps.reboot(command = "bootloader",
                     reboot_timeout = 300,
                     serial = serial)()

    fastboot_steps.reboot_fastboot(timeout = 300, serial = serial)()

    fastboot_steps.continue_to_adb(serial=serial)()

except:
    raise

finally:
    if serial in local_utils.get_fastboot_devices():
        fastboot_steps.continue_to_adb(serial = serial)()
    
    # relay_steps.reboot_main_os(serial = serial,
    #                          relay_type = relay_type,
Exemple #18
0
                               ip_settings="Static",
                               ip_address=static_ip,
                               gateway=gateway,
                               network_prefix_length=net_mask)()

# wait until the device connects to a wifi network
wifi_generic_steps.wait_until_connected(serial=serial)()

# check we are connected to the correct network
wifi_generic_steps.check_connection_info(serial=serial,
                                         SSID=ddwrt_ap_name,
                                         state='CONNECTED/CONNECTED')()
wifi_generic_steps.ping_gateway(serial=serial)()

# reboot device
adb_steps.reboot(serial=serial, ip_enabled=False)()
adb_steps.root_connect_device(serial=serial)()
ui_steps.set_orientation_vertical(serial=serial, orientation="portrait")()
adb_steps.command(
    serial=serial,
    command="settings put global captive_portal_detection_enabled 0",
    mode="sync",
    timeout=10)()

# wait until the device connects to a wifi network
wifi_generic_steps.wait_until_connected(serial=serial)()

# check we are connected to the correct network
wifi_generic_steps.check_connection_info(serial=serial,
                                         SSID=ddwrt_ap_name,
                                         state='CONNECTED/CONNECTED')()
Exemple #19
0
    key, val = entry.split("=")
    args[key] = val

relay_type = args["relay_type"]
relay_port = args["relay_port"]
power_port = args["power_port"]

##### test start #####
try:
    relay_steps.reboot_main_os(serial = serial,
                               relay_type = relay_type,
                               relay_port = relay_port,
                               power_port = power_port,
                               wait_ui = True)()

    adb_steps.reboot(command = "bootloader",
                     serial = serial)()

    result = False

    os.system("mkdir ./tmp")
    os.system("fastboot getvar hw-revision > ./tmp/tmp.txt 2>&1")

    f = open("./tmp/tmp.txt")
    info = f.readlines()
    for line in info:
        line = line.strip("\r\n")
        line = line.split()
        if "hw-revision:" == line[0]:
            if "C0" == line[1]:
                result = True
    f.close()
Exemple #20
0
# Initialisation #
globals().update(vars(get_args(sys.argv)))

args = {}
for entry in script_args:
    key, val = entry.split("=")
    args[key] = val

app_to_find = args["app_to_find"]

# Test start #
if serial in local_utils.get_fastboot_devices():
    fastboot_steps.continue_to_adb(serial=serial)()

# Reboot in safe mode
adb_steps.reboot(serial=serial, safe_mode=True)()

# Check the app is NOT displayed in safe mode
ui_steps.find_app_from_allapps(serial=serial,
                               view_to_find={"text": app_to_find},
                               presence=False)()

# Reboot in normal mode
adb_steps.reboot(serial=serial)()

# Check the app is displayed in normal mode
ui_steps.find_app_from_allapps(serial=serial,
                               view_to_find={"text": app_to_find},
                               presence=True)()

# Test end #
import time
from testlib.base.base_utils import get_args
from testlib.scripts.android.adb import adb_steps
from testlib.scripts.android.fastboot import fastboot_steps
from testlib.scripts.android.fastboot import fastboot_utils
from testlib.scripts.connections.local import local_steps

##### initialization #####
globals().update(vars(get_args(sys.argv)))

##### test start #####
try:
	os.system("mkdir -p ./temp/files/flash")
	fastboot_utils.download_flash_scripts()

	adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)()
	local_steps.wait_for_fastboot(timeout=300, serial=serial)()
	fastboot_steps.continue_to_adb(serial=serial)()
	local_steps.wait_for_adb(timeout=300, serial=serial)()

	os.system("adb -s {0} shell reboot -p".format(serial))
	time.sleep(30)
	fastboot_utils.to_fastboot_by_script(serial=serial)
	local_steps.wait_for_fastboot(timeout=300, serial=serial)()
	fastboot_steps.continue_to_adb(serial=serial)()
	local_steps.wait_for_adb(timeout=300, serial=serial)()
	os.system("sudo rm -rf ./temp")

except:
	fastboot_utils.to_fastboot_by_script(serial=serial)
	local_steps.wait_for_fastboot(timeout=300, serial=serial)()
Exemple #22
0
#globals().update({"version": adb_utils.get_android_version()})
PATH_TO_BUILD="/home/ccarabas/work/cts-dispatcher/repair/latest"


################################################################################
# Device has to be in fastboot
#   - if already in fastboot, do nothing
#   - if it has adb, reboot in fastboot via adb
#   - for any other state:
#       * force poweroff via relay
#       * boot in fastboot via relay (poweron & volume down)
################################################################################
if local_utils.has_fastboot_serial(serial):
    pass
elif local_utils.has_adb_serial(serial):
    adb_steps.reboot(serial = serial, command="fastboot", ip_enabled=False)()
else:
    ############################################################################
    # device file should be made dynamic to support multiple relays
    ############################################################################
    my_relay = Relay(port = "/dev/ttyACM0")
    my_relay.power_off()
    my_relay.enter_fastboot()
    my_relay.close()

local_steps.wait_for_fastboot(serial = serial,
                              timeout = 20)()

local_steps.change_dir(serial = serial,
                       new_folder=PATH_TO_BUILD)()
local_steps.command(serial = serial,