##### 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"] partition_name = args["partition_name"] file_name = args["file_name"] ##### test start ##### try: os.system("mkdir -p ./temp/files/flash ./temp/image/n") fastboot_utils.download_flash_scripts() fastboot_utils.unpack_the_zip(file_name=flash_files, temp_path=r"./temp/image/n/flashfiles") os.system("echo \"corrupt\" > ./temp/files/corrupt.txt") fastboot_steps.flash_wrong_file(partition_name=partition_name, file_name="./temp/files/corrupt.txt", serial=serial)() fastboot_steps.flash_right_file(partition_name=partition_name, file_name=file_name, 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 #####
eb_userdebug_patch_flashfiles_zip_name, serial=serial) flashfiles_type = "user" 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) 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))
flash_image_script_path = config.get("files", "flash_image_script") flash_image_script_name = flash_image_script_path.split("/")[-1] fastboot_utils.download_file(url=security_path + flash_image_script_path, local_filename="./temp/files/" + flash_image_script_name) tipc_file_path = config.get("tipc", "file_path") tipc_file_name = tipc_file_path.split("/")[-1] fastboot_utils.download_file(url=security_path + tipc_file_path, local_filename="./temp/tipc/" + tipc_file_name) tipc_zip_path = config.get("tipc", "zip_path") tipc_zip_name = tipc_zip_path.split("/")[-1] fastboot_utils.download_file(url=security_path + tipc_zip_path, local_filename="./temp/tipc/" + tipc_zip_name) fastboot_utils.unpack_the_zip(file_name=flash_files, temp_path=r"./temp/new_image") fastboot_utils.unpack_the_zip(file_name="./temp/tipc/" + tipc_zip_name, temp_path=r"./temp/tipc") os.system( "sudo python ./temp/files/flash_image.py --bin ./temp/tipc/ifwi_gr_mrb_b1.bin --zip ./temp/tipc/" + tipc_zip_name) time.sleep(60) local_steps.wait_for_adb(timeout=300, serial=serial)() os.system("sudo chmod 777 ./temp/tipc/" + tipc_file_name) adb_steps.root_connect_device(serial=serial)() time.sleep(5) adb_steps.push_file(local="./temp/tipc/" + tipc_file_name, remote="/data/", serial=serial)()
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 if not test_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")
os.system("mkdir -p ./temp/files/flash ./temp/files/resources") conf_url = "https://shstor001.sh.intel.com/artifactory/acs_test_artifacts/OTC_Android_Auto_Test_Suite/resources/EBImage/System_FastBoot/fastboot.conf" fastboot_utils.download_file(url=conf_url, local_filename="./temp/fastboot.conf") config = ConfigParser.ConfigParser() config.read("./temp/fastboot.conf") fastboot_path = config.get("fastboot", "path") simg2img_zip_path = config.get("files", "simg2img_zip") simg2img_zip_name = simg2img_zip_path.split("/")[-1] fastboot_utils.download_file(url=fastboot_path + simg2img_zip_path, local_filename="./temp/files/resources/" + simg2img_zip_name) 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)()
flash_image_script_name = flash_image_script_path.split("/")[-1] fastboot_utils.download_file(url=security_path + flash_image_script_path, local_filename="./temp/files/" + flash_image_script_name) negative_file_path = config.get("negative", "file_path") negative_file_name = negative_file_path.split("/")[-1] fastboot_utils.download_file(url=security_path + negative_file_path, local_filename="./temp/negative/" + negative_file_name) negative_zip_path = config.get("negative", "zip_path") negative_zip_name = negative_zip_path.split("/")[-1] fastboot_utils.download_file(url=security_path + negative_zip_path, local_filename="./temp/negative/" + negative_zip_name) fastboot_utils.unpack_the_zip(file_name=flash_files, temp_path=r"./temp/new_image") fastboot_utils.unpack_the_zip(file_name="./temp/negative/" + negative_zip_name, temp_path=r"./temp/negative") os.system( "sudo python ./temp/files/flash_image.py --bin ./temp/negative/ifwi_gr_mrb_b1.bin --zip ./temp/negative/" + negative_zip_name) time.sleep(60) local_steps.wait_for_adb(timeout=300, serial=serial)() os.system("sudo chmod 777 ./temp/negative/" + negative_file_name) adb_steps.root_connect_device(serial=serial)() time.sleep(5) adb_steps.push_file(local="./temp/negative/" + negative_file_name, remote="/data/",