Skip to content
Snippets Groups Projects
Commit 5aa5a9b0 authored by Tom Rini's avatar Tom Rini
Browse files
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
parents f432eb6d b6370aca
No related branches found
No related tags found
No related merge requests found
......@@ -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
# 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 ' \
......
......@@ -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)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment