Commit Graph

73 Commits

Author SHA1 Message Date
Simon Glass
caa5edc39c test: Add mmc13 and mmc14 devices for TKey and pre-derived
Add two new MMC test devices:

- mmc13: LUKS2 encrypted with TKey-derived key, for testing TKey-based
  disk encryption unlock
- mmc14: LUKS2 encrypted with a known master key, for testing the
  pre-derived master key unlock path

The test setup generates keys matching the TKey emulator's deterministic
output. An override.bin file can be used to test with a physical TKey.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-08 05:22:18 -07:00
Simon Glass
b2e53c814d test: Switch mmc12 over to use argon2id
Use the more common argon2id algorithm for this disk so that we can test
the implementation.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-11 04:16:42 -07:00
Simon Glass
eb2ae89f55 luks: Create a disk image with LUKS2 encryption
Add a new mmc12 image which has a LUKS2-encrypted ext4 partition.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-24 21:02:11 +01:00
Simon Glass
8863215954 test/py: Set up an Ubuntu image with space for FDE
Update one of the Ubuntu images to provide space for using full-disk
encryption.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-24 08:47:38 +01:00
Simon Glass
d6e71fafcd boot: test: Add another Ubuntu image on mmc11
Bring in a test image which has a different version of Ubuntu.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-18 09:38:25 +01:00
Simon Glass
b351843588 test: Move localboot image-creation to its own file
Move setup_localboot_image() to a new module

Series-to: concept
Cover-letter:
test: Split up the image-creation code
This series moves the image-creation code into separate files so it is
easier to find and maintain.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
91d376de6e test: Move the configuration-editor setup to its own file
Move setup_cedit_file() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
8270d6d201 test: Move EFI image-creation to its own file
Move setup_efi_image() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
b20c043f8b test: Move Android image-creation to its own file
Move setup_android_image() function to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
c1d531e19c test: Move ChromeOS image-creation to its own file
Move setup_cros_image() to its own module. This function creates disk
images with a ChromiumOS partition layout.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
6543dc4540 test: Move Armbian image-creation to its own file
Move setup_bootmenu_image() to its own module. This function creates an
image styled on Armbian 22.08 Jammy with a boot menu.

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
0d29222435 test: Move Ubuntu image-creation to its own file
Move setup_ubuntu_image() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
b3596d6474 test: Move Fedora image-creation to its own file
Move setup_fedora_image() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
ceb47ebdd4 test: Create a common file for image utilities
Move mkdir_cond(), copy_partition(), and setup_extlinux_image() to a
common module which can be used by the rest of the image-creation code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
a2b4596ccf test/py: Update test_ut_dm_init_bootstd() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Series-to: concept
Cover-letter:
test: Move towards using a fixture for test images
There are quite a few test images created by the test system. Most are
needed for bootstd tests.

At present these are created by a test, called test_ut_dm_init_bootstd()
which runs before the test_ut() tests.

This means that it is possible to create the images once, then iterate
on a test without the images being recreated each time.

While this is not a terrible approach, it does have some drawbacks:

- If an image is missing or corrupted for some reason, the test fails
- The relationship between the images and the tests is not obvious
- Images are often created even if the tests to be run do not need them

Overall, it seems worthwhile to explore moving to using a fixture for
the images.

Another problem is that 'make qcheck' and 'make pcheck' are not tested
in CI, so can break over time. The latter is a good way of seeing
whether each test is independent, e.g. not reliant on files created by
another test.

Overall this area of U-Boot could use some attention. This series makes
a very small start on this:

