Commit Graph

99823 Commits

Author SHA1 Message Date
Simon Glass
b03663be7b pickman: Add GitLab integration to push and create MRs
Add -p/--push option to the apply command to push the cherry-pick branch
to GitLab and create a merge request. Uses the python-gitlab library.

Options:
  -p, --push     Push branch and create GitLab MR
  -r, --remote   Git remote for push (default: ci)
  -t, --target   Target branch for MR (default: master)

Requires GITLAB_TOKEN environment variable to be set.

Also record cherry-pick history in .pickman-history file on successful
apply. Each entry includes the date, source branch, commits, and the
agent's conversation log. This file is committed automatically and
included in the MR description when using -p.

Name the module gitlab_api.py to avoid shadowing the python-gitlab
library.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
616e0abb7b pickman: Add GitLab API module
Add gitlab_api module with functions for interacting with GitLab:

- check_available(): Check if python-gitlab is installed
- get_token(): Get GitLab API token from environment
- get_remote_url(): Get URL for a git remote
- parse_url(): Parse GitLab URLs (SSH and HTTPS formats)
- push_branch(): Push a branch to a remote
- create_mr(): Create a merge request via GitLab API
- push_and_create_mr(): Combined push and MR creation

Requires python-gitlab library and GITLAB_TOKEN environment variable.

Name the module gitlab_api.py to avoid shadowing the python-gitlab
library.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
38bea21d9a pickman: Add an apply command to cherry-pick commits
Add a command that automates cherry-picking commits using the agent
module. The apply command:

- Gets the next set of commits (same as next-set)
- Creates a new branch for the cherry-picks (-b/--branch option)
- Runs the agent to execute the cherry-picks
- Returns to the original branch after completion

The database is not updated automatically; use 'commit-source' to update
after reviewing the cherry-picked branch.

Also refactor control.py to extract get_next_commits() for reuse and
use a dispatch table for commands.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
55733b2749 pickman: Add a Claude agent
Add an agent which uses the Claude Agent SDK to automate cherry-picking
commits.

The agent module provides an async interface to the Claude Agent SDK
with a synchronous wrapper for easy use from the CLI.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
5cae65fea4 pickman: Add pcommit and mergereq tables to database
Add new database tables to track individual commits and merge requests:

- pcommit: tracks commits being cherry-picked with status, author,
  subject, and optional link to merge request
- mergereq: tracks GitLab merge requests with branch name, MR ID,
  status, and URL

Also add helper functions for both tables and update control.py to
write commit status to the database during apply operations.

Update README.rst with documentation for all database tables.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
da8d0d8028 pickman: Add next-set command to show commits to cherry-pick
Add a command that finds the next set of commits to cherry-pick from a
source branch. It lists commits from the last cherry-picked commit up
to and including the next merge commit, which typically represents a
logical grouping (e.g., a pull request).

If no merge commit is found, it lists all remaining commits with a note
indicating this.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
11b1f8fdd8 pickman: Add list-sources command
Add a command to list all tracked source branches and their last
cherry-picked commits from the database.

Usage: ./tools/pickman/pickman list-sources

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
ac54ae95c0 pickman: Add add-source command to track source branches
Add a command to register a source branch in the database. This finds
the merge-base commit between master and the source branch and stores
it as the starting point for cherry-picking.

Usage: ./tools/pickman/pickman add-source <branch>

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
23c4d2be3c pickman: Add database for tracking cherry-pick state
Add an sqlite3 database module to track the state of cherry-picking
commits between branches. The database uses .pickman.db and includes:

- source table: tracks source branches and their last cherry-picked
  commit into master
- Schema versioning for future migrations

The database code is mostly lifted from patman

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
999a36a675 pickman: Add argument parsing with compare and test commands
Add subcommand support:
- compare: Compare branches (existing functionality)
- test: Run the functional tests

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
840c1a6855 pickman: Add tool to compare branch differences
Add a tool to check the number of commits in a source branch
(us/next) that are not in the master branch (ci/master), and find
the last common commit between them.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:15:19 +00:00
Simon Glass
ac3e0a2da4 Merge branch 'cherry-a8c07ac4970' into 'master'
[pickman] Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

See merge request u-boot/u-boot!232
2025-12-16 13:14:49 +00:00
Simon Glass
2a205595ac pickman: Record cherry-pick of 17 commits from us/next
- a8c07ac497 alist: Mention the error condition in alist_add_placeholder()
- 13bd298499 alist: Add a comment for alist_init_struct()
- 6668d860f7 alist: Expand the comment for alist_get()
- 2ce146a3de alist: Add a way to get the next element
- 83bc5989fc alist: Add for-loop helpers
- 70f5f17415 alist: Add a function to empty the list
- d01c58acb7 alist: Add a way to efficiently filter an alist
- b84c13f37d alist: Add maintainer
- cedf9ccaa2 dm: core: Add a function to see if a device exists
- 6e625484f5 test: boot: Use a consistent name for the script bootmeth
- 57e77dc80e arm: dts: e850-96: Remove TRNG node from appended dts
- 33ddfc059e driver: sifive ccache: enable TRUNKCLOCKGATE and REGIONCLOCKGATE
- e83a99cb67 configs: visionfive2: re-enable SPL_SYS_MMCSD_RAW_MODE
- d86ff34285 xilinx: mbv: Place DTB by default to DDR location
- e4b8d8be4e xilinx: mbv: Align smode_defconfig with upstream QEMU
- d5f5e77818 riscv: Introduce configuration for 64bit version Microblaze V
- a7a96a37cb Merge https://source.denx.de/u-boot/custodians/u-boot-riscv
2025-12-15 17:36:18 -07:00
Andreas Schwab
ce6c8cd376 configs: visionfive2: re-enable SPL_SYS_MMCSD_RAW_MODE
To restore MMC boot, enable SPL_SYS_MMCSD_RAW_MODE and recover
SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION and
SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.

Fixes: 2a00d73d08 ("spl: mmc: Try to clean up raw-mode options")
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
(cherry picked from commit e83a99cb67)
2025-12-15 17:34:46 -07:00
Simon Glass
ccba4fac93 Merge branch 'cherry-e5565c24bb4' into 'master'
[pickman] Merge tag 'u-boot-amlogic-next-20241113' of https://source.denx.de/u-boot/custodians/u-boot-amlogic into next

See merge request u-boot/u-boot!230
2025-12-15 23:57:34 +00:00
Simon Glass
ce07e78917 pickman: Record cherry-pick of 8 commits from us/next
- e5565c24bb pinctrl: exynos: fix type of count integer
- 57e77dc80e arm: dts: e850-96: Remove TRNG node from appended dts
- 895b54998e configs: khadas-vim3{l}: fix userdata size
- ea2273911d arm: dts: meson: remove meson-a1.dtsi
- a5ed242ba6 dt-bindings: remove a1 bindings from include/
- 827edb6c00 dt-bindings: remove axg bindings from include/
- 1cdb4e03e6 dt-bindings: interrupt-controller: remove arm-gic.h from include/
- 030ec147af Merge tag 'u-boot-amlogic-next-20241113' of https://source.denx.de/u-boot/custodians/u-boot-amlogic into next
2025-12-15 16:20:22 -07:00
Simon Glass
7764e43798 Merge branch 'cherry-e5565c24bb4' into 'master'
[pickman] Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell

See merge request u-boot/u-boot!229
2025-12-15 17:28:00 +00:00
Simon Glass
8c915b40e6 pickman: Record cherry-pick of 15 commits from us/next
- e5565c24bb pinctrl: exynos: fix type of count integer
- 57e77dc80e arm: dts: e850-96: Remove TRNG node from appended dts
- 06b8aafd68 fastboot: properly handle unknown partition type
- 35d967f5a8 usb: ci_udc: don't use "advance" feature when setting address
- 325ac6c1e7 arm: mvebu: Disable JFFS2 support for Kirkwood and Armada XP boards
- 96ca314798 arm: kirkwood: Enable bootstd for Sheevaplug board
- 3eef899b57 arm: mvebu: x240: Use default baudrate table
- 27b2488735 arm: mvebu: x240: Switch to standard boot
- cbbfa8d778 arm: mvebu: x240: Don't build mkeficapsule
- b25b2d4f67 arm: mvebu: x240: Enable IPV6 support
- 1b46176532 arm: mvebu: x530: Remove dead comments
- c6b17af142 arm: mvebu: x530: Don't build mkeficapsule
- f337b5aaad arm: mvebu: x530: Enable IPV6 support
- 7446e29db5 arm: mvebu: Add Allied Telesis x250 board
- 6b96e01d70 Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell
2025-12-15 17:22:49 +00:00
Tom Rini
32c3528553 Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell
CI: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=379&view=results

- mvebu: Disable JFFS2 support for Kirkwood and Armada XP boards (Tony)
- kirkwood: Enable bootstd for Sheevaplug board (Tony)
- mvebu: Add Allied Telesis x250 board (Chris)
- mvebu: Updates for Allied Telesis boards (Chris)

