Exemple #1
0
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:
    fastboot_utils.push_uiautomator_jar(serial=serial)
    fastboot_steps.config_first_boot_wizard(serial=serial)()

    os.system("mkdir -p ./temp/files/flash")
    fastboot_utils.creat_big_file("./temp/files/temp.txt", 0.1)
    os.system("adb push ./temp/files/temp.txt /data")

    fastboot_steps.factory_data_reset(serial=serial)()

    file_exists = fastboot_utils.adb_command_file_or_directory_exists(
        name="temp.txt", command="adb shell ls /data")
    if file_exists:
        raise Exception("The test result did not achieve the desired results")

    os.system("sudo rm -rf ./temp")

except:
    fastboot_utils.download_flash_scripts()
    fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial)
    os.system("sudo rm -rf ./temp")
    raise
##### test end #####
Exemple #2
0
            eb_user_patch_flashfiles_zip_name=eb_user_patch_flashfiles_zip_name,
            eb_userdebug_patch_flashfiles_zip_name=
            eb_userdebug_patch_flashfiles_zip_name,
            serial=serial)
    if platform_name == "gordon_peak":
        zip_name = fastboot_utils.get_zip_name(zip_path=flash_files)
        if zip_name == "r0_bxtp_abl":
            fastboot_utils.flash_bxt_m_fused(
                eb_user_patch_flashfiles_zip_name=
                eb_user_patch_flashfiles_zip_name,
                eb_userdebug_patch_flashfiles_zip_name=
                eb_userdebug_patch_flashfiles_zip_name,
                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:
flash_files = args["flash_files"]

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

    adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)()
    fastboot_steps.corrupt_esp_partition(unlock_dut=True,
                                         lock_dut=False,
                                         reboot=False,
                                         serial=serial)()
    fastboot_utils.flash_bxt(flash_ioc="True",
                             flash_ifwi="True",
                             flash_android="False",
                             zip_file=flash_files,
                             serial=serial,
                             sleep_time=60,
                             wait_for_adb=False)

    if serial in local_utils.get_connected_android_devices()['android']:
        raise Exception("The test result did not achieve the desired results")

    fastboot_utils.to_fastboot_by_script(serial=serial)
    local_steps.wait_for_fastboot(timeout=300, serial=serial)()
    os.system("fastboot reboot > /dev/null 2>&1")
    time.sleep(60)

    if serial not in local_utils.get_connected_android_devices()['fastboot']:
        raise Exception("The test result did not achieve the desired results")
        zip_name = fastboot_utils.get_zip_name(zip_path=flash_files)
        if zip_name == "r0_bxtp_abl":
            fastboot_utils.flash_bxt_m_fused(
                eb_user_patch_flashfiles_zip_name=
                eb_user_patch_flashfiles_zip_name,
                eb_userdebug_patch_flashfiles_zip_name=
                eb_userdebug_patch_flashfiles_zip_name,
                serial=serial)
            flashfiles_type = "user"
        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"

    fastboot_utils.unpack_the_zip(file_name=flash_files,
                                  temp_path=r"./temp/image/n/flashfiles")
    os.system(
        "cp -f ./temp/image/n/flashfiles/ifwi_gr_mrb_b1.bin ./temp/image/eb/{0}/flashfiles"
        .format(flashfiles_type))
    os.system(
        "sed -i \"s/Auto IFWI recovery flow/auto WIIF recovery flow/\" ./temp/image/eb/{0}/flashfiles/ifwi_gr_mrb_b1.bin"
        .format(flashfiles_type))

    test_result = False
    diff_cmd = "diff ./temp/image/n/flashfiles/ifwi_gr_mrb_b1.bin ./temp/image/eb/{0}/flashfiles/ifwi_gr_mrb_b1.bin".format(
        flashfiles_type)
	config = ConfigParser.ConfigParser()
	config.read("./temp/fastboot.conf")
	fastboot_path = config.get("fastboot", "path")

	platform_name = fastboot_utils.get_platform_name(serial=serial)
	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_1_flashfiles_zip_path = config.get(image_platform, "n_1_flashfiles_zip")
	n_1_flashfiles_zip_name = n_1_flashfiles_zip_path.split("/")[-1]
	fastboot_utils.download_file(url = fastboot_path + n_1_flashfiles_zip_path, local_filename = "./temp/image/n-1/" + n_1_flashfiles_zip_name)

	fastboot_utils.flash_bxt(zip_file="./temp/image/n-1/"+n_1_flashfiles_zip_name, serial=serial)

	fastboot_utils.unpack_the_zip(file_name = flash_files, temp_path = r"./temp/image/n/flashfiles")
	adb_steps.reboot(command = "fastboot", reboot_timeout = 300, serial = serial)()
	fastboot_steps.flash_image(partition_name = partition_name, file_name = "./temp/image/n/flashfiles/"+file_name, serial = serial)()
	fastboot_steps.continue_to_adb(serial=serial)()
	time.sleep(60)
	local_steps.wait_for_adb(timeout = 300, serial=serial)()

	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")
	raise