Commit Graph

3025 Commits

Author SHA1 Message Date
Simon Glass
0dc72120b7 fdt: Add a command to show reserved-memory regions
Add a new 'fdt reserved' subcommand that displays all reserved memory
regions defined in the device tree's /reserved-memory node. This command
provides a formatted table showing the ID, name, start address, and size
of each reserved memory region.

Avoid a conflict with the existing 'fdt resize' command. Update the docs
and add a test.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 06:55:49 -06:00
Simon Glass
dd6f8cfbcb lib: Split fdt_print() into separate library file
Move fdt_print() function from cmd/fdt.c to a new lib/fdt_print.c file
to make it available as a library function for other code to use.

Move and rename is_printable_string(), making it available as well.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-27 12:44:42 -06:00
Simon Glass
f3d27f9841 console: Add tests for calc_check_console_lines()
Add tests for checking:
- environment variable override with hex values
- invalid environment variable handling
- Kconfig-default behavior with device detection
- precedence rules (environment overrides device detection)
- serial terminal detection by manipulating sandbox state

Also expose calc_check_console_lines() in console.h for testing
and update pager functionality to use bypass mode when serial
is not connected to a terminal.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
4412d9c3cf bdinfo: Show the pager page_len value
Show the actual value being used by the pager, if enabled.

Series-changes: 2
- Add new patch to show the pager page_len value

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
5c8817090b console: Add a few more paging tests
Provide a test that the prompt is displayed and another that paging
happens but does not appear in the recorded console-output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
28311413de console: Support paging with single characters
A single character may result in a stall waiting for user input, which
means that it may request that a string be output. So when the pager is
active we never actually use the devices' putc() methods. Add a special
case so they don't go to wrack and ruin.

As before, the pager is only supported with CONFIG_CONSOLE_MUX enabled.

Series-changes: 2
- Drop unnecessary '!= NULL'

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
cad364dd79 console: test: Allow tests to bypass the pager
We generally don't want the pager to be active when running tests,
since U-Boot appears to hang forever. Perhaps we could detect when the
tests are being run interactively and use the pager in that case. But
for now, just bypass it.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
149fe34151 test/py: Disable terminal detection with sandbox tests
Detecting the terminal size results in unwanted output in tests. Use the
-A option to disable this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
03fde8e2bf test/py: Disable the pager when running sandbox tests
The pager gets in the way of most tests, since it kicks in (by default)
when a command results in more than 25 lines of output. Use the -P flag
to bypass it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
984b363d02 console: Provide a way to output without the pager
Sometimes output should be sent ignoring the pager, such as when it is
a message related to paging. Add a parameter to support this.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:06 -06:00
Simon Glass
4a74dee5ce console: Add tests for the basic functionality
Cover the various cases in the base code. Put the tests in the 'common'
suite to match where the pager implementation is.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:06 -06:00
Simon Glass
82732edd5a bdinfo: Show the serial device
Show the name of the serial device with the 'bdinfo' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-25 06:54:00 -06:00
Simon Glass
b60fd4dae9 efi: Change env print -e to show only names by default
Change the default behavior of 'printenv -e' to show only EFI variable
names. The previous verbose output is now available with the -v flag.
This makes the command more user-friendly for quick variable listing.

Update documentation to reflect the new behavior and provide examples
of all three output modes: default (names only), -n (details without
hex dump), and -v (full verbose output).

It might be nicer to use -d to enable the dump, rather than have it on
by default.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-22 08:23:17 -06:00
Simon Glass
96d39714e4 test: efi: Add a test for the app booting Ubuntu via EFI
Now that the EFI app supports booting Ubuntu via the EFI bootmeth, add
a test for this, for ARM. This uses the sjg lab.

Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: app: Support booting an OS
This series completes the work to get the EFI app booting an EFI
application (e.g. Ubuntu):

- efidebug dh now works, and is slightly enhanced
- device paths which refer to the underlying EFI layer can now be
  requested by the app
