summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2024-10-10test: dm: Add tests for LED boot and activityChristian Marangi
Add tests for LED boot and activity feature and add required property in sandbox test DTS. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-09-30power: regulator: Trigger probe of regulators which are always-on or boot-onMarek Vasut
In case a regulator DT node contains regulator-always-on or regulator-boot-on property, make sure the regulator gets correctly configured by U-Boot on start up. Unconditionally probe such regulator drivers. This is a preparatory patch for introduction of .regulator_post_probe() which would trigger the regulator configuration. Parsing of regulator-always-on and regulator-boot-on DT property has been moved to regulator_post_bind() as the information is required early, the rest of the DT parsing has been kept in regulator_pre_probe() to avoid slowing down the boot process. Signed-off-by: Marek Vasut <marex@denx.de>
2024-09-24Merge patch series "Miscellaneous fixes"Tom Rini
Jerome Forissier <jerome.forissier@linaro.org> says: Miscellaneous fixes made when developing the lwIP series [1]. They are posted separately since they make sense on their own. Subsequent versions of the lwIP series will contain a squashed version of this one. [1] http://patchwork.ozlabs.org/project/uboot/list/?series=420712&state=%2A&archive=both
2024-09-24test/py: test_efi_loader: add HTTP (wget) test for the EFI loaderJerome Forissier
Add a test to test_efi_loader.py similar to the TFTP test but for HTTP with the wget command. Suggested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Tom Rini <trini@konsulko.com> Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
2024-09-24test/py: test_efi_loader: add missing dependency on cmd_tftpbootJerome Forissier
test_efi_helloworld_net() and test_efi_grub_net() depend on cmd_tftpboot so add the missing annotations. Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-09-24test/py: net_boot: fix commentJerome Forissier
If env__pxe_boot_test_skip is not present, it defaults to True not False. Therefore fix the comment. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-09-24test/py/tests/test_bootstage.py: Combine stash/unstash testsTom Rini
When running the bootstage tests currently we get a warning like: tests/test_bootstage.py::test_bootstage_stash ...PytestReturnNotNoneWarning: Expected None, but tests/test_bootstage.py::test_bootstage_stash returned (37748736, 4096), which will be an error in a future version of pytest. Did you mean to use `assert` in stead of `return`? This is because the unstash test will run the stash test and fetch the addr / size from that. Rework the test to be stash and unstash and then run the unstash command at the end of the current stash test. Acked-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Love Kumar <love.kumar@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-09-18Merge patch series "Fix various bugs"Tom Rini
Simon Glass <sjg@chromium.org> says: This series includes the patches needed to make make the EFI 'boot' test work. That test has now been split off into a separate series along with the EFI patches. This series fixes these problems: - sandbox memory-mapping conflict with PCI - the fix for that causes the mbr test to crash as it sets up pointers instead of addresses for its 'mmc' commands - the mmc and read commands which cast addresses to pointers - a tricky bug to do with USB keyboard and stdio - a few other minor things
2024-09-18test: mbr: Drop a duplicate testSimon Glass
The test currently runs twice as it is declared twice. Unwind this. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18test: mbr: Use RAM for the buffersSimon Glass
The normal approach with sandbox is to use a fixed memory address in the RAM, to avoid needing to create a map for transient local variables. Update this test to use this approach. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18test: mbr: Use a constant for the block sizeSimon Glass
It isn't that important to factor out constants in tests, but in this case we have 0x200 and 512 used. The commands don't use the constant as they use a block count ('1'). It doesn't create more code to use a constant, so create one. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18test: mbr: Unmap the buffers after useSimon Glass
This tests maps some local variables into sandbox's address space. Make sure to unmap them afterwards. Note that the normal approach with sandbox is to use a fixed memory address in the RAM, to avoid needing to create a map for transient local variables. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 04291ee0aba ("cmd: mbr: Allow 4 MBR partitions without need...")
2024-09-18test: mbr: Adjust test to drop 0xSimon Glass
U-Boot commands typically don't need 0x to specify hex, since they use hex by default. Adding 0x in this test is confusing since it suggests that it is necessary. Drop it from the file. Also use the %#x construct to get the 0x when needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18test: mbr: Adjust test to use lower-case hexSimon Glass
Switch to lower-case hex which is more commonly used in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18dm: usb: Deal with USB keyboard persisting across testsSimon Glass
Clear any USB-keyboard devices before running a unit test, to avoid using a stale udevice pointer in stdio. Add a long comment to explain this situation and why this solution seems best, at least for now. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18bootstd: Create a function to reset USBSimon Glass
Set up a function for this, since it needs to be used from multiple test files. This test file is only used on sandbox, where USB is enabled, so drop the local declaration of usb_started Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18test/py: Fix some pylint warnings in test_ut.pySimon Glass
Tidy up most of these warnings. Remaining are four of these: R0914: Too many local variables which can only by fixed by splitting things into functions, so that is left for another time. Part of this change was done by the flynt tool. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-13Merge patch series "Bump new hush commits and fix old hush test behavior"Tom Rini
Francis Laniel <francis.laniel@amarulasolutions.com> says: Hi! With this series, I bumped the new hush to get the latest commits from upstream. Also, I added back a reverted commit which goal was to fix a bad behavior in old hush test. I had to tweak a bit this commit, but everything worked both locally and in the CI.
2024-09-13test: hush: dollar: fix bugous behaviorIon Agorria
The dollar test was merged with bugous console behavior, and instead of fixing it, this behavior was just workarounded. This was done to keep compatibility with the existing behavior. It seems like without the fix the ut_assert_skipline(); didn't clear console and running ut_assert_skipline(); many times would give always OK. With e58bafc35fe3 ("lib: membuff: fix readline not returning line in case of overflow") the line is cleared correctly and next assert fails because now there is nothing to clean which is correct if we look the this a bit above the failing assert: if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) { /* * For some strange reasons, the console is not empty after * running above command. * So, we reset it to not have side effects for other tests. */ console_record_reset_enable(); } else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) { ut_assert_console_end(); } Which further confirms that tests workaround the old problem and now that problem is fixed we can remove the whole if blocks and simply place ut_assert_console_end() right after ut_assert_skipline() without any conditional and will pass green. So this part of code goes from: ut_assert_skipline(); ut_assert_skipline(); if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) { /* See above comments. */ console_record_reset_enable(); } else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) { ut_assert_console_end(); } to become: ut_assert_skipline(); if (gd->flags & GD_FLG_HUSH_OLD_PARSER) { ut_assert_skipline(); } ut_assert_console_end(); The if block mentioned above that calls console_record_reset_enable() is completely removed as fixed by e58bafc35fe3. [flaniel: adapt second if] Signed-off-by: Ion Agorria <ion@agorria.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20240105072212.6615-8-clamor95@gmail.com [mkorpershoek: reworded commit title] Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> [flaniel: remove console_record_reset_enable() if] Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
2024-09-12test: lib/uuid: add tests for UUID version/variant bitsCaleb Connolly
Add a test to check the version/variant bits of v4 and v5 UUIDs. Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-09-12test: lib/uuid: add unit tests for dynamic UUIDsCaleb Connolly
Add some basic unit tests to validate that the UUID generation behaves as expected. This matches the implementation in efi_loader for sandbox and a Qualcomm board and should catch any regressions. Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-09-12include: export uuid.hCaleb Connolly
Move this header to include/u-boot/ so that it can be used by external tools. Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-09-12sandbox: switch to dynamic UUIDsCaleb Connolly
Migrate sandbox over to generating it's capsule update image GUIDs dynamically from the namespace and board/image info. Update the reference and tests to use the new GUIDs. Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-09-10test/py: spi: Set the expected error messageLove Kumar
If erase/write/read size is 0 then it throws the mentioned error message when debug message ie enabled as per 899fb5aa8bec ("cmd: sf/nand: Print and return failure when 0 length is passed"), setting it to None as debug message is not enabled by default for testing. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-09-09phy: test: Implement sandbox PHY .set_mode and DM testMarek Vasut
Implement trivial extension to the sandbox PHY, which makes it pretend to support selecting USB Host mode and nothing else. Any other mode is rejected with -EINVAL. Any submode except for default submode 0 is rejected with -EOPNOTSUPP . The implementation behaves in this trivial way to permit easy unit testing using test which is also added in this commit. To run the test, use e.g. sandbox64_defconfig and run U-Boot as follows: $ ./u-boot -Tc 'ut dm phy_setup' Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-09-09phy: Extend generic_setup_phy() with PHY mode and submodeMarek Vasut
Extend generic_setup_phy() parameter list with PHY mode and submode and call generic_phy_set_mode() in generic_setup_phy(), so the generic PHY setup function can configure the PHY into correct mode before powering the PHY up. Update all call sites of generic_setup_phy() as well, all of which are USB host related, except for DM test which now behaves as a USB host test. Note that if the PHY driver does not implement the .set_mode callback, generic_phy_set_mode() call returns 0 and does not error out, so this should not break any existing systems. Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-09-03Merge patch series "Make LMB memory map global and persistent"Tom Rini
Sughosh Ganu <sughosh.ganu@linaro.org> says: This is a follow-up from an earlier RFC series [1] for making the LMB and EFI memory allocations work together. This is a non-rfc version with only the LMB part of the patches, for making the LMB memory map global and persistent. This is part one of a set of patches which aim to have the LMB and EFI memory allocations work together. This requires making the LMB memory map global and persistent, instead of having local, caller specific maps. This is being done keeping in mind the usage of LMB memory by platforms where the same memory region can be used to load multiple different images. What is not allowed is to overwrite memory that has been allocated by the other module, currently the EFI memory module. This is being achieved by introducing a new flag, LMB_NOOVERWRITE, which represents memory which cannot be re-requested once allocated. The data structures (alloced lists) required for maintaining the LMB map are initialised during board init. The LMB module is enabled by default for the main U-Boot image, while it needs to be enabled for SPL. This version also uses a stack implementation, as suggested by Simon Glass to temporarily store the lmb structure instance which is used during normal operation when running lmb tests. This does away with the need to run the lmb tests separately. The tests have been tweaked where needed because of these changes. The second part of the patches, to be sent subsequently, would work on having the EFI allocations work with the LMB API's. [1] - https://lore.kernel.org/u-boot/20240704073544.670249-1-sughosh.ganu@linaro.org/T/#t Notes: 1) These patches are on next, as the alist patches have been applied to that branch. 2) I have tested the boot on the ST DK2 board, but it would be good to get a T-b/R-b from the ST maintainers. 3) It will be good to test these changes on a PowerPC platform (ideally an 85xx, as I do not have one).
2024-09-03lmb: make LMB memory map persistent and globalSughosh Ganu
The current LMB API's for allocating and reserving memory use a per-caller based memory view. Memory allocated by a caller can then be overwritten by another caller. Make these allocations and reservations persistent using the alloced list data structure. Two alloced lists are declared -- one for the available(free) memory, and one for the used memory. Once full, the list can then be extended at runtime. [sjg: Use a stack to store pointer of lmb struct when running lmb tests] Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Signed-off-by: Simon Glass <sjg@chromium.org> [sjg: Optimise the logic to add a region in lmb_add_region_flags()]
2024-09-02Merge tag 'v2024.10-rc4' into nextTom Rini
Prepare v2024.10-rc4
2024-08-30list: use list_count_nodes() to count list entriesSughosh Ganu
Use the API function list_count_nodes() to count the number of list entries. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27test/py: spi: Add tests for SPI flash deviceLove Kumar
Add test cases for sf commands to verify various SPI flash operations such as erase, write and read. It also adds qspi lock unlock cases. This test relies on boardenv_* configurations to run it for different SPI flash family such as single SPI, QSPI, and OSPI. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-08-26Merge patch series "Tidy up console recording in tests"Tom Rini
Simon Glass <sjg@chromium.org> says: This series started as a small fix for checking for an empty line, but in the process several other problems were found and fixed: - fix tests which use console recording but don't set the flag - drop unnecessary resetting of the console in tests - drop unnecessary blank line before MMC output - update the docs a little - fix buildman test failure on newer Pythons - a few other minor things This series also renames the confusing flag names, so that they are easier to remember - just a UTF_ (unit-test flags) prefix.
2024-08-26test: Tidy up checking for console endSimon Glass
Use the ut_assert_console_end() function provided, rather than doing it separately. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: dm: Use UTF_CONSOLE in testsSimon Glass
Set this flag rather than doing things manually in the test. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: Use UTF_CONSOLE in remaining testsSimon Glass
Set this flag rather than doing things manually in the test. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: cmd: Drop unnecessary console_record_reset_enable()Simon Glass
It is seldom necessary to call this function. Drop its use in the command tests. Add a few extra checks to the wget test so that resetting is not needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: log: Use UTF_CONSOLE in testsSimon Glass
Set this flag rather than doing things manually in the test. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: cmd: Use UTF_CONSOLE in testsSimon Glass
Set this flag rather than doing things manually in the test. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: hush: Use UTF_CONSOLE in testsSimon Glass
Set this flag rather than doing things manually in the test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26test: fdt: Move common code into the setup functionsSimon Glass
Quite a lot of tests have the same two lines of code at the start. Move this into the two setup functions to reduce redundancy. Add a line to check the output from set_working_fdt_addr() since this is always emitted. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: fdt: Check internal-function return valuesSimon Glass
Some functions are using asserts but the result of the functions themselves is not checked. This means that if a test fails, the result is not noticed until later, which can be confusing to debug. Add the missing asserts. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: boot: Use UTF_CONSOLE in testsSimon Glass
Set this flag rather than doing things manually in the test. Drop unnecessary calls to console_record_reset_enable() Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26test: bloblist: Use UTF_CONSOLE in testsSimon Glass
Set this flag rather than doing things manually in the test. Drop the code which is now unnecessary. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: Update NAND test to avoid extra macrosSimon Glass
Write out the tests in full to allow the test to be found more easily when there is a failure. We could use a single test function with a for() loop but this would stop at the first failure, and some variations might while other pass. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: Rename UTF_CONSOLE_REC to UTF_CONSOLESimon Glass
The _REC suffix doesn't add much. Really what we want to know is whether the test uses the console, so rename this flag. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26test: Drop the blank line before test macrosSimon Glass
Most tests don't have this. It helps to keep the test declaration clearly associated with the function it relates to, rather than the next one in the file. Remove the extra blank line and mention this in the docs. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: Rename unit-test flagsSimon Glass
The UT_TESTF_ macros read as 'unit test test flags' which is not right. Rename to UTF ('unit test flags'). This has the benefit of being shorter, which helps keep UNIT_TEST() declarations on a single line. Give the enum a name and reference it from the UNIT_TEST() macros while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26test: Fail when an empty line is expected but not presentSimon Glass
The existing implementation of ut_assert_nextline_empty() cannot distinguish between an empty line and no line at all. It can in fact be called at the end of the recorded output and will happily return success. Adjust the logic so that this condition is detected. Show a failure message in this case. Fix the one test which falls foul of this fix. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 400175b0a7d ("test: Add a way to check each line of console...") Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26global_data: log: Reorder and shrink fieldsSimon Glass
Some of the logging fields are larger than they need to be. Shrink them and adjust the ordering to improve alignment. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26board_f: Move fdt_size to boardSimon Glass
This value is only really used before relocation. There is not much use to showing its value in bdinfo, so drop it. Move it to the new boardf struct. Signed-off-by: Simon Glass <sjg@chromium.org>