summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2025-05-30expo: Provide access to the current menu itemSimon Glass
Add functions to allow a caller to find out the current menu item and to select a different one. Update the event handling so that an attempt to change the current item (e.g. by pressing the up-arrow key) is reported to the caller, since this may be used to cancel an autoboot timeout. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Test rendering a lineeditSimon Glass
Check the rendering output when adding characters to a line-edit object. Add a separate test to check behaviour when starting with existing text in the lineedit. The cursor should start at the end. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Pass in the video device for cedit_prepare()Simon Glass
At present this function locates it own video device. Pass it in to provide more flexibility. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Test some cedit actionsSimon Glass
Refactor the action-processing code into a new cedit_do_action() function so we can call it from a test. Check moving to a new field and opening the menu, to ensure that rendering is correct. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Create a rendering test for ceditSimon Glass
Add a test to check that the cedit renders as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30abuf: Add a way to printf() into a bufferSimon Glass
It is useful to format a string into a buffer, with the sizing handled automatically. Add a function for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30abuf: Add a function to copy a bufferSimon Glass
It is useful to be able to copy an abuf, to allow changes while preserving the original. Add a function for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30abuf: Add a helper for initing and allocating a bufferSimon Glass
This construct appears in various places. Reduce code size by adding a function for it. It inits the abuf, then allocates it to the requested size. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-29Merge patch series "Remove <env.h> from <net.h>"Tom Rini
Tom Rini <trini@konsulko.com> says: Hey all, This is a v3 of Simon's series[1] and depends on the series[2] I posted the other day that removes <env.h> from <command.h>. With this series done, I believe we've tackled all of the current cases of headers which include <env.h> without directly needing it. Much of this series is in fact Simon's v2 with the main differneces being: - Removing <env.h> from <net.h> at the end - Removing env_to_ip() given how little it's used rather than shuffling around where it's declared and un-inline'ing it. For a rarely used helper, this ends up being cleaner I think. Especially looking at some of the users (which called env_get repeatedly). If there's strong opinion here about using the other method[3] we can do that instead. - Setting aside for now how to handle CMD_ELF=y and NO_NET=y because today it's actually fine as we unconditionally build lib/net_utils.c where string_to_ip() is defined. I'm unsure if a further series is warranted here or not. We rely on link-time optimization to keep code readable too. [1]: https://lore.kernel.org/all/20250501010456.3930701-1-sjg@chromium.org [2]: https://lore.kernel.org/all/20250514225002.15361-1-trini@konsulko.com [3]: https://lore.kernel.org/all/20250501010456.3930701-23-sjg@chromium.org Link: https://lore.kernel.org/r/20250515234154.1859366-1-trini@konsulko.com
2025-05-29global: Avoid indirect inclusion of <env.h> from <net.h>Tom Rini
Now that env_get_ip() has been removed, the include file <net.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <net.h> fix all of the remaining places which had relied on this indirect inclusion to instead include <env.h> directly. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> # net/lwip Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Martyn Welch <martyn.welch@collabora.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-29Merge patch series "Start removing <env.h> from headers when not required"Tom Rini
Tom Rini <trini@konsulko.com> says: Given Simon's series at [1] I started looking in to what brings in <env.h> when not strictly required and in turn has some unintended implicit includes. This series takes care of the places where, commonly, <linux/string.h> or <env.h> itself were required along with a few other less common cases. This sets aside for the moment what to do about net-common.h and env_get_ip() as I'm not entirely sure what's best there. [1]: https://patchwork.ozlabs.org/project/uboot/list/?series=454939&state=* Link: https://lore.kernel.org/r/20250514225002.15361-1-trini@konsulko.com
2025-05-29global: Avoid indirect inclusion of <env.h> from <command.h>Tom Rini
The include file <command.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <command.h> fix all of the places which had relied on this indirect inclusion to instead include <env.h> directly. Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> # android, bcb Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> # spawn Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-29cmd/mem.c, test/cmd/mem_copy.c: Add <compiler.h>Tom Rini
These files require <compiler.h> in order to have MEM_SUPPORT_64BIT_DATA be defined but currently rely on a long indirect include path to get it. Add this directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-29Merge patch series "regex patches"Tom Rini
Rasmus Villemoes <ravi@prevas.dk> says: This started as a rather simple patch, 1/12, adding the ability to more conveniently do regex matching in shell. But with that, it became very easy to see what the slre library can and especially what it cannot do, and that way I found both outright bugs and a "wow, doesn't it support that syntax" gotcha. I couldn't find any tests ('git grep slre -- test/' was empty), so I added a small test suite and tweaked slre.c. Link: https://lore.kernel.org/r/20250513084034.654865-1-ravi@prevas.dk
2025-05-29test: slre: add tests for regex libraryRasmus Villemoes
Inspecting the slre.c code reveals a few bugs; those are easy to demonstrate with the new '=~' test operator. Before fixing them, let's add a place to add test cases. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2025-05-29test: slre: add tests for character rangesRasmus Villemoes
The first of these, { "U-Boot", "^[B-Uo-t]*$", 0 }, would match previously when the - and the letters were all interpreted literally. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2025-05-29test: slre: add test cases for escape char in character classRasmus Villemoes
Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2025-05-29test: slre: add some (negative) character class testsRasmus Villemoes
Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2025-05-29test: slre: add more test casesRasmus Villemoes
Add some tests for the "drop wrong anchored optimization". Without the previous commit, the first, fifth and seventh of these would fail, i.e. those: { "xby", "^a|b", 1}, { "", "x*$", 1}, { "yy", "x*$", 1}, Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2025-05-26Merge tag 'v2025.07-rc3' into nextTom Rini
Prepare v2025.07-rc3
2025-05-25efi_loader: Separate device path into its own headerSimon Glass
These functions are useful for the EFI app. As a first step towards making these available outside lib/efi_loader, create a separate header file and include it where needed. Add proper comments to the functions, since many are missing at present. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-05-18test: allow testing with NET_LWIP=yHeinrich Schuchardt
Adjust network tests to run with CONFIG_NET_LWIP=y. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-05-18test: allow multiple config options in buildconfigspecHeinrich Schuchardt
In some cases we have alternative configuration options that supply the same functionality, e.g CONFIG_NET and CONFIG_NET_LWIP. Allow to specify all of them as arguments for buildconfigspec() and execute the text if any of these is fulfilled, e.g. @pytest.mark.buildconfigspec('net', 'net_lwip') Update the documentation. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-16test: Add a test for strim()Simon Glass
This function trims whitespace from the start and end of a string. Add a test for it. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-14global: Avoid indirect inclusion of <env.h> from <command.h>Tom Rini
The include file <command.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <command.h> fix all of the places which had relied on this indirect inclusion to instead include <env.h> directly. Signed-off-by: Tom Rini <trini@konsulko.com> --- Cc: Anatolij Gustschin <agust@denx.de> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Jerome Forissier <jerome.forissier@linaro.org> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Lukasz Majewski <lukma@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Mark Kettenis <kettenis@openbsd.org> Cc: Masahisa Kojima <kojima.masahisa@socionext.com> Cc: Mattijs Korpershoek <mkorpershoek@kernel.org> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Cc: Simon Glass <sjg@chromium.org> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Cc: Stefan Bosch <stefan_b@posteo.net> Cc: Tien Fong Chee <tien.fong.chee@altera.com> Cc: Tingting Meng <tingting.meng@altera.com> Cc: Tobias Waldekranz <tobias@waldekranz.com>
2025-05-14cmd/mem.c, test/cmd/mem_copy.c: Add <compiler.h>Tom Rini
These files require <compiler.h> in order to have MEM_SUPPORT_64BIT_DATA be defined but currently rely on a long indirect include path to get it. Add this directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-11test/py/test_efi_fit: test fdt and initrdAdriano Cordova
Add tests to check initrd and dtb loading Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
2025-05-11doc: pytest: Document the test_button testTom Rini
Add this test to the documentation. No changes to the test itself were required. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_bootmenu testTom Rini
Add this test to the documentation. There was already a function comment that included the argument, so convert it to the right style to be rendered correctly in output. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_bind testTom Rini
Add this test to the documentation. None of the functions had comments, so attempt to explain what each does. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_efi_loader testTom Rini
Add this test to the documentation. We need to add a code-block annotation to the example and indent it correctly. We also need to document the do_test_efi_helloworld_net function and that in turn means changing the documentation to test_efi_helloworld_net_http and test_efi_helloworld_net_tftp to reflect what is and isn't done in those functions themselves now. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_bootstage testTom Rini
Add this test to the documentation. We need to move the import to follow the main comment so that it renders correctly, and add a code-block annotation to the example and indent it correctly. Next, neither of the functions had comments themselves, so document them now. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_net testTom Rini
Add this test to the documentation. While the diff appears large at first, the only changes within the test are to move the imports to follow the pydoc comment and then to code-block and indent the example configuration. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11test: test_net_boot: Add more commentsTom Rini
Some of the functions were missing pydoc comments. Add them so they will be included in the documentation. Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_net_boot testTom Rini
Add the test_net_boot.py test to the generated documentation. While most of this was already commented correctly for inclusion the biggest problem was examples of code without a code-block notation. This in turn broke parsing. Add the missing notations. We also must have the comment prior to any import lines or it will not be seen as a comment on the overall file and thus not included. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Framework for documenting tests and document test_000_versionTom Rini
In order to easily document pytests, we need to include the autodoc extension. We also need to make sure that for building the docs, CI includes pytest and that we have PYTHONPATH configured such that it will find all of the tests and related files. Finally, we need to have our comments in the test file by in proper pydoc format in order to be included in the output. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-02video: Add a function to draw a rectangleSimon Glass
Provide a way to draw an unfilled box of a certain width. This is useful for grouping menu items together. Add a comment showing how to see the copy-framebuffer, for testing. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02video: Allow console output to be silencedSimon Glass
When using expo we want to be able to control the information on the display and avoid other messages (such as USB scanning) appearing. Add a 'quiet' flag for the console, to help with this. The test is a little messy since stdio is still using the original vidconsole create on start-up. So take care to use the same. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02test: video: Export the video-checking functionsSimon Glass
We want to check the display contents in expo tests, so move the two needed functions to a new header file. Rename them to have a video_ prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02video: Add a way to write a partial string to the consoleSimon Glass
When writing multiple lines of text we need to be able to control which text goes on each line. Add a new vidconsole_put_stringn() function to help with this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02video: truetype: Support a limit on the width of a lineSimon Glass
Expo needs to be able to word-wrap lines so that they are displayed as the user expects. Add a limit on the width of each line and support this in the measurement algorithm. Add a log category to truetype while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02video: truetype: Support newlines in the measured stringSimon Glass
It is useful to be able to embed newline characters in the string and have the text measured into multiple lines. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02video: truetype: Fill in the measured lineSimon Glass
Create a measured line for the (single) line of text. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02video: Begin support for measuring multiple lines of textSimon Glass
Update the vidconsole API so that measure() can measure multiple lines of text. This will make it easier to implement multi-line fields in expo. Tidy up the function comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02video: Add a test for font measurementSimon Glass
Add a simple test which measures a line of text using a Truetype font. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-01video: Use VIDEO_DAMAGE for VIDEO_COPYAlexander Graf
CONFIG_VIDEO_COPY implemented a range-based copying mechanism: If we print a single character, it will always copy the full range of bytes from the top left corner of the character to the lower right onto the uncached frame buffer. This includes pretty much the full line contents of the printed character. Since we now have proper damage tracking, let's make use of that to reduce the amount of data we need to copy. With this patch applied, we will only copy the tiny rectangle surrounding characters when we print them, speeding up the video console. After this, changes to the main frame buffer are not immediately copied to the copy frame buffer, but postponed until the next video device sync. So issue an explicit sync before inspecting the copy frame buffer contents for the video tests. Signed-off-by: Alexander Graf <agraf@csgraf.de> [Alper: Rebase for fontdata->height/w, fill_part(), fix memmove(dev), drop from defconfig, use damage.xstart/yend, use IS_ENABLED(), call video_sync() before copy_fb check, update video_copy test] Co-developed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Link: https://lore.kernel.org/u-boot/20230821135111.3558478-12-alpernebiyasak@gmail.com/
2025-05-01video: test: Test video damage tracking via vidconsoleAlper Nebi Yasak
With VIDEO_DAMAGE, the video uclass tracks updated regions of the frame buffer in order to avoid unnecessary work during a video sync. Enable the config in sandbox and add a test for it, by printing strings at a few locations and checking the tracked region. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Adjust test avoid temporary failures in this patch: Signed-off-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/u-boot/20230821135111.3558478-8-alpernebiyasak@gmail.com/
2025-05-01video: test: Test partial updates of hardware frame bufferAlper Nebi Yasak
With VIDEO_COPY enabled, only the modified parts of the frame buffer are intended to be copied to the hardware. Add a test that checks this, by overwriting contents we prepared without telling the video uclass and then checking if the overwritten contents have been redrawn on the next sync. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/u-boot/20230821135111.3558478-4-alpernebiyasak@gmail.com/
2025-05-01video: test: Support checking copy frame buffer contentsAlper Nebi Yasak
The video tests have a helper function to generate a pseudo-digest of frame buffer contents, but it only does so for the main one. There is another check that the copy frame buffer is the same as that. But neither is enough to test if only the modified regions are copied to the copy frame buffer, since we will want the two to be different in very specific ways. Add a boolean argument to the existing helper function to indicate which frame buffer we want to inspect, and update the existing callers. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/u-boot/20230821135111.3558478-3-alpernebiyasak@gmail.com/
2025-05-01video: test: Split copy frame buffer check into a functionAlper Nebi Yasak
While checking frame buffer contents, the video tests also check if the copy frame buffer contents match the main frame buffer. To test if only the modified regions are updated after a sync, we will need to create situations where the two are mismatched. Split this check into another function that we can skip calling, since we won't want it to error on those mismatched cases. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/u-boot/20230821135111.3558478-2-alpernebiyasak@gmail.com/