(cherry picked from commit 6b96e01d70)
2025-12-15 17:22:49 +00:00
Chris Packham
eacc233618 arm: mvebu: Add Allied Telesis x250 board
The x250 and SE250 are series of 10G L2+ switches from Allied Telesis.
There are a number of them in the range but as far as U-Boot is
concerned all the CPU block components are the same so there's only one
board defined.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 7446e29db5)
2025-12-15 17:22:49 +00:00
Chris Packham
60736a48d0 arm: mvebu: x530: Enable IPV6 support
Enable IPV6 support for the x530 board.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit f337b5aaad)
2025-12-15 17:22:49 +00:00
Chris Packham
5854e1862f arm: mvebu: x530: Don't build mkeficapsule
The x530 board doesn't use EFI and our toolchains don't include gnutls
so disable the tool in the defconfig.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit c6b17af142)
2025-12-15 17:22:49 +00:00
Chris Packham
efafd5c5f7 arm: mvebu: x530: Remove dead comments
As things have been moved to Kconfig there are a number of dead comments
left over in x530.h. Remove them.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 1b46176532)
2025-12-15 17:22:49 +00:00
Chris Packham
0cba095cd8 arm: mvebu: x240: Enable IPV6 support
Enable IPV6 support for the x240 board.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit b25b2d4f67)
2025-12-15 17:22:49 +00:00
Chris Packham
56c7233984 arm: mvebu: x240: Don't build mkeficapsule
The x240 board doesn't use EFI and our toolchains don't include gnutls
so disable the tool in the defconfig.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit cbbfa8d778)
2025-12-15 17:22:49 +00:00
Chris Packham
5fc2a23fef arm: mvebu: x240: Switch to standard boot
Use standard boot instead of the distro boot scripts. Regenerate the
board defconfig now that some options are selected automatically.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 27b2488735)
2025-12-15 17:22:49 +00:00
Chris Packham
a544abd882 arm: mvebu: x240: Use default baudrate table
Remove CFG_SYS_BAUDRATE_TABLE as there's no reason not to use the
defaults defined via config_fallbacks.h.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 3eef899b57)
2025-12-15 17:22:49 +00:00
Tony Dinh
25865bec72 arm: kirkwood: Enable bootstd for Sheevaplug board
Enable bootstd for Sheevaplug board.
Remove JFFS2 support. See JFFS2 Vulnerability[1].
Enable LTO to keep board size within limit.
Move default envs to text-base environment

[1] https://lore.kernel.org/u-boot/20241114233005.GN3600562@bill-the-cat/T/#m2fc25da1d2c019bc3cd8676991fdd64b8a21aa9b

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 96ca314798)
2025-12-15 17:22:49 +00:00
Tony Dinh
fbc10dc64b arm: mvebu: Disable JFFS2 support for Kirkwood and Armada XP boards
These boards don't use JFFS2 file system for booting so remove it.

Ref: https://lore.kernel.org/u-boot/20241114233005.GN3600562@bill-the-cat/T/#t
Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Acked-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 325ac6c1e7)
2025-12-15 17:22:49 +00:00
Ion Agorria
8cbd6d29d5 usb: ci_udc: don't use "advance" feature when setting address
In the older USB controllers like for example in ChipIdea controller
used by the Tegra 2 the "USBADRA: Device Address Advance" bitflag
does not exist, so the new device address set during SET_ADDRESS
can't be deferred by hardware, which causes the host to not recognize
the device and give an error.

Instead store it until ep completes to apply the change into the hw
register as Linux kernel does. This should fix regression on old and
and be compatible with newer controllers.

Inspired by: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ef15e5490edc7edf808d3477ab32e0e320792f65

Signed-off-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20241126072956.64778-2-clamor95@gmail.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
(cherry picked from commit 35d967f5a8)
2025-12-15 17:22:49 +00:00
Caleb Connolly
8bc8a47f18 fastboot: properly handle unknown partition type
In getvar_partition_type() we attempt to find a filesystem driver for
the partition (of the list of driver enabled in U-Boot), on failure we
return the error to fastboot and completely bail out of the operation.

