test_ut: Drop exeception handling

We don't need the fallback anymore. As a first step to removing it,
drop the try...except clauses and unindent the code.

This produces a large diff but there are no other code changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2024-11-21 15:32:11 -07:00 committed by Tom Rini
parent 360315b360
commit 22eef59dd3

View file

@ -79,7 +79,6 @@ def setup_bootmenu_image(cons):
fname, mnt = setup_image(cons, mmc_dev, 0x83) fname, mnt = setup_image(cons, mmc_dev, 0x83)
complete = False complete = False
try:
script = '''# DO NOT EDIT THIS FILE script = '''# DO NOT EDIT THIS FILE
# #
# Please edit /boot/armbianEnv.txt to set supported parameters # Please edit /boot/armbianEnv.txt to set supported parameters
@ -188,9 +187,6 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
u_boot_utils.run_and_log(cons, f'mkfs.ext4 {fsfile} -d {mnt}') u_boot_utils.run_and_log(cons, f'mkfs.ext4 {fsfile} -d {mnt}')
u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1') u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1')
complete = True complete = True
except ValueError as exc:
print(f'Falled to create image, failing back to prepared copy: {exc}')
finally:
u_boot_utils.run_and_log(cons, f'rm -rf {mnt}') u_boot_utils.run_and_log(cons, f'rm -rf {mnt}')
u_boot_utils.run_and_log(cons, f'rm -f {fsfile}') u_boot_utils.run_and_log(cons, f'rm -f {fsfile}')
@ -203,7 +199,6 @@ def setup_bootflow_image(cons):
fname, mnt = setup_image(cons, mmc_dev, 0xc, second_part=True) fname, mnt = setup_image(cons, mmc_dev, 0xc, second_part=True)
complete = False complete = False
try:
vmlinux = 'vmlinuz-5.3.7-301.fc31.armv7hl' vmlinux = 'vmlinuz-5.3.7-301.fc31.armv7hl'
initrd = 'initramfs-5.3.7-301.fc31.armv7hl.img' initrd = 'initramfs-5.3.7-301.fc31.armv7hl.img'
dtbdir = 'dtb-5.3.7-301.fc31.armv7hl' dtbdir = 'dtb-5.3.7-301.fc31.armv7hl'
@ -248,9 +243,6 @@ label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
u_boot_utils.run_and_log(cons, ['sh', '-c', f'mcopy -i {fsfile} {mnt}/* ::/']) u_boot_utils.run_and_log(cons, ['sh', '-c', f'mcopy -i {fsfile} {mnt}/* ::/'])
u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1') u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1')
complete = True complete = True
except ValueError as exc:
print(f'Falled to create image, failing back to prepared copy: {exc}')
finally:
u_boot_utils.run_and_log(cons, f'rm -rf {mnt}') u_boot_utils.run_and_log(cons, f'rm -rf {mnt}')
u_boot_utils.run_and_log(cons, f'rm -f {fsfile}') u_boot_utils.run_and_log(cons, f'rm -f {fsfile}')
if not complete: if not complete:
@ -576,7 +568,6 @@ def setup_efi_image(cons):
basename=basename) basename=basename)
complete = False complete = False
try:
efi_dir = os.path.join(mnt, 'EFI') efi_dir = os.path.join(mnt, 'EFI')
mkdir_cond(efi_dir) mkdir_cond(efi_dir)
bootdir = os.path.join(efi_dir, 'BOOT') bootdir = os.path.join(efi_dir, 'BOOT')
@ -593,10 +584,6 @@ def setup_efi_image(cons):
u_boot_utils.run_and_log(cons, ['sh', '-c', f'mcopy -vs -i {fsfile} {mnt}/* ::/']) u_boot_utils.run_and_log(cons, ['sh', '-c', f'mcopy -vs -i {fsfile} {mnt}/* ::/'])
u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1') u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1')
complete = True complete = True
except ValueError as exc:
print(f'Falled to create image, failing back to prepared copy: {exc}')
finally:
u_boot_utils.run_and_log(cons, f'rm -rf {mnt}') u_boot_utils.run_and_log(cons, f'rm -rf {mnt}')
u_boot_utils.run_and_log(cons, f'rm -f {fsfile}') u_boot_utils.run_and_log(cons, f'rm -f {fsfile}')