예제 #1
0
                serial=serial)
        if zip_name == "gordon_peak":
            fastboot_utils.flash_bxt(zip_file="./temp/image/eb/userdebug/" +
                                     eb_userdebug_patch_flashfiles_zip_name,
                                     serial=serial)

    fastboot_utils.push_uiautomator_jar(serial=serial)
    fastboot_steps.config_first_boot_wizard(serial=serial)()

    fastboot_utils.enable_oem_unlock(serial=serial)

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

    test_result = False
    fastboot_steps.command(
        command="getvar unlocked > ./temp/files/getvar_unlocked.txt 2>&1",
        serial=serial)()
    return_result = open("./temp/files/getvar_unlocked.txt").readlines()
    for line in return_result:
        if "unlocked: no" in line: test_result = True
    if not test_result:
        raise Exception("The test result did not achieve the desired results")

    fastboot_steps.command(
        command="flashing unlock > ./temp/files/unlock_result.txt 2>&1",
        serial=serial)()
    unlock_result = fastboot_utils.fastboot_command_result(
        file_name="./temp/files/unlock_result.txt")
    if unlock_result:
        raise Exception("The test result did not achieve the desired results")
예제 #2
0
    key, val = entry.split("=")
    args[key] = val
flash_files = args["flash_files"]

##### 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)()
    fastboot_steps.unlock_device(serial=serial)()
    fastboot_steps.lock_device(serial=serial)()
    fastboot_steps.reboot_fastboot(serial=serial)()

    fastboot_steps.command(
        command="getvar device-state > ./temp/files/device_state.txt 2>&1",
        serial=serial)()
    device_state = fastboot_utils.get_device_state(
        file_path="./temp/files/device_state.txt")
    if device_state == "unlocked":
        raise Exception("The test result did not achieve the desired results")

    fastboot_steps.continue_to_adb(serial=serial)()
    time.sleep(60)
    local_steps.wait_for_adb(serial=serial, timeout=300)()

    fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial)
    os.system("sudo rm -rf ./temp")

except:
    fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial)
예제 #3
0
        if zip_name == "gordon_peak":
            fastboot_utils.unpack_the_zip(
                file_name="./temp/image/eb/userdebug/" +
                eb_userdebug_patch_flashfiles_zip_name,
                temp_path=r"./temp/image/eb/userdebug/flashfiles")
            fastboot_utils.flash_bxt(zip_file="./temp/image/eb/userdebug/" +
                                     eb_userdebug_patch_flashfiles_zip_name,
                                     serial=serial)
            flashfiles_type = "userdebug"

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

    zip_name = fastboot_utils.get_zip_name(zip_path=flash_files)
    if zip_name == "r0_bxtp_abl":
        fastboot_steps.command(
            command="flashing unlock > ./temp/files/unlock_result.txt 2>&1",
            serial=serial)()
    fastboot_steps.command(command="flash {0} ./temp/image/eb/{3}/flashfiles/{1} > ./temp/files/{2}.txt 2>&1"\
     .format("gpt", "gpt_gr_mrb_b1.bin", "flash_gpt_result", flashfiles_type), serial=serial)()
    fastboot_steps.command(
        command="erase {0} > ./temp/files/{1}.txt 2>&1".format(
            "teedata", "erase_teedata_result"),
        serial=serial)()
    fastboot_steps.command(
        command="erase {0} > ./temp/files/{1}.txt 2>&1".format(
            "misc", "erase_misc_result"),
        serial=serial)()
    fastboot_steps.command(
        command="erase {0} > ./temp/files/{1}.txt 2>&1".format(
            "persistent", "erase_persistent_result"),
        serial=serial)()
