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") 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 ##### test end #####
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") raise ##### test end #####
serial=serial)() fastboot_steps.command(command="flash {0} ./temp/image/eb/{3}/flashfiles/{1} > ./temp/files/{2}.txt 2>&1"\ .format("bootloader", "bootloader_gr_mrb_b1", "flash_bootloader_result", flashfiles_type), serial=serial)() fastboot_steps.command(command="flash {0} ./temp/image/eb/{3}/flashfiles/{1} > ./temp/files/{2}.txt 2>&1"\ .format("multiboot", "multiboot.img", "flash_multiboot_result", flashfiles_type), serial=serial)() fastboot_steps.command(command="flash {0} ./temp/image/eb/{3}/flashfiles/{1} > ./temp/files/{2}.txt 2>&1"\ .format("tos", "tos.img", "flash_tos_result", flashfiles_type), serial=serial)() fastboot_steps.command(command="flash {0} ./temp/image/eb/{3}/flashfiles/{1} > ./temp/files/{2}.txt 2>&1"\ .format("vendor", "vendor.img", "flash_vendor_result", flashfiles_type), serial=serial)() fastboot_steps.command(command="flash {0} ./temp/image/eb/{3}/flashfiles/{1} > ./temp/files/{2}.txt 2>&1"\ .format("boot", "boot.img", "flash_boot_result", flashfiles_type), serial=serial)() fastboot_steps.command(command="flash {0} ./temp/image/eb/{3}/flashfiles/{1} > ./temp/files/{2}.txt 2>&1"\ .format("system", "system.img", "flash_system_result", flashfiles_type), serial=serial)() if zip_name == "r0_bxtp_abl": unlock_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/unlock_result.txt") flash_gpt_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/flash_gpt_result.txt") erase_teedata_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/erase_teedata_result.txt") erase_misc_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/erase_misc_result.txt") erase_persistent_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/erase_persistent_result.txt") erase_metadata_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/erase_metadata_result.txt") format_config_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/format_config_result.txt") format_data_result = fastboot_utils.fastboot_command_result( file_name="./temp/files/format_data_result.txt") flash_bootloader_result = fastboot_utils.fastboot_command_result(
n_img_zip_name) n_ota_zip_path = config.get(image_platform, "n_ota_zip") n_ota_zip_name = n_ota_zip_path.split("/")[-1] fastboot_utils.download_file(url=fastboot_path + n_ota_zip_path, local_filename="./temp/image/n/" + n_ota_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/update_img_result.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/update_img_result.txt") if not return_result: raise Exception("The test result did not achieve the desired results") fastboot_utils.unpack_the_zip(file_name="./temp/image/n/" + n_ota_zip_name, temp_path=r"./temp/image/n/ota") os.system("chmod 755 ./temp/image/n/ota/verify/fastboot") os.system("chmod 755 ./temp/image/n/ota/verify/verify_from_ota") adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() test_result = False os.chdir("./temp/image/n/ota/verify") return_result = os.popen("python ./verify_from_ota").readlines() os.chdir("../../../../..") for line in return_result: if "All tests completed successfully" in line: test_result = True