diff options
author | Tom Rini <trini@konsulko.com> | 2022-03-28 12:36:49 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-03-28 12:36:49 -0400 |
commit | 34d2b7f20369d62c0f091d6572a8c0ea4655cf14 (patch) | |
tree | 0591ee99c118e0e196730b6ec6582986200e6313 /test | |
parent | 7f0826c169ff14d62e92d02f85d33d0030d45c12 (diff) | |
parent | e893e8ea6a5d3af312747d00f93587559193a426 (diff) | |
download | u-boot-34d2b7f20369d62c0f091d6572a8c0ea4655cf14.tar.gz |
Merge tag 'v2022.04-rc5' into next
Prepare v2022.04-rc5
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/k210_pll.c | 2 | ||||
-rw-r--r-- | test/py/tests/test_efi_bootmgr/conftest.py | 42 | ||||
-rw-r--r-- | test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py | 32 |
3 files changed, 75 insertions, 1 deletions
diff --git a/test/dm/k210_pll.c b/test/dm/k210_pll.c index f55379f3365..a0cc84c3961 100644 --- a/test/dm/k210_pll.c +++ b/test/dm/k210_pll.c @@ -7,7 +7,7 @@ /* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */ #include <div64.h> #include <dm/test.h> -#include <kendryte/pll.h> +#include <k210/pll.h> #include <test/ut.h> static int dm_test_k210_pll_calc_config(u32 rate, u32 rate_in, diff --git a/test/py/tests/test_efi_bootmgr/conftest.py b/test/py/tests/test_efi_bootmgr/conftest.py new file mode 100644 index 00000000000..69008fddce7 --- /dev/null +++ b/test/py/tests/test_efi_bootmgr/conftest.py @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0+ + +"""Fixture for UEFI bootmanager test +""" + +import os +import pytest +import shutil +from subprocess import call, check_call + +@pytest.fixture(scope='session') +def efi_bootmgr_data(u_boot_config): + """Set up a file system to be used in UEFI bootmanager + tests + + Args: + u_boot_config: U-boot configuration. + + Return: + A path to disk image to be used for testing + """ + mnt_point = u_boot_config.persistent_data_dir + '/test_efi_bootmgr' + image_path = u_boot_config.persistent_data_dir + '/efi_bootmgr.img' + + shutil.rmtree(mnt_point, ignore_errors=True) + os.mkdir(mnt_point, mode = 0o755) + + with open(mnt_point + '/initrd-1.img', 'w', encoding = 'ascii') as file: + file.write("initrd 1") + + with open(mnt_point + '/initrd-2.img', 'w', encoding = 'ascii') as file: + file.write("initrd 2") + + 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) + + yield 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 new file mode 100644 index 00000000000..f87e0a20b80 --- /dev/null +++ b/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0+ + +import pytest + +@pytest.mark.boardspec('sandbox') +@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)) + + u_boot_console.run_command(cmd = 'efidebug boot add ' \ + '-b 0001 label-1 host 0:1 initrddump.efi ' \ + '-i host 0:1 initrd-1.img -s nocolor') + u_boot_console.run_command(cmd = 'efidebug boot dump') + u_boot_console.run_command(cmd = 'efidebug boot order 0001') + u_boot_console.run_command(cmd = 'bootefi bootmgr') + response = u_boot_console.run_command(cmd = 'load', wait_for_echo=False) + assert 'crc32: 0x181464af' in response + u_boot_console.run_command(cmd = 'exit', wait_for_echo=False) + + u_boot_console.run_command(cmd = 'efidebug boot add ' \ + '-B 0002 label-2 host 0:1 initrddump.efi ' \ + '-I host 0:1 initrd-2.img -s nocolor') + u_boot_console.run_command(cmd = 'efidebug boot dump') + u_boot_console.run_command(cmd = 'efidebug boot order 0002') + u_boot_console.run_command(cmd = 'bootefi bootmgr') + response = u_boot_console.run_command(cmd = 'load', wait_for_echo=False) + assert 'crc32: 0x811d3515' in response + u_boot_console.run_command(cmd = 'exit', wait_for_echo=False) + + u_boot_console.run_command(cmd = 'efidebug boot rm 0001') + u_boot_console.run_command(cmd = 'efidebug boot rm 0002') |