예제 #4
0
        local_steps.command("adb -s {0} reboot".format(serial))()
        local_steps.wait_for_adb(serial=serial)()
        adb_steps.wait_for_ui_processes(serial=serial)()
    else:
        relay_steps.reboot_main_os(serial=serial,
                                   relay_type=relay_type,
                                   relay_port=relay_port,
                                   power_port=power_port)()

    # Reboot the device into bootloader
    adb_steps.reboot(command="bootloader",
                     serial=serial)()

    # Set the watchdog counter
    fastboot_steps.command(command="oem set-watchdog-counter-max {0}".format(watchdog_counter_max),
                           serial=serial,
                           stderr_grep="finished. total time:")()
    # Continue to adb
    fastboot_steps.continue_to_adb(serial=serial)()

    # Wait for UI processes
    adb_steps.wait_for_ui_processes(serial=serial)()

    # Create panic and check device state
    # The panics must be created before the counter resets
    now_old = datetime.datetime.now()

    # Cause watchdog_counter_max kernel panics
    for count in range(watchdog_counter_max + 1):

        # If there are multiple iterations, print the iteration number
예제 #5
0
                serial=serial)
        if zip_name == "gordon_peak":
            fastboot_utils.flash_bxt(zip_file="./temp/image/eb/userdebug/" +
                                     eb_userdebug_patch_flashfiles_zip_name,
                                     serial=serial)

    fastboot_utils.push_uiautomator_jar(serial=serial)
    fastboot_steps.config_first_boot_wizard(serial=serial)()

    fastboot_utils.enable_oem_unlock(serial=serial)

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

    test_result = False
    fastboot_steps.command(
        command=
        "flashing get_unlock_ability > ./temp/files/flashing_get_unlock_ability.txt 2>&1",
        serial=serial)()
    return_result = open(
        "./temp/files/flashing_get_unlock_ability.txt").readlines()
    for line in return_result:
        if "The device class does not permit to unlock it." in line:
            test_result = True
    if not test_result:
        raise Exception("The test result did not achieve the desired results")

    fastboot_steps.command(
        command="flashing unlock > ./temp/files/unlock_result.txt 2>&1",
        serial=serial)()
    unlock_result = fastboot_utils.fastboot_command_result(
        file_name="./temp/files/unlock_result.txt")
    if unlock_result:
예제 #6
0
    if platform_name == "bxtp_abl": image_platform = "image_m_bxt"
    if platform_name == "gordon_peak":
        ram_value = fastboot_utils.get_bxt_ram(serial=serial)
        if ram_value == "2g": image_platform = "image_o_bxt_2g"
        if ram_value == "4g": image_platform = "image_o_bxt_4g"
        if ram_value == "8g": image_platform = "image_o_bxt_4g"
    n_img_zip_path = config.get(image_platform, "n_img_zip")
    n_img_zip_name = n_img_zip_path.split("/")[-1]
    fastboot_utils.download_file(url=fastboot_path + n_img_zip_path,
                                 local_filename="./temp/image/n/" +
                                 n_img_zip_name)

    adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)()
    fastboot_steps.unlock_device(serial=serial)()
    fastboot_steps.command(command="update ./temp/image/n/" + n_img_zip_name +
                           " > ./temp/files/temp.txt 2>&1",
                           serial=serial)()
    time.sleep(120)
    local_steps.wait_for_adb(timeout=300, serial=serial)()

    return_result = fastboot_utils.fastboot_command_result(
        file_name="./temp/files/temp.txt")
    if not return_result:
        raise Exception("The test result did not achieve the desired results")

    fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial)
    os.system("sudo rm -rf ./temp")

except:
    fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial)
    os.system("sudo rm -rf ./temp")
