summaryrefslogtreecommitdiff
path: root/test/py/tests/test_efi_capsule/capsule_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/py/tests/test_efi_capsule/capsule_common.py')
-rw-r--r--test/py/tests/test_efi_capsule/capsule_common.py60
1 files changed, 30 insertions, 30 deletions
diff --git a/test/py/tests/test_efi_capsule/capsule_common.py b/test/py/tests/test_efi_capsule/capsule_common.py
index fc0d851c619..40b3fca809e 100644
--- a/test/py/tests/test_efi_capsule/capsule_common.py
+++ b/test/py/tests/test_efi_capsule/capsule_common.py
@@ -6,15 +6,15 @@
from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR
-def capsule_setup(u_boot_console, disk_img, osindications):
+def capsule_setup(ubman, disk_img, osindications):
"""setup the test
Args:
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
disk_img -- A path to disk image to be used for testing.
osindications -- String of osindications value.
"""
- u_boot_console.run_command_list([
+ ubman.run_command_list([
f'host bind 0 {disk_img}',
'printenv -e PlatformLangCodes', # workaround for terminal size determination
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi',
@@ -23,22 +23,22 @@ def capsule_setup(u_boot_console, disk_img, osindications):
'u-boot-env raw 0x150000 0x200000"'])
if osindications is None:
- u_boot_console.run_command('env set -e OsIndications')
+ ubman.run_command('env set -e OsIndications')
else:
- u_boot_console.run_command(f'env set -e -nv -bs -rt OsIndications ={osindications}')
+ ubman.run_command(f'env set -e -nv -bs -rt OsIndications ={osindications}')
- u_boot_console.run_command('env save')
+ ubman.run_command('env save')
-def init_content(u_boot_console, target, filename, expected):
+def init_content(ubman, target, filename, expected):
"""initialize test content
Args:
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
target -- Target address to place the content.
filename -- File name of the content.
expected -- Expected string of the content.
"""
- output = u_boot_console.run_command_list([
+ output = ubman.run_command_list([
'sf probe 0:0',
f'fatload host 0:1 4000000 {CAPSULE_DATA_DIR}/{filename}',
f'sf write 4000000 {target} 10',
@@ -46,34 +46,34 @@ def init_content(u_boot_console, target, filename, expected):
'md.b 5000000 10'])
assert expected in ''.join(output)
-def place_capsule_file(u_boot_console, filenames):
+def place_capsule_file(ubman, filenames):
"""place the capsule file
Args:
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
filenames -- File name array of the target capsule files.
"""
for name in filenames:
- u_boot_console.run_command_list([
+ ubman.run_command_list([
f'fatload host 0:1 4000000 {CAPSULE_DATA_DIR}/{name}',
f'fatwrite host 0:1 4000000 {CAPSULE_INSTALL_DIR}/{name} $filesize'])
- output = u_boot_console.run_command(f'fatls host 0:1 {CAPSULE_INSTALL_DIR}')
+ output = ubman.run_command(f'fatls host 0:1 {CAPSULE_INSTALL_DIR}')
for name in filenames:
assert name in ''.join(output)
-def exec_manual_update(u_boot_console, disk_img, filenames, need_reboot = True):
+def exec_manual_update(ubman, disk_img, filenames, need_reboot = True):
"""execute capsule update manually
Args:
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
disk_img -- A path to disk image to be used for testing.
filenames -- File name array of the target capsule files.
need_reboot -- Flag indicates whether system reboot is required.
"""
# make sure that dfu_alt_info exists even persistent variables
# are not available.
- output = u_boot_console.run_command_list([
+ output = ubman.run_command_list([
'env set dfu_alt_info '
'"sf 0:0=u-boot-bin raw 0x100000 0x50000;'
'u-boot-env raw 0x150000 0x200000"',
@@ -83,60 +83,60 @@ def exec_manual_update(u_boot_console, disk_img, filenames, need_reboot = True):
assert name in ''.join(output)
# need to run uefi command to initiate capsule handling
- u_boot_console.run_command(
+ ubman.run_command(
'env print -e Capsule0000', wait_for_reboot = need_reboot)
-def check_file_removed(u_boot_console, disk_img, filenames):
+def check_file_removed(ubman, disk_img, filenames):
"""check files are removed
Args:
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
disk_img -- A path to disk image to be used for testing.
filenames -- File name array of the target capsule files.
"""
- output = u_boot_console.run_command_list([
+ output = ubman.run_command_list([
f'host bind 0 {disk_img}',
f'fatls host 0:1 {CAPSULE_INSTALL_DIR}'])
for name in filenames:
assert name not in ''.join(output)
-def check_file_exist(u_boot_console, disk_img, filenames):
+def check_file_exist(ubman, disk_img, filenames):
"""check files exist
Args:
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
disk_img -- A path to disk image to be used for testing.
filenames -- File name array of the target capsule files.
"""
- output = u_boot_console.run_command_list([
+ output = ubman.run_command_list([
f'host bind 0 {disk_img}',
f'fatls host 0:1 {CAPSULE_INSTALL_DIR}'])
for name in filenames:
assert name in ''.join(output)
-def verify_content(u_boot_console, target, expected):
+def verify_content(ubman, target, expected):
"""verify the content
Args:
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
target -- Target address to verify.
expected -- Expected string of the content.
"""
- output = u_boot_console.run_command_list([
+ output = ubman.run_command_list([
'sf probe 0:0',
f'sf read 4000000 {target} 10',
'md.b 4000000 10'])
assert expected in ''.join(output)
-def do_reboot_dtb_specified(u_boot_config, u_boot_console, dtb_filename):
+def do_reboot_dtb_specified(u_boot_config, ubman, dtb_filename):
"""do reboot with specified DTB
Args:
u_boot_config -- U-boot configuration.
- u_boot_console -- A console connection to U-Boot.
+ ubman -- A console connection to U-Boot.
dtb_filename -- DTB file name.
"""
mnt_point = u_boot_config.persistent_data_dir + '/test_efi_capsule'
- u_boot_console.config.dtb = mnt_point + CAPSULE_DATA_DIR \
+ ubman.config.dtb = mnt_point + CAPSULE_DATA_DIR \
+ f'/{dtb_filename}'
- u_boot_console.restart_uboot()
+ ubman.restart_uboot()