However, this should not be a failure, instead we should just default to
"raw". This allows commands like "fastboot format:ext4 userdata" to work
if userdata didn't already have an ext4 partition table (or if FS_EXT4
is disabled in U-Boot), as failing to determine the current partition
type is not an error in this case.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20241113050607.1850472-1-caleb.connolly@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
(cherry picked from commit 06b8aafd68)
2025-12-15 17:22:49 +00:00
Sam Protsenko
58bb626f09 arm: dts: e850-96: Remove TRNG node from appended dts
Commit 136b7b6d2e ("Subtree merge tag 'v6.11-dts' of dts repo [1] into
dts/upstream") updates the upstream dts for E850-96 board, bringing
upstream TRNG node. There is no need to keep TRNG node in appended dts
anymore, so remove it.

Tested on E850-96 board by running 'rng' command in U-Boot shell.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
(cherry picked from commit 57e77dc80e)
2025-12-15 17:22:49 +00:00
Henrik Grimler
c2851e54a1 pinctrl: exynos: fix type of count integer
unsigned int count is used to capture return of dev_read_string_count.
When an error occurs dev_read_string_count returns -ve, which can
hence not be handled correctly. Use int instead of unsigned int so
that errors are detected.

Fixes: 16ca80adc5 ("pinctrl: Add pinctrl driver support for Exynos7420 SoC")

Signed-off-by: Henrik Grimler <henrik@grimler.se>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
(cherry picked from commit e5565c24bb)
2025-12-15 17:22:49 +00:00
Simon Glass
27e70d6f56 Merge branch 'tesf' into 'master'
test: Add support for passing arguments to C unit tests

See merge request u-boot/u-boot!223
2025-12-15 17:21:37 +00:00
Simon Glass
2b6e3394fb test: Add documentation for test parameters
Add a description of how test parameters work. This helps to make it
easier to write C tests which need setup to be done in Python.

Series-to: concept
Series-cc: heinrich
Cover-letter:
test: Add support for passing arguments to C unit tests
This series adds infrastructure for passing runtime arguments from Python
tests to C unit tests. This makes it easier to support a hybrid testing
approach where Python handles complex setup (filesystem images,
environment configuration) while C handles the actual test logic with
better debuggability.

A few other things are included to make this work:

- A fix for linker list alignment that was causing garbage values like
  "Running -858993444 bloblist tests" due to GCC's magic-number division
  optimization failing when padding breaks exact multiples

- A fix fix for serial output with sandbox, since it sometimes misses
  output at the end when running tests with gnome terminal

- Improvements to the linker-list script to detect padding and
  pointer-arithmetic bugs

- A new UNIT_TEST_ARGS() macro for declaring tests with typed arguments,
  along with argument parsing in the ut command (name=value format)

- Argument-accessor macros ut_str(), ut_int(), and ut_bool() with
  type-checking and bounds validation

- A private buffer (uts->priv) for test-local temporary data, which
  makes it a little easier to write shorter tests

- Tests for the argument feature (test_args) covering type checking,
  bounds checking, and argument-parsing failures

As an example, the basic filesystem tests are converted from pure Python
to C with Python wrappers.

Some improved printf documentation and support for Linux's %pV format
are provided.

The slight increase in size causes qemu-riscv64_spl to fail, so this
series also includes a patch to increase the SPL-malloc() space.
END

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:52:56 -07:00
Simon Glass
32c67c43fb test: fs: Update Python tests to call C implementations
Update test_basic.py to call the new C-based filesystem tests via the
'ut' command. This allows tests to run more directly, calling the actual
FS layer, without having to go through the command interface and
worrying about which filesystem command to use.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:52:56 -07:00
Simon Glass
72aeb4a2e2 test: fs: add C-based filesystem tests
Add C implementations of filesystem tests that can be called via
the 'ut fs' command. These tests use UTF_MANUAL flag since they require
external setup, i.e. creation of filesystem images.

This covers the existing TestFsBasic tests.

The tests use typed arguments (fs_type, fs_image, md5 values) passed
via the command line.

Add a few helpers to make the code easier to read.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:52:56 -07:00
Simon Glass
2ac3226758 test: Add tests for unit-test arguments
Add a set of tests to check the behaviour of test arguments and the ut
command. This includes failure cases, where the wrong type or a
non-existent argument is requested.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:17:31 -07:00
Simon Glass
688e830a22 test: Allow preserving console recording on failure
Update the 'ut' command to have a -R command option to prevent ut_fail()
and ut_failf() from clearing GD_FLG_RECORD. This is useful when testing
the test framework itself, where error messages need to be captured.

Refactor ut_fail() and ut_failf() to call ut_unsilence_console() instead
of duplicating the flag-clearing logic.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:17:14 -07:00
Simon Glass
f4e11a4052 test: Add a private buffer for tests
Add a priv[] buffer to struct unit_test_state that tests can use for
their own data. This avoids the need to allocate memory or use global
variables for test-specific state.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:16:04 -07:00
Simon Glass
a9d6c0322e test: Add type-checked argument accessor functions
Add ut_get_str(), ut_get_int(), and ut_get_bool() functions with
corresponding ut_str(), ut_int(), and ut_bool() macros for accessing
test arguments with type checking.

These functions check that the argument index is within bounds and the
type matches what was requested.

The first failure for a test is reported via ut_failf() which should
make it fairly easy to debug the test.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:14:52 -07:00
Simon Glass
64850634f0 test: Enhance the ut command to pass test arguments
Update the ut command to permit passing arguments to tests.

Usage: ut -f fs test_name key1=value1 key2=value2

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:14:41 -07:00
Simon Glass
a3b60a2094 test: Add support for passing arguments to C tests
Add support for passing key=value arguments to unit tests. The test
framework parses arguments based on definitions provided by each test
and makes them available via uts->args[]

For now the 'ut' command does not support this new feature.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:14:34 -07:00
Simon Glass
1e4f459e48 test: Add a macro to declare unit tests with arguments
Add a UNIT_TEST_ARGS() macro to declare and register a test with inline
argument definitions. The variadic arguments use struct ut_arg_def and
a NULL terminator is added automatically to the list.

Example usage:
  static int my_test(struct unit_test_state *uts) { ... }
  UNIT_TEST_ARGS(my_test, UTF_CONSOLE, my_suite,
      { "path", UT_ARG_STR },
      { "count", UT_ARG_INT, UT_ARGF_OPTIONAL, { .vint = 10 } });

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:13:26 -07:00
Simon Glass
0b18ce5f83 test: Add argument-type definitions
Add types for declaring and storing unit test arguments:
- enum ut_arg_type: INT, BOOL, STR types
- enum ut_arg_flags: OPTIONAL flag for non-required args
- struct ut_arg_def: declares expected args with defaults
- struct ut_arg: holds parsed argument values

This prepares for passing key=value arguments to tests via the 'ut'
command instead of needing to use environment variables.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:12:56 -07:00
Simon Glass
1fbf894923 test: Add a helper to check the next line against a regex
Add a new ut_assert_nextline_regex() macro and ut_check_console_line_regex()
helper to check console output against a regex pattern. This is useful when
the exact output varies (e.g., file paths or line numbers in error messages).

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:12:44 -07:00
Simon Glass
6e5c5a0993 test: vbe: Fix the ut-flag order in vbe_test_fixup_norun()
Move the -f flag before the suite name since ut parses flags
before the suite argument.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 07:15:34 -07:00
Simon Glass
9ab3308d64 linker_lists: Fix end-marker alignment to prevent padding
Change the alignment of end markers in ll_entry_end() and ll_end_decl()
from __aligned(4) and __aligned(CONFIG_LINKER_LIST_ALIGN) respectively
to __aligned(1).

The linker places zero-size end markers at aligned boundaries based on
what follows them. When the next list's start marker has a high alignment
requirement (e.g., 32 bytes), padding gets inserted before the end marker.
This causes the byte span (end - start) to not be an exact multiple of
the struct size.

The compiler optimizes pointer subtraction (end - start) using magic-number
multiplication for division. This optimization only produces correct results
when the byte span is an exact multiple of the struct size. With padding,
the result is garbage (e.g., -858993444 instead of 15).

By using __aligned(1), the end marker is placed immediately after the last
entry with no padding, ensuring (end - start) equals exactly n * sizeof
where n is the number of entries. This makes ll_entry_count() and direct
pointer arithmetic work correctly.

Fixes: 0b2fa98aa5 ("linker_lists: Fix alignment issue")
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-13 16:28:53 -07:00
Simon Glass
2812864362 check_linker_lists: Enhance detection of alignment problems
When linker-inserted padding breaks list integrity, pointer arithmetic
like (end - start) / sizeof(struct) produces garbage. GCC optimizes
division by constants using multiplicative inverses, which only works
when the dividend is an exact multiple. With padding, outputs like
"Running -858993444 bloblist tests" appear instead of the correct count.

Enhance the linker list checking script to detect these problems by
adding symbol size tracking using nm -S. This enables:

1. Padding detection: Compare symbol sizes to gaps. If gap > size,
   padding was inserted, breaking contiguous array assumptions.

2. Pointer arithmetic bugs: Check if (end - start) marker span is a
   multiple of struct size.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-13 16:28:53 -07:00
Simon Glass
2ddc96ae88 vsprintf: Add support for the %pV format-specifier
Add support for the %pV format-specifier which allows printing a
struct va_format. This is used by the Linux kernel for recursive
printf() formatting and is needed by the ext4l filesystem driver.

Add the struct to include/linux/printk.h to match the kernel location.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-13 16:28:53 -07:00