- a test is provided, for EFI on ARM booting into Ubuntu using the sjg
  lab
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:12
2025-08-20 10:07:17 -06:00
Simon Glass
a7117cda66 test/py: Support a timing report when max_count is 0
If only a single test runs, it does not set the max_count variable, so
it remains as zero. Handle this situation as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 10:07:17 -06:00
Simon Glass
aec6acfd53 test/run: Tidy up the tool path for binman
Binman needs access to tools like mkimage and cbfstool to run all the
tests. Set up the TOOLS_DIR earlier and allow use of a TOOLS_DIR
environment variable to specify where the tools are. This can be used
from CI, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 07:41:19 -06:00
Simon Glass
d48e83599b test/run: Run more quietly
Pytest shows about 10 lines of output of limited merit at the top. Use
the -q flag to request that it doesn't so that the actionable things are
more visible.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 07:41:19 -06:00
Simon Glass
5fafae6f49 test/run: Skip xPL tests with make tcheck
The original purpose of 'make tcheck' was to run the tools and skip any
pytests. This has been lost by the addition of sandbox_noinst and
sandbox_vpl

Restore the intended behaviour by skipping all tests with sandbox_spl
(since it still needs to be built) and skipping the other builds
entirely.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 07:41:19 -06:00
Simon Glass
221552d735 test/run: Provide the full path to dtc
The current directory may be changed by a tool run from this script,
so use an absolute path when setting the DTC variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 07:41:19 -06:00
Simon Glass
165aed7671 test: Update test_fdt_add_pubkey() to use a separate dir
This test uses the same directory as the vboot tests, which means that
they conflict when tests are run in parallel.

Add a 'pk-' prefix to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-20 07:41:19 -06:00
Simon Glass
f6acb6e003 meminfo: Allow for up to 10 hex digits
On platforms where most of the memory is above 4GB, the EFI app may find
itself using addresses with 9 or even 10 digits. Expand the width of the
columns to cope with this.

Add some double bars across digits 9 and 8 so that it is easier to make
the value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-19 17:36:44 -06:00
Simon Glass
878b4a0842 hooks: Add ellesmere riscv64_spl board
Add a symlink for this board to the travis-ci board.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06:00
Simon Glass
b7fe69a08f hooks: ellesmere: Add a coreboot board
Add a coreboot board which can run under QEMU on ellesmere.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06: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
dfa072fd07 test: Move image creation to test/py/img
Rather than having this code mixed with the tests, it seems better to
put it up one level. Move the directory and tidy up references.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 15:32:25 -06:00
Simon Glass
5ef5e6a8cc test: pci: Use the exact mapping size for PCI EA tests
Update the sizes to the expected size of the device's mapping in each
case, to avoid a warning in map_physmem() about a partial map.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 14:37:22 -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
6f664d8445 test/py: Provide a run_and_log() function that uses log
The normal function requires a ubman but only uses it to find the log
fixture. This is a pain since the ubman is a function-level fixture.

Provide a version that takes a log directory, so that it can be called
from a session fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
06aed09ed0 test: Update test_fdt_add_pubkey() to create its own files
This test should create its own files rather than relying on those
created by test_vboot_base(). Copy the code in the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
bddede757b test: Move create_rsa_pair() out of test_vboot_base()
At present test_fdt_add_pubkey() relies on the vboot test having already
run, since its makes use of the files that test produces.

This means that the tests cannot run in parallel (make pcheck).

As a first step to resolving this, move the required common code out to
a standalone function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
7e4bad3225 test: Correct implementation of Spawn() in ConsoleSandbox
Now that this base-class function is called, it can produce an error on
test failure, since it passes an empty list for the arguments.

Rename the reset() function to prepare_for_spawn() and use that instead.

See also: ca30385c61 ("Correct implementation of Spawn() in ConsoleBase")

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
69f4226ca5 test: Mark the sleep tests as slow
These tests do take quite a bit of time, so mark them as such.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00