예제 #7
0
    fastboot_utils.unpack_the_zip(file_name=flash_files,
                                  temp_path=r"./temp/image/n/flashfiles")
    fastboot_utils.unpack_the_zip(file_name="./temp/files/resources/" +
                                  simg2img_zip_name,
                                  temp_path=r"./temp/files/resources")
    fastboot_utils.make_simg2img(file_path="./temp/files/resources/" +
                                 simg2img_zip_name[:-4],
                                 return_path="../../../..")
    os.system(
        "simg2img ./temp/image/n/flashfiles/system.img ./temp/files/unsparse.img"
    )

    adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)()
    fastboot_steps.command(
        command="oem get-hashes > ./temp/files/oem_gethashes_result.txt 2>&1",
        serial=serial)()
    fastboot_steps.continue_to_adb(serial=serial)()
    time.sleep(60)
    local_steps.wait_for_adb(timeout=300, serial=serial)()

    system_image_sha1 = fastboot_utils.get_image_sha1(
        "sha1sum ./temp/files/unsparse.img")
    boot_image_sha1 = fastboot_utils.get_image_sha1(
        "sha1sum ./temp/image/n/flashfiles/boot.img")
    system_partition_sha1 = fastboot_utils.fastboot_command_get_hashes(
        file_path="./temp/files/oem_gethashes_result.txt",
        partition_name="/system")
    boot_partition_sha1 = fastboot_utils.fastboot_command_get_hashes(
        file_path="./temp/files/oem_gethashes_result.txt",
        partition_name="/boot")
    dessert = adb_utils.get_android_version(serial=serial)

    # Disable OEM unlock in developer options #
    ui_steps.disable_options_from_developer_options(
        serial=serial, developer_options=[dev_oem_option])()

    # Reboot into bootloader
    #adb_steps.reboot(command="fastboot", serial=serial)()
    local_steps.command(
        command="adb -s {0} reboot bootloader".format(serial))()
    local_steps.wait_for_fastboot(serial=serial, timeout=60)()

    # Check unlock ability (should be disabled)
    fastboot_steps.command(serial=serial,
                           command=get_unlock_ability_command,
                           stderr_grep=unlock_disabled_output,
                           timeout=20)()

    # Attempt to unlock bootloader
    relay_steps.change_state(serial=serial,
                             dessert=dessert,
                             unlock_bootloader="yes",
                             oem_unlock_enabled="no",
                             relay_type=relay_type,
                             relay_port=relay_port,
                             power_port=power_port,
                             v_down_port=v_down_port,
                             v_up_port=v_up_port)()

    # Continue to adb
    fastboot_steps.continue_to_adb(serial=serial)()
예제 #9
0
                               unlock_dut=False,
                               lock_dut=False,
                               serial=serial)()
    fastboot_steps.flash_image(partition_name="boot",
                               file_name=img_path + "boot.img",
                               unlock_dut=False,
                               lock_dut=False,
                               serial=serial)()
    if platform_name == "gordon_peak":
        fastboot_steps.flash_image(partition_name="vbmeta_a",
                                   file_name=img_path + "vbmeta.img",
                                   unlock_dut=False,
                                   lock_dut=False,
                                   serial=serial)()
        fastboot_steps.command(
            command="--set-active=_a > ./temp/files/temp.txt 2>&1",
            serial=serial)()
        return_result = fastboot_utils.fastboot_command_result(
            file_name="./temp/files/temp.txt")
        if not return_result:
            raise Exception(
                "The test result did not achieve the desired results")
    fastboot_steps.lock_device(serial=serial)()
    fastboot_steps.continue_to_adb(serial=serial)()
    time.sleep(60)
    local_steps.wait_for_adb(timeout=300, serial=serial)()

    test_result = False
    flashfiles_build_version = re.split("-|\.", flash_files)[-2]
    return_result = os.popen(
        "adb -s {0} shell getprop | grep ro.build.version.incremental".format(
##### initialization #####
globals().update(vars(get_args(sys.argv)))
args = {}
for entry in script_args:
	key, val = entry.split("=")
	args[key] = val
flash_files = args["flash_files"]

##### 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)()
	fastboot_steps.unlock_device(serial=serial)()
	fastboot_steps.command(command="oem fw-update m1:@0 > ./temp/files/temp.txt 2>&1", serial=serial)()
	return_result = fastboot_utils.fastboot_command_result(file_name="./temp/files/temp.txt")
	if not return_result: raise Exception("The test result did not achieve the desired results")
	fastboot_steps.lock_device(serial=serial)()

	check_point1 = False
	check_point2 = False
	check_point3 = False
	check_point4 = False
	check_point5 = False

	fastboot_utils.start_minicom(serial=serial)

	os.system("fastboot reboot > /dev/null 2>&1")
	time.sleep(120)
	fastboot_utils.to_fastboot_by_script(serial=serial)