summaryrefslogtreecommitdiff
path: root/test/cmd
AgeCommit message (Collapse)Author
13 daystest: cmd: consider configuration in meminfo testHeinrich Schuchardt
The output of the meminfo command depends on several Kconfig variables. These need to be taken into account to provide valid test results. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <simon.glass@canonical.com>
13 dayscmd/meminfo: display of addresses above 4 GiBHeinrich Schuchardt
Addresses above 4 GiB don't fit into 8 digits. Use 13 digits which encompass up to 15 TiB. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <simon.glass@canonical.com>
2026-01-02cmd: bdinfo: fix incorrect Kconfig options check for print_eth()Quentin Schulz
CMD_NET_LWIP has never existed so it cannot be right. I'm guessing the intent was to allow print_eth() to be called when NET_LWIP is defined (NET means "legacy networking stack" as opposed to NET_LWIP which is the newest (and incompatible) stack). There probably was some mix-up between CMD_NET and NET options. The dependency on CMD_NET seems unnecessary as it seems perfectly fine to run bdinfo without CMD_NET (build and run tested). So let's instead make the dependency on NET || NET_LWIP. Let's sync the unit test as well. Fixes: 95744d2527cb ("cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y") Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-12-24cmd: bdinfo: provide long help with all optionsQuentin Schulz
Document the bdinfo -a, -e and -m options in the long help, but only when they can be used. The string concatenation is a bit odd with two newlines, but it does render properly once in U-Boot CLI. Tested-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-12-24cmd/bdinfo: LMB and device-tree are not relatedHeinrich Schuchardt
The usage of the LMB library and the device-tree source are not related. Remove the dependency in the bdinfo output and adjust the unit test. Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-08Merge tag 'v2026.01-rc4' into nextTom Rini
Prepare v2026.01-rc4
2025-12-05Merge patch series "test: let UNIT_TEST imply CONSOLE_RECORD"Tom Rini
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says: Many C unit tests are not executed if CONFIG_CONSOLE_RECORD is not set. Hence Tom suggested to let UNIT_TEST imply CONSOLE_RECORD. The first patch makes the skipped C unit tests visible. The rest of the series deals with hidden bugs in our tests. The 'fdt get value' command returned incorrect values on low-endian systems. So this needed fixing too. Link: https://lore.kernel.org/r/20251123225711.227016-1-heinrich.schuchardt@canonical.com
2025-12-05cmd: fix 'fdt get value'Heinrich Schuchardt
The 32bit cells of a device-tree property are big-endian. When printing them via 0x08x we must first convert to the host endianness. Remove the restriction to 20 bytes length. This would not allow to read an SHA256 value. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: cmd/bdinfo: consider PPC architecture specific infoHeinrich Schuchardt
On the power architecture the bdinfo command prints architecture specific information. The test needs to accept these output lines. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: fix cmt/msr testHeinrich Schuchardt
The original value of the first variable msr (0x200) is not controlled by U-Boot. Don't make any assumption. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: fix bdinfo_test_all boot_params expectationHeinrich Schuchardt
The value of boot_params is device specific and non-zero on many boards. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: correct comments in test/cmd/font.cHeinrich Schuchardt
The test relates to the 'font' and not to the 'fdt' command. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: the cmd/font test requires the sandboxHeinrich Schuchardt
The font test makes assumptions about video devices and selected fonts that may not hold true on other configurations like qemu-x86_64_defconfig. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: do not assume memory size 256 MiB in cmd_test_meminfoHeinrich Schuchardt
256 GiB is the default memory size of the sandbox. But in our CI other boards like qemu-x86_64_defconfig run with a different memory size. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-12-05test: cmd_exit_test depends on CONFIG_HUSH_PARSERHeinrich Schuchardt
The exit command is not available if CONFIG_HUSH_PARSER=n Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: bdinfo: correct expected X86 arch infoHeinrich Schuchardt
Skipping to the line starting with tsc reaches the tsc_base output not the final tsc output. Expect all the X86 specific lines in the bdinfo output. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-05test: cmd/bdinfo: consider ARM architecture specific infoHeinrich Schuchardt
On ARM the bdinfo command prints architecture specific information. The test needs to accept these output lines. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-12-04Merge patch series "Add support for SM3 secure hash"Tom Rini
Heiko Schocher <hs@nabladev.com> says: Add SM3 secure hash, as specified by OSCCA GM/T 0004-2012 SM3 and described at https://datatracker.ietf.org/doc/html/draft-sca-cfrg-sm3-02 TPMv2 defines hash algo sm3_256, which is currently not supported and prevented TPMv2 chip with newer firmware to work with U-Boot. Seen this on a ST33TPHF2XI2C u-boot=> tpm2 init u-boot=> tpm2 autostart tpm2_get_pcr_info: too many pcrs: 5 Error: -90 u-boot=> Implement sm3 hash, so we can fix this problem. Link: https://lore.kernel.org/r/20251118043042.27726-1-hs@nabladev.com
2025-12-04test: cmd: fix a typo in md5 testHeiko Schocher
In dm_test_cmd_hash_md5 accidentially sha256 hash ist used. Use the correct md5 hash instead. Signed-off-by: Heiko Schocher <hs@nabladev.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-12-04test: cmd: hash: add unit test for sm3_256Heiko Schocher
add simple test for sm3 256 hash Signed-off-by: Heiko Schocher <hs@nabladev.com>
2025-12-02boot/bootfdt: Add smbios3-entrypoint to FDT for non-EFI bootsAdriana Nicolae
The Linux kernel can discover SMBIOS tables through two primary methods: 1. Via EFI tables, when using EFI boot; 2. Via the 'smbios3-entrypoint' property in the /chosen node of the device tree. When U-Boot boots a Linux kernel using a non-EFI command ("bootm", "bootz", or "booti"), the kernel relies on the device tree to detect the hardware. If SMBIOS tables are available in U-Boot, they should be passed to the kernel via this device tree property. This patch modifies boot_fdt_prepare(), to inject the SMBIOSv3 table address into the device tree if there is a table generated by U-boot. The "board_fdt_chosen_smbios" is weak in order to leave the possibilty for specific boards to select custom SMBIOS addresses. The changes in this patch are added in the context of supporting this device tree property in linux kernel: https://lkml.org/lkml/2025/10/24/1393 Device tree schema was updated to include the "smbios3-entrypoint" node in pull request: https://github.com/devicetree-org/dt-schema/pull/177 Signed-off-by: Adriana Nicolae <adriana@arista.com>
2025-11-21test: cmd/fdt: do not use fixed buffer addressesHeinrich Schuchardt
The location of memory depends on the board. Do not assume memory at fixed memory locations. Use memalign() instead to allocate a buffer. Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-11-21test: cmd/bdinfo: consider arch_print_bdinfo() outputHeinrich Schuchardt
On x86 commit 9b35dbc93fd4 ("x86: Show the timestamp counter with bdinfo") has added another bdinfo output line. On RISC-V commit 66b5ee9c558e ("riscv: add RISC-V fields to bdinfo command") implemented arch_print_bdinfo(). Update the bdinfo test accordingly. Fixes: 9b35dbc93fd4 ("x86: Show the timestamp counter with bdinfo") Fixes: 66b5ee9c558e ("riscv: add RISC-V fields to bdinfo command") Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-11-21test: cmd/bdinfo: make no flash assumptionHeinrich Schuchardt
The location and size of flash is device-dependent. Do not make any assumption about the location and size. Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-11-21test: cmd/fdt: do not assume RNG device existsHeinrich Schuchardt
In fdt_test_chosen() currently we test if DM_RNG is configured. CONFIG_DM_RNG=y does not imply that a RNG device actually exists. For instance QEMU may be called with -device virtio-rng-device or not. The current test framework evicts the virtio RNG device even if QEMU is called with -device virtio-rng-device. In the fdt_test_chosen() check if a RNG device exists. Ignore 'No RNG device' messages. Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-11-21test: fdt_test_apply requires CONFIG_OF_LIBFDT_OVERLAYHeinrich Schuchardt
The `fdt apply` sub-command is only available if CONFIG_OF_LIBFDT_OVERLAY is enabled. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-11-06test: provide test for 'acpi list' commandHeinrich Schuchardt
Check that some mandatory ACPI tables exist: - RSDP - RSDT or XSDT - FADT Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-11-06qfw: Add more fields and a heading to qfw listSimon Glass
Update the command to show the size and selected file, since this is useful information at times. Add a heading so it is clear what each field refers to. Add a simple test as well. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-10-08thermal: Convert .get_temp() return value to millicelsiusMarek Vasut
Linux kernel .get_temp() callback reports values in millicelsius, U-Boot currently reports them in celsius. Align the two and report in millicelsius. Update drivers accordingly. Update callsites that use thermal_get_temp() as well. The 'temperature' command now reports temperature in millicelsius as well, with additional accuracy. This changes command line ABI slightly. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: David Zang <davidzangcs@gmail.com> [trini: Update test/cmd/temperature.c] Signed-off-by: Tom Rini <trini@konsulko.com>
2025-08-06test: cmd: Add simple test for i3cDinesh Maniyam
Add simple test to check i3c controller defined in sandbox test DT. Basically, this test case will check validity of the i3c controller by probing it and perform basic commands of cmd/i3c.c Signed-off-by: Dinesh Maniyam <dinesh.maniyam@altera.com>
2025-07-03test: wget: add a test case for validating URISughosh Ganu
The wget module has a function wget_validate_uri() which is used for validating the URI to be used by wget. Add a basic test case for this function. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
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-04-23Merge patch series "Uthreads"Tom Rini
Jerome Forissier <jerome.forissier@linaro.org> says: This series introduces threads and uses them to improve the performance of the USB bus scanning code and to implement background jobs in the shell via two new commands: 'spawn' and 'wait'. The threading framework is called 'uthread' and is inspired from the barebox threads [2]. setjmp() and longjmp() are used to save and restore contexts, as well as a non-standard extension called initjmp(). This new function is added in several patches, one for each architecture that supports HAVE_SETJMP. A new symbol is defined: HAVE_INITJMP. Two tests, one for initjmp() and one for the uthread scheduling, are added to the lib suite. After introducing threads and making schedule() and udelay() a thread re-scheduling point, the USB stack initialization is modified to benefit from concurrency when UTHREAD is enabled, where uthreads are used in usb_init() to initialize and scan multiple busses at the same time. The code was tested on arm64 and arm QEMU with 4 simulated XHCI buses and some devices. On this platform the USB scan takes 2.2 s instead of 5.6 s. Tested on i.MX93 EVK with two USB hubs, one ethernet adapter and one webcam on each, "usb start" takes 2.4 s instead of 4.6 s. Finally, the spawn and wait commands are introduced, allowing the use of threads from the shell. Tested on the i.MX93 EVK with a spinning HDD connected to USB1 and the network connected to ENET1. The USB plus DHCP init sequence "spawn usb start; spawn dhcp; wait" takes 4.5 seconds instead of 8 seconds for "usb start; dhcp". [1] https://patchwork.ozlabs.org/project/uboot/list/?series=446674 [2] https://github.com/barebox/barebox/blob/master/common/bthread.c Link: https://lore.kernel.org/r/20250418141114.2056981-1-jerome.forissier@linaro.org
2025-04-23test: cmd: add test for spawn and wait commandsJerome Forissier
Test the spawn and wait commands. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-04-22test: run some test commands only if HUSH_PARSER is enabledJerome Forissier
Some test commands (such as "false", or the empty string) need CONFIG_HUSH_PARSER=y. Fix test/cmd/command.c. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-04-11Kbuild: Always use $(PHASE_)Tom Rini
It is confusing to have both "$(PHASE_)" and "$(XPL_)" be used in our Makefiles as part of the macros to determine when to do something in our Makefiles based on what phase of the build we are in. For consistency, bring this down to a single macro and use "$(PHASE_)" only. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-11test: Drop suites.hSimon Glass
This file is empty now. Remove it and its uses. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-07cmd/setexpr: support concatenation of direct stringsHeinrich Schuchardt
The setexpr.s command allows to concatenate two strings. According to the description in doc/usage/cmd/setexpr.rst the parameters value1 and value2 can be either direct values or pointers to a memory location holding the values. Unfortunately `setexpr.s <value1> + <value2>` fails if any of the values is a direct value. $? is set to false. * Add support for direct values in setexpr.s. * Correct the unit test for "setexpr.s fred 0". * Add a new unit test for "setexpr.s fred '1' + '3'" giving '13'. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-02-07test: remove available memory check in setexpr_test_str_oper()Heinrich Schuchardt
env_set() frees the previous value after allocating the new value. As the free() may merge memory chunks the available memory is not expected to stay constant. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-02-07test: remove available memory check in setexpr_test_str()Heinrich Schuchardt
env_set() frees the previous value after allocating the new value. As the free() may merge memory chunks the available memory is not expected to stay constant. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-02-07test: clean up setexpr_test_str()Heinrich Schuchardt
Assign variable buf in the sub-test where it is used. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-27test/cmd/wget.c: Fix loadaddr rewriteMarek Vasut
The $loadaddr variable is a hexadecimal value, not a string, it must be assigned using env_set_hex(). This may break follow up tests, like the dm_test_cmd_hash_md5 in CI. To avoid any interference with other tests, set $wgetaddr variable which is specific to this test and use it in the test. Fixes: 20f641987f83 ("test/cmd/wget.c: move net_test_wget() to the cmd test suite") Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Fabio Estevam <festevam@gmail.com>
2025-01-24test: Drop the function for running seama testsSimon Glass
Use the new suite-runner to run these tests instead. It is not clear that these actually work, since they are not enabled on sandbox for some reason. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-24test: Drop the function for running pci_mps testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running loadm testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running addrmap testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running setexpr testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running mem testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running mbr testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>