aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2022-04-25Merge branch '2022-04-25-initial-implementation-of-stdboot'Tom Rini15-42/+1020
To quote the author: The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting. It introduces the following concepts: - bootdev - a device which can hold a distro - bootmeth - a method to scan a bootdev to find bootflows (owned by U-Boot) - bootflow - a description of how to boot (owned by the distro) This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot. With this we can boot on a Raspberry Pi 3 with just one command: bootflow scan -lb which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this. With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only. ... The design is described in these two documents: https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
2022-04-25bootstd: Add setup for the bootflow testsSimon Glass2-0/+103
We need to create a disk image with a partition table and a DOS-format filesystem containing a few files. Provide a fallback binary for CI since it does not seem able to detect the loopback partitions. Add this to a dm_init test so that it happens when needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add tests for bootstd including all uclassesSimon Glass8-0/+820
Add a set of combined tests for the bootdev, bootflow and bootmeth commands, along with associated functionality. Expand the sandbox console-recording limit so that these can work. These tests rely on a filesystem script which is not yet added to the Python tests. It is included here as a shell script. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: dm: Restart USB before assuming it is stoppedSimon Glass1-0/+6
Update the blk test to stop USB first, in case another test has started it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: fastboot: Avoid using mmc1Simon Glass1-2/+2
The bootflow tests need to use an MMC with an associated backing file containing a filesystem. Update the fastboot tests to cope with this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Allow finding a uclass device by partial nameSimon Glass1-0/+15
In some cases two devices are related and the only way to tell is to check that the names partially patch. Add a way to check this without needing to create a new string for the comparison. Fix the comment for device_find_child_by_namelen() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Rename and fix uclass_get_by_name_len()Simon Glass1-0/+2
It seems that namelen is more common in U-Boot. Rename this function to fit in better. Also fix a bug where it breaks the operation of uclass_get_by_name() and add a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reported-by: Tim Harvey <tharvey@gateworks.com>
2022-04-25lib: Add a way to find the postiion of a trailing numberSimon Glass1-1/+12
At present it is not possible to find out which part of the string is the number part and which is before it. Add a new variant which provides this feature, so we can separate the two in the caller. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Fix a few bugs in trailing_strtoln()Simon Glass1-0/+2
At present this has a minor bug in that it reads the byte before the start of the string, if it is empty. Also it doesn't handle a non-numeric prefix which is only one character long. Fix these bugs with a reworked implementation. Add a test for the second case. The first one is hard to test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: Add tests for trailing_strtol()Simon Glass1-0/+19
This function currently has no tests. Add some. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Move string tests to the string moduleSimon Glass2-40/+40
A few string tests were added to the print module by mistake. Move them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-23test: dm: add tests for tag supportAKASHI Takahiro2-0/+85
The new test covers all tag-related interfaces. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-20cmd: gpio: Add `gpio read` subcommandDiego Rondini1-0/+14
As explained in commit 4af2a33ee5b9 ("cmd: gpio: Make `gpio input` return pin value again") the `gpio input` is used in scripts to obtain the value of a pin, despite the fact that CMD_RET_FAILURE is indistinguishable from a valid pin value. To be able to detect failures and properly use the value of a GPIO in scripts we introduce the `gpio read` command that sets the variable `name` to the value of the pin. Return code of the `gpio read` command can be used to check for CMD_RET_SUCCESS or CMD_RET_FAILURE. CONFIG_CMD_GPIO_READ is used to enable the `gpio read` command. Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
2022-04-18dm: core: Allow devres to be disabled in SPLSimon Glass1-1/+1
At present if devres is enabled in U-Boot proper it is enabled in SPL. We don't normally want it there, so disable it. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Angus Ainslie <angus@akkea.ca>
2022-04-15Merge tag 'efi-2022-07-rc1-2' of ↵WIP/15Apr2022Tom Rini3-114/+265
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-07-rc1-2 Documentation: * Describe env command UEFI * simplify Unicode string functions * clean up the usage of GUIDs for capsule updates
2022-04-15Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-netTom Rini3-17/+39
- DM9000 DM support - tftp server bug fix - mdio ofnode support functions - Various phy fixes and improvements. [trini: Fixup merge conflicts in drivers/net/phy/ethernet_id.c drivers/net/phy/phy.c include/phy.h]
2022-04-15test: capsule: Modify the capsule tests to use GUID values for sandboxSughosh Ganu3-114/+265
The current UEFI capsule updation code uses two GUID values, one for FIT images, and one for raw images across platforms. This logic is being changed to have GUID values per image, per platform. Change the tests for the capsule update code to reflect this change. The GUID values now used are the ones specific to the sandbox platform -- one for the u-boot image, and another for the u-boot environment image. Install the FMP instance for raw images on the sandbox variant for testing the capsule update code. Install the FMP instance for the FIT images on the sandbox64 and sandbox_flattree variant for testing capsule update for FIT images. This is being done by splitting the capsule update script for FIT and raw images. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2022-04-14test: serial: Add test for putc/putsSean Anderson1-0/+19
This adds a test to ensure that puts is equivalent to putc called in a loop. We don't verify the contents of the message to avoid having to record console output a second time (though that could be added in the future). The globals are initialized to non-zero values to avoid a warning; in particular, the character count is off-by-one (but we always make relative measurements). Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-14led: Configure LED default-state on bootMarek Vasut1-1/+1
In case the DT LED subnode contains "default-state" property set to either "on" or "off", probe the LED driver and configure the LED state automatically. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Philippe Reynes <philippe.reynes@softathome.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> [trini: Update the relevant test now that we have support] Signed-off-by: Tom Rini <trini@konsulko.com>
2022-04-10net: introduce helpers to get PHY interface mode from a device/ofnodeMarek Behún1-0/+4
Add helpers ofnode_read_phy_mode() and dev_read_phy_mode() to parse the "phy-mode" / "phy-connection-type" property. Add corresponding UT test. Use them treewide. This allows us to inline the phy_get_interface_by_name() into ofnode_read_phy_mode(), since the former is not used anymore. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-10treewide: use dm_mdio_read/write/reset() wrappersMarek Behún2-17/+17
Use the new dm_mdio_read/write/reset() wrappers treewide, instead of always getting and dereferencing MDIO operations structure pointer. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2022-04-10net: introduce helpers to get PHY ofnode from MACMarek Behún1-0/+18
Add helpers ofnode_get_phy_node() and dev_get_phy_node() and use it in net/mdio-uclass.c function dm_eth_connect_phy_handle(). Also add corresponding UT test. This is useful because other part's of U-Boot may want to get PHY ofnode without connecting a PHY. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-08test/py:Update python tests for ‘gpio’ cmdAdarsh Babu Kalepalli1-1/+174
Generic Python Test cases are developed to verfiy 'gpio' command. Signed-off-by: Adarsh Babu Kalepalli <opensource.kab@gmail.com>
2022-04-07env: Allow text-env tests to run with awkSimon Glass1-14/+14
At present the tests assume that gawk is being used. Adjust the tests so that the names are inserted in alphabetical order, so that awk is happy. Also use PROCINFO to make gawk output in alphabetical order. This is not ideal, since it changes the env-car ordering from what the user provided, but it may be acceptable. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Fixes: https://source.denx.de/u-boot/u-boot/-/issues/10
2022-04-06dm: blk: Expand iteration and add testsWIP/2022-04-06-various-verified-boot-bugfixesSimon Glass1-0/+111
Add some functions which support iteration before probing. Also add tests for the functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-06abuf: Correct a corner case with abuf_realloc()Simon Glass1-0/+29
If the buffer is empty and not allocated, then abuf_realloc() tries to copy invalid data. This happens because an incorrect change to use memdup() was added after the original code was written. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-04Merge branch 'next'Tom Rini20-92/+677
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-03-31test: py: vboot: add test for global image signaturePhilippe Reynes6-16/+272
Adds test units for the pre-load header signature. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-03-31arch: Kconfig: imply BINMAN for SANDBOXPhilippe Reynes2-0/+6
To be able to use the tool binman on sandbox, the config SANDBOX should imply BINMAN. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-03-31test: fix pylint warnings in test_efi_bootmgrHeinrich Schuchardt2-9/+18
* Use f'' strings instead of .format(). * Correct sequence of imports. * Remove a superfluous import. * Add missing documentation. * Replace yield by return. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-03-31test: fix pylint warnings for test_efi_fit.pyHeinrich Schuchardt1-15/+16
* fix style of argument documentation * add encoding to open() calls Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-03-28Merge tag 'v2022.04-rc5' into nextTom Rini3-1/+75
Prepare v2022.04-rc5
2022-03-26test: test UEFI boot managerHeinrich Schuchardt2-0/+74
Provide a unit test for * efidebug boot add * efidebug boot order * bootefi bootmgr * initrd via EFI_LOAD_FILE2_PROTOCOL Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-03-18sandbox: test: Tidy up spl_test_load() callsSimon Glass1-5/+1
Use the new sandbox_find_next_phase() function, which does what is needed here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-16Merge tag 'xilinx-for-v2022.07-rc1' of ↵WIP/16Mar2022-nextTom Rini1-4/+4
https://source.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2022.07-rc1 microblaze: - Add support for reserved memory xilinx: - Update FRU code with MAC reading zynqmp: - Remove double AMS setting - DT updates (mostly for SOMs) - Add support for zcu106 rev 1.0 zynq: - Update nand binding nand: - Aligned zynq_nand to upstream DT binding net: - Add support for ethernet-phy-id mmc: - Workaround CD in zynq_sdhci driver also for ZynqMP - Add support for dynamic/run-time SD config for SOMs gpio: - Add driver for slg7xl45106 firmware: - Add support for dynamic SD config power-domain: - Update zynqmp driver with the latest firmware video: - Add skeleton driver for DP and DPDMA i2c: - Fix i2c to work with QEMU pinctrl: - Add driver for zynqmp pinctrl driver
2022-03-15test/py: Add tests for the erofsWIP/2022-03-15-add-erofs-supportHuang Jianan1-0/+211
Add Python scripts to test 'ls' and 'load' commands, as well as test related filesystem functions. Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2022-03-15k210: use the board vendor name rather than the marketing nameDamien Le Moal1-1/+1
"kendryte" is the marketing name for the K210 RISC-V SoC produced by Canaan Inc. Rather than "kendryte,k210", use the usual "canaan,k210" vendor,SoC compatibility string format in the device tree files and use the SoC name for file names. With these changes, the device tree files are more in sync with the Linux kernel DTS and drivers, making uboot device tree usable by the kernel. Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2022-03-14cmd: test: pinmux: Do not check all empty spacesMichal Simek1-4/+4
There is really no value to check empty spaces. That's why use ut_assert_nextlinen() instead of ut_assert_nextline(). This change ensures that PINMUX_SIZE can be increased without changing tests. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Link: https://lore.kernel.org/r/03aecf4c67ec8d72bf2a90baf1516fc5bd300fe0.1646668094.git.michal.simek@xilinx.com
2022-03-10event: Add a script to decode the event-spy listSimon Glass1-0/+20
For debugging and dicoverability it is useful to be able to see a list of each event spy in a U-Boot ELF file. Add a script which shows this, along with the event type and the source location. This makes events a little easier to use than weak functions, for example. Add a basic sandbox test as well. We could provide a test for other boards, but for now, few use events. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10event: Add events for device probe/removeSimon Glass1-0/+38
Generate events when devices are probed or removed, allowing hooks to be added for these situations. This is controlled by the DM_EVENT config option. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10event: Add a simple testSimon Glass3-0/+52
Add a test for event registration and activation. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-02firmware: scmi: fix sandbox and related tests for clock discoveryEtienne Carriere1-5/+10
Updates sandbox SCMI clock driver and tests since enabling CCF will mandate clock discovery that is all exposed SCMI clocks shall be discovered at initialization. For this reason, sandbox SCMI clock driver must emulate all clocks exposed by SCMI server, not only those effectively consumed by some other U-Boot devices. Therefore the sandbox SCMI test driver exposes 3 clocks (IDs 0, 1 and 2) and sandbox SCMI clock consumer driver gets 2 of them. Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-03-02sandbox: scmi: test against a single scmi agentEtienne Carriere1-61/+53
As per DT bindings since Linux kernel v5.14, the device tree can define only 1 SCMI agent node that is named scmi [1]. As a consequence, change implementation of the SCMI driver test through sandbox architecture to reflect that. This change updates sandbox test DT and sandbox SCMI driver accordingly since all these are impacted. Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-03-02test: Correct pylint errorsSimon Glass4-6/+15
Fix pylint errors in all test. This requires adding a get_spawn() method to the ConsoleBase base, so that its subclass is happy. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-26efi_loader: test/py: Reset system after capsule update on diskMasami Hiramatsu1-14/+23
Add a cold reset soon after processing capsule update on disk. This is required in UEFI specification 2.9 Section 8.5.5 "Delivery of Capsules via file on Mass Storage device" as; In all cases that a capsule is identified for processing the system is restarted after capsule processing is completed. This also reports the result of each capsule update so that the user can notice that the capsule update has been succeeded or not from console log. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-02-26test/py: Handle expected reboot while booting sandboxMasami Hiramatsu2-22/+33
Add expected_reset optional argument to ConsoleBase::ensure_spawned(), ConsoleBase::restart_uboot() and ConsoleSandbox::restart_uboot_with_flags() so that it can handle a reset while the 1st boot process after main boot logo before prompt correctly. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-02-26test/py: Handle expected reset by commandMasami Hiramatsu1-41/+58
Add wait_for_reboot optional argument to ConsoleBase::run_command() so that it can handle an expected reset by command execution. This is useful if a command will reset the sandbox while testing such commands, e.g. run_command("reset", wait_for_reboot = True) Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-02-11Merge tag 'efi-2022-04-rc2-4' of ↵Tom Rini6-10/+439
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-04-rc2-4 Documentation: * mkeficapsule man-page UEFI changes: * add support for signing images to mkeficapsule * add support for user define capsule GUID * adjust unit tests for capsules * fix UEFI image signature validation in case of multiple signatures
2022-02-11test/py: efi_secboot: adjust secure boot tests to code changesIlias Apalodimas1-2/+28
The previous patch is changing U-Boot's behavior wrt certificate based binary authentication. Specifically an image who's digest of a certificate is found in dbx is now rejected. Fix the test accordingly and add another one testing signatures in reverse order Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-02-11test/py: efi_capsule: check the results in case of CAPSULE_AUTHENTICATEAKASHI Takahiro1-4/+22
Before the capsule authentication is supported, this test script works correctly, but with the feature enabled, most tests will fail due to unsigned capsules. So check the results depending on CAPSULE_AUTHENTICATE or not. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>