- Update test_fdt_add_pubkey() to work without test_vboot_base()
- Fix 'make qcheck' so that it passes
- Minor fixes to a few tests
- Pass separate fixtures to the image-setup functions instead of the
  overall ubman fixture
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:10:27 -06:00
Simon Glass
b667fd9e0c test/py: Update setup_vbe_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:10:26 -06:00
Simon Glass
eafa440c59 test/py: Update setup_localboot_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
71cd1eddea test/py: Update setup_cedit_file() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
9bec0b3fad test/py: Update setup_efi_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
6665d9fa38 test/py: Update setup_android_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
e6dde985e6 test/py: Update setup_cros_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
da2c60ff34 test/py: Update setup_ubuntu_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
f4b979eae4 test/py: Update setup_fedora_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
13c72bfea0 test/py: Update setup_extlinux_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
f03a3b2c37 test/py: Update setup_bootmenu_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
07f5b96985 boot: test: Add a test for the VBE OS flow
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.

Most of the test is in C, with just the image-setup done in Python.

Enable the test for non-SPL sandbox builds.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-04 14:40:00 -06:00
Simon Glass
684fc8c4d7 Revert "Merge branch 'loadg' into 'master'"
This reverts merge request !141
2025-08-02 19:50:30 +00:00
Simon Glass
3c2f152a9b boot: test: Add a test for the VBE OS flow
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.

Most of the test is in C, with just the image-setup done in Python.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:31:52 -06:00
Simon Glass
7a37413818 pxe_utils: Support the SAY command
This shows a message for the user. Implement it to keep the user
informed.

Series-to: u-boot
pxe: Support an automatic localboot
It seems that extlinux expects that boards know how to boot a local OS
from attached media. U-Boot currently assumes that boards define a
"localcmd" environment variable to support this. None does.

Provide an automatic means to find a kernel and ramdisk, using common
filenames. This addresses booting on MAAS, at least.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-07-30 15:01:52 +12:00
Simon Glass
de881bfad7 pxe_utils: Support a backup for localboot
The current localboot implementation assumes that a 'localcmd'
environment variable is provided, with the instructions to follow. This
may not be included, so provide a fallback in that case.

Add a test image and test as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 15:00:59 +12:00
Simon Glass
110c2cdd45 text: Rename setup_bootflow_image()
The name of this is fairly vague. Use 'extlinux' so that it is clear
that it relates to that format.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 14:59:25 +12:00
Simon Glass
7188be8a76 test: Convert test_ut_dm_init() to use FsHelper
Use the helper here, for consistency.

Series-to: concept, heinrich
Cover-letter:
test: Create a better helper for filesystems
This series includes a few new helpers which make it easier to create
filesystems and disk images for testing.

The current approach requires the caller to create a temporary
directory, put files in there, then call the helper. It has poor support
for building disks containing multiple partitions.

This new helper works by creating a temporary directory which the caller
can use, then creating the filesystem and cleaning up.

Most of U-Boot is moved over to use these new helpers, but two EFI tests
are left alone, since they don't currently pass:

   - test_efi_eficonfig() has a 'return' in it, so doesn't run
   - TestEfiCapsuleFirmwareFit is skipped due to a failure at the start

These can be moved over later when they are working.

This series also includes a few quirks to the VBE tests.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:27 +12:00
Simon Glass
00cdb3abc5 test: Convert setup_efi_image() to use FsHelper
Simplify this test-setup code by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:18 +12:00
Simon Glass
2cc670ad29 test: Convert setup_bootflow_image() to use FsHelper
Simplify this test-setup code by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:18 +12:00
Simon Glass
525c6301eb test: Convert setup_bootmenu_image() to use FsHelper
Simplify this test-setup code by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:18 +12:00
Simon Glass
c10e4fe841 test/py: Add an extlinux file similar to Ubuntu
Add an extlinux configuration-file that contains a few entries as
created by the u-boot-menu package in Ubuntu 24.04

Increase the number of sandbox-USB-hub ports to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:32 -06:00
Simon Glass
2cc7b0e2b9 test/py: Split out core of Fedora image into a new function
To permit easier adding of other images, move the Fedora-specific
portions of setup_bootflow_image() into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:32 -06:00
Tom Rini
cc0530192a test/py/tests: Move "setup_image" from test_ut.py to fs_helper.py
The generic function in test_ut.py to create a disk image with partition
table can be useful outside of test_ut.py so move it to be available
more clearly.

To make this a bit more easily used library function, make use of
check_call directly rather than calling things though u_boot_utils. In
turn, to more easily handle stdin here, use the shell "printf" utility
to pass sfdisk the specification to create as we do not have an actual
file descriptor to use here.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-01 05:56:49 -06:00
Simon Glass
a9405c4b9d test/py: Correct sizing of created disks
At present the disks end up being 1MB shorter than they should be,
since dd truncates by default.

Move the code into a function and update it to avoid truncation.

This resolves various warnings when running sandbox tests, of the form:

   mmc_bread() MMC: block number 0x9801 exceeds max(0x9800)

caused by the FAT partition being scanning.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-15 08:49:43 +00:00
Simon Glass
8cb42bb814 test/py: Drop assigning ubman to cons
Now that we have a shorter name, we don't need this sort of thing. Just
use ubman instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-16 17:30:53 -07:00
Simon Glass
d428226459 test/py: Drop u_boot_ prefix on test files
We know this is U-Boot so the prefix serves no purpose other than to
make things longer and harder to read. Drop it and rename the files.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # test_android / test_dfu
2025-02-16 17:30:53 -07:00
Simon Glass
aa677583d3 test/py: Shorten u_boot_console
This fixture name is quite long and results in lots of verbose code.
We know this is U-Boot so the 'u_boot_' part is not necessary.

But it is also a bit of a misnomer, since it provides access to all the
information available to tests. It is not just the console.

It would be too confusing to use con as it would be confused with
config and it is probably too short.

So shorten it to 'ubman'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/u-boot/CAFLszTgPa4aT_J9h9pqeTtLCVn4x2JvLWRcWRD8NaN3uoSAtyA@mail.gmail.com/
2025-02-16 17:30:53 -07:00
Simon Glass
f86e5ab18d test: Move stat-printing into its own function
Add a function to show the stats, so we can decide when to print it.

This slightly adjusts the output, so that any 'test not found' message
appears on its own line after all other output.

The 'failures' message now appears in lower case so update pytest
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-08 13:50:15 +00:00
Simon Glass
24759ea29e test_ut: Drop support for fallback files
We don't need the fallback anymore. Remove the code which uses these
files.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
2024-12-19 17:33:35 -07:00
Simon Glass
c6c9649468 test_ut: Use the built mkimage
The mkimage tool is not present in the docker image. Use the one in the
build directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-12-19 17:33:33 -07:00
Simon Glass
7fae452d49 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>
2024-12-19 17:33:33 -07:00
Richard Weinberger
362fe5e191 test_ut: Allow running unprivileged
Like for test_fs, no need to mess with loop mounts.

Tweaks to reduce diff (keep mnt variable):

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Simon Glass <sjg@chromium.org>
2024-12-19 17:33:31 -07:00
Simon Glass
6b0714294a test_ut: Add an image size to setup_image()
Add a parameter to indicate the size of the image to build.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
2024-12-19 17:33:30 -07:00
Richard Weinberger
b1d79c64ce test_fs: Allow running unprivileged
There is no need to mount the filesystem on the host side.
All filesystem tools offer some way to fill the fs without mounting.

So, create the content on the host side, create and fill the fs
without mounting.
No more sudo or guestmount needed.

This new approach works because the tests don't care about user IDs
and no device files are needed.
If user IDs start to matter it's still possible to use wrapper
tools like fakeroot in future while filling the fs.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-12-19 17:33:27 -07:00
Simon Glass
ab0887ffdf bootstd: Add a simple command to list images
Add a new 'bootstd images' command, which lists the images which have
been loaded.

Update some existing tests to use it. Provide some documentation about
images in general and this command in particular.

Use a more realistic kernel command-line to make the test easier to
follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-12-05 11:00:23 -07:00