diff options
| author | Tom Rini <[email protected]> | 2022-03-31 22:35:34 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2022-03-31 22:35:34 -0400 |
| commit | 5aa5a9b0d249923d966ea08c58354f86a23a882a (patch) | |
| tree | 707274d1402e53f85c302cca7b7654efe72cbcc2 /test | |
| parent | f432eb6d8a9d8a9382f6e7f0096fb4ee4672b8e8 (diff) | |
| parent | b6370aca3709ef23a9e8fe556beaa2e4b4e089c3 (diff) | |
Merge tag 'efi-2022-04-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2022-04-rc6
Documentation:
* Move VxWorks and Plan 9 to HTML documentation
* Move all command man-pages to a separate directory
Test:
* Fix pylint errors
UEFI
* Fix build flags for initrddump.efi
QEMU
* Remove unused function to get RNG device
Diffstat (limited to 'test')
| -rw-r--r-- | test/py/tests/test_efi_bootmgr/conftest.py | 14 | ||||
| -rw-r--r-- | test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py | 13 | ||||
| -rw-r--r-- | test/py/tests/test_efi_fit.py | 31 |
3 files changed, 34 insertions, 24 deletions
diff --git a/test/py/tests/test_efi_bootmgr/conftest.py b/test/py/tests/test_efi_bootmgr/conftest.py index 69008fddce7..a0a754afbe1 100644 --- a/test/py/tests/test_efi_bootmgr/conftest.py +++ b/test/py/tests/test_efi_bootmgr/conftest.py @@ -4,9 +4,9 @@ """ import os -import pytest import shutil -from subprocess import call, check_call +from subprocess import check_call +import pytest @pytest.fixture(scope='session') def efi_bootmgr_data(u_boot_config): @@ -14,7 +14,7 @@ def efi_bootmgr_data(u_boot_config): tests Args: - u_boot_config: U-boot configuration. + u_boot_config -- U-boot configuration. Return: A path to disk image to be used for testing @@ -34,9 +34,7 @@ def efi_bootmgr_data(u_boot_config): shutil.copyfile(u_boot_config.build_dir + '/lib/efi_loader/initrddump.efi', mnt_point + '/initrddump.efi') - check_call('virt-make-fs --partition=gpt --size=+1M --type=vfat {} {}' - .format(mnt_point, image_path), shell=True) - - print(image_path) + check_call(f'virt-make-fs --partition=gpt --size=+1M --type=vfat {mnt_point} {image_path}', + shell=True) - yield image_path + return image_path diff --git a/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py b/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py index f87e0a20b80..75a6e7c9629 100644 --- a/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py +++ b/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py @@ -1,4 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ +""" Unit test for UEFI bootmanager +""" import pytest @@ -6,7 +8,16 @@ import pytest @pytest.mark.buildconfigspec('cmd_efidebug') @pytest.mark.buildconfigspec('cmd_bootefi_bootmgr') def test_efi_bootmgr(u_boot_console, efi_bootmgr_data): - u_boot_console.run_command(cmd = 'host bind 0 {}'.format(efi_bootmgr_data)) + """ Unit test for UEFI bootmanager + The efidebug command is used to set up UEFI load options. + The bootefi bootmgr loads initrddump.efi as a payload. + The crc32 of the loaded initrd.img is checked + + Args: + u_boot_console -- U-Boot console + efi_bootmgr_data -- Path to the disk image used for testing. + """ + u_boot_console.run_command(cmd = f'host bind 0 {efi_bootmgr_data}') u_boot_console.run_command(cmd = 'efidebug boot add ' \ '-b 0001 label-1 host 0:1 initrddump.efi ' \ diff --git a/test/py/tests/test_efi_fit.py b/test/py/tests/test_efi_fit.py index 068a35a559d..92d071f7839 100644 --- a/test/py/tests/test_efi_fit.py +++ b/test/py/tests/test_efi_fit.py @@ -203,7 +203,7 @@ def test_efi_fit_launch(u_boot_console): """Compute the path of a given (temporary) file. Args: - file_name: The name of a file within U-Boot build dir. + file_name -- The name of a file within U-Boot build dir. Return: The computed file path. """ @@ -217,8 +217,8 @@ def test_efi_fit_launch(u_boot_console): build dir and, optionally, compresses the file using gzip. Args: - fname: The target file name within U-Boot build dir. - comp: Flag to enable gzip compression. + fname -- The target file name within U-Boot build dir. + comp -- Flag to enable gzip compression. Return: The path of the created file. """ @@ -238,8 +238,8 @@ def test_efi_fit_launch(u_boot_console): Creates a DTS file and compiles it to a DTB. Args: - fdt_type: The type of the FDT, i.e. internal, user. - comp: Flag to enable gzip compression. + fdt_type -- The type of the FDT, i.e. internal, user. + comp -- Flag to enable gzip compression. Return: The path of the created file. """ @@ -252,7 +252,7 @@ def test_efi_fit_launch(u_boot_console): # Generate a test FDT file. dts = make_fpath('test-efi-fit-%s.dts' % fdt_type) - with open(dts, 'w') as file: + with open(dts, 'w', encoding='ascii') as file: file.write(FDT_DATA % fdt_params) # Build the test FDT. @@ -268,7 +268,7 @@ def test_efi_fit_launch(u_boot_console): Runs 'mkimage' to create a FIT image within U-Boot build dir. Args: - comp: Enable gzip compression for the EFI binary and FDT blob. + comp -- Enable gzip compression for the EFI binary and FDT blob. Return: The path of the created file. """ @@ -285,7 +285,7 @@ def test_efi_fit_launch(u_boot_console): # Generate a test ITS file. its_path = make_fpath('test-efi-fit-helloworld.its') - with open(its_path, 'w') as file: + with open(its_path, 'w', encoding='ascii') as file: file.write(ITS_DATA % its_params) # Build the test ITS. @@ -298,8 +298,9 @@ def test_efi_fit_launch(u_boot_console): """Load the FIT image using the 'host load' command and return its address. Args: - fit: Dictionary describing the FIT image to load, see env__efi_fit_test_file - in the comment at the beginning of this file. + fit -- Dictionary describing the FIT image to load, see + env__efi_fit_test_file in the comment at the beginning of + this file. Return: The address where the file has been loaded. """ @@ -325,8 +326,8 @@ def test_efi_fit_launch(u_boot_console): CRC32 are validated. Args: - fit: Dictionary describing the FIT image to load, see env__efi_fit_tftp_file - in the comment at the beginning of this file. + fit -- Dictionary describing the FIT image to load, see env__efi_fit_tftp_file + in the comment at the beginning of this file. Return: The address where the file has been loaded. """ @@ -377,9 +378,9 @@ def test_efi_fit_launch(u_boot_console): Eventually the 'Hello, world' message is expected in the U-Boot console. Args: - enable_fdt: Flag to enable using the FDT blob inside FIT image. - enable_comp: Flag to enable GZIP compression on EFI and FDT - generated content. + enable_fdt -- Flag to enable using the FDT blob inside FIT image. + enable_comp -- Flag to enable GZIP compression on EFI and FDT + generated content. """ with cons.log.section('FDT=%s;COMP=%s' % (enable_fdt, enable_comp)): |
