aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2023-10-17test: spl: Add a test for the SPI load methodSean Anderson5-0/+61
Add test for the SPI load method. This one is pretty straightforward. We can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image doesn't know the total image size and has to guess from fdt_totalsize. This doesn't include external data, so loading it will fail. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for the NOR load methodSean Anderson3-6/+303
Add a test for the NOR load method. Since NOR is memory-mapped we can substitute a buffer instead. The only major complication is testing LZMA decompression. It's too complex to implement LZMA compression in a test, and we have no in-tree compressor, so we just include some pre-compressed data. This data was generated through something like generate_data(plain, plain_size, "lzma") cat plain.dat | lzma | hexdump -C and was cleaned up further in my editor. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for the NET load methodSean Anderson3-0/+262
Add a test for loading U-Boot over TFTP. As with other sandbox net routines, we need to initialize our packets manually since things like net_set_ether and net_set_udp_header always use "our" addresses. We use BOOTP instead of DHCP, since DHCP has a tag/length-based format which is harder to parse. Our TFTP implementation doesn't define as many constants as I'd like, so I create some here. Note that the TFTP block size is one-based, but offsets are zero-based. In order to avoid address errors, we need to set up/define some additional address information settings. dram_init_banksize would be a good candidate for settig up bi_dram, but it gets called too late in board_init_r. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for the MMC load methodSean Anderson3-5/+101
Add a test for the MMC load method. This shows the general shape of tests to come: The main test function calls do_spl_test_load with an appropriate callback to write the image to the medium. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for spl_blk_load_imageSean Anderson2-1/+65
Add a test for spl_blk_load_image, currently used only by NVMe. Because there is no sandbox NVMe driver, just use MMC instead. Avoid falling back to raw images to make failures more obvious. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add functions to create filesystemsSean Anderson3-0/+318
Add some functions for creating fat/ext2 filesystems with a single file and a test for them. Filesystems require block devices, and it is easiest to just use MMC for this. To get an MMC, we must also pull in the test device tree. SPL_TIMER is necessary for SPL_MMC, perhaps because it uses a timeout. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add functions to create imagesSean Anderson2-3/+351
This add some basic functions to create images, and a test for said functions. This is not intended to be a test of the image parsing functions, but rather a framework for creating minimal images for testing load methods. That said, it does do an OK job at finding bugs in the image parsing directly. Since we have two methods for loading/parsing FIT images, add LOAD_FIT_FULL as a separate CI run. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Fix spl_test_load not failing if fname doesn't existSean Anderson1-4/+2
Returning a negative value from a unit test doesn't automatically fail the test. We have to fail an assertion. Modify the test to do so. This now causes the test to count as a failure on VPL. This is because the fname of SPL (and U-Boot) is generated with make_exec in os_jump_to_image. The original name of SPL is gone, and we can't determine the name of U-Boot from the generated name. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Split tests up and use some configsSean Anderson6-79/+106
In order to make adding new spl unit tests easier, especially when they may have many dependencies, add some Kconfigs for the existing image test. Split it into the parts which are generic (such as callbacks) and the test-specific parts. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same timeSean Anderson1-1/+1
Sandbox unit tests in U-Boot proper load a test device tree to have some devices to work with. In order to do the same in SPL, we must enable SPL_OF_REAL. However, we already have SPL_OF_PLATDATA enabled. When generating platdata from a devicetree, it is expected that we will not need devicetree access functions (even though SPL_OF_CONTROL is enabled). This expectation does not hold for sandbox, so allow user control of SPL_OF_REAL. There are several places in the tree where conditions involving OF_PLATDATA or OF_REAL no longer function correctly when both of these options can be selected at the same time. Adjust these conditions accordingly. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-16Merge branch '2023-10-16-assorted-cmd-updates'Tom Rini2-9/+4
- Update the mac command a bit, to be more widely useful and add a helper macro to declare CONFIG_SYS_LONGHELP text
2023-10-16cmd: Convert existing long help messages to the new macroTom Rini2-9/+4
- Generally we just drop the #ifdef CONFIG_SYS_LONGHELP and endif lines and use U_BOOT_LONGHELP to declare the same variable name as before - In a few places, either rename the variable to follow convention or introduce the variable as it was being done inline before. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-16Merge tag 'u-boot-amlogic-20231015' of ↵Tom Rini2-0/+66
https://source.denx.de/u-boot/custodians/u-boot-amlogic - add Amlogic A1 clock driver - add Amlogic A1 reset support - add USB Device support for Amlogic A1 - enable RNG on Amlogic A1 & Amlogic S4 - move Amlogic Secure Monitor to standalone driver
2023-10-15sandbox: add tests for UCLASS_SMAlexey Romanov2-0/+66
This patchs adds simple tests for Secure Monitor uclass. Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/20230921081346.22157-5-avromanov@salutedevices.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-10-14Merge tag 'dm-pull-13oct23' of ↵WIP/14Oct2023Tom Rini1-0/+10
https://source.denx.de/u-boot/custodians/u-boot-dm improvements with dev_read_addr_..._ptr() scan all entries in multi-device boot_targets EFI empty-capsule support
2023-10-13test: dm: add SCMI base protocol testAKASHI Takahiro1-0/+109
Added is a new unit test for SCMI base protocol, which will exercise all the commands provided by the protocol, except SCMI_BASE_NOTIFY_ERRORS. $ ut dm scmi_base It is assumed that test.dtb is used as sandbox's device tree. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-13test: dm: simplify SCMI unit test on sandboxAKASHI Takahiro1-44/+20
Adding SCMI base protocol makes it inconvenient to hold the agent instance (udevice) locally since the agent device will be re-created per each test. Just remove it and simplify the test flows. The test scenario is not changed at all. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
2023-10-13test: dm: add protocol-specific channel testAKASHI Takahiro1-2/+20
Any SCMI protocol may have its own channel. Test this feature on sandbox as the necessary framework was added in a prior commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
2023-10-13bootstd: Scan all bootdevs in a boot_targets entrySimon Glass1-0/+10
When the boot_targets environment variable is used with the distro-boot scripts, each device is included individually. For example, if there are three mmc devices, then we will have something like: boot_targets="mmc0 mmc1 mmc2" In contrast, standard boot supports specifying just the uclass, i.e.: boot_targets="mmc" The intention is that this should scan all MMC devices, but in fact it currently only scans the first. Update the logic to handle this case, without required BOOTSTD_FULL to be enabled. I believe at least three people reported this, but I found two. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Date Huang <tjjh89017@hotmail.com> Reported-by: Vincent Stehlé <vincent.stehle@arm.com>
2023-10-13Merge tag 'xilinx-for-v2024.01-rc1-v3' of ↵WIP/13Oct2023Tom Rini1-0/+66
https://source.denx.de/u-boot/custodians/u-boot-microblaze Xilinx changes for v2024.01-rc1 v3 clk: - remove additional compatible strings for Versal NET net: - zynq_gem: Fix clock calculation for MDC for higher frequencies pinctrl: - core: Extend pinmux status buffere size - zynqmp driver: Show also tristate configuration test: - add test case for pxe get Xilinx: - describe SelectMAP boot mode Zynq: - Fix nand description in DT ZynqMP: - DTS sync patches with kernel and also W=1 related fixes - Add support for KD240, zcu670, e-a2197 with x-prc cards, SC revB/C with i2c description for other SC based boards - k24 psu_init cleanup
2023-10-11expo: Update tests to include textlineSimon Glass4-4/+39
Provide test coverage for the new expo object type, including building and reading/writing settings. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11cli: Add a command to show cmdline historySimon Glass2-0/+50
There is a function for this but it is never used. Showing the history is a useful feature, so add a new 'history' command. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-10cmd: host: Print out the block size of the host deviceBin Meng1-10/+10
It's useful if we can print out the block size of the host device in the "host info" command. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10blk: sandbox: Support binding a device with a given logical block sizeBin Meng2-6/+7
Allow optionally set the logical block size of the host device to bind in the "host bind" command. If not given, defaults to 512. Signed-off-by: Bin Meng <bmeng@tinylab.org>
2023-10-10test/py: net: Add a test for 'pxe get' commandLove Kumar1-0/+66
Execute the 'pxe get' command to download a pxe configuration file from the TFTP server and validate its interpretation. Signed-off-by: Love Kumar <love.kumar@amd.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Link: https://lore.kernel.org/r/b5d263cf61282b158052ba87bde1fb4a227c0bb7.1696338593.git.love.kumar@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-10-09test: Fix SPL tests not being runSean Anderson1-1/+2
SPL doesn't have OF_LIVE enabled, so we can only run tests with a flat tree. Don't skip them even if they don't use the devicetree. Fixes: 6ec5178c0ef ("test: Skip flat-tree tests if devicetree is not used") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-09test/py: sleep: Add a test for the time commandLove Kumar1-0/+18
Execute "time <sleep cmd>", and validate that it gives the approximately the correct amount of command execution time. Signed-off-by: Love Kumar <love.kumar@amd.com>
2023-10-09test: lmb: Add test for coalescing and overlap rangeUdit Kumar1-1/+12
Add test case for an address range which is coalescing with one of range and overlapping with next range Cc: Simon Glass <sjg@google.com> Signed-off-by: Udit Kumar <u-kumar1@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-06pci: serial: Support reading PCI-register size with baseWIP/2023-10-06-spl-prepare-for-universal-payloadSimon Glass1-4/+10
The PCI helpers read only the base address for a PCI region. In some cases the size is needed as well, e.g. to pass along to a driver which needs to know the size of its register area. Update the functions to allow the size to be returned. For serial, record the information and provided it with the serial_info() call. A limitation still exists in that the size is not available when OF_LIVE is enabled, so take account of that in the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06sandbox: Move the bloblist down a little in memorySimon Glass1-2/+2
Move this down by 4KB so that it is large enough to hold the devicetree. Also fix up the devicetree address in the documetation while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Add tests for oftree_path()Simon Glass1-0/+6
Add a few simple tests for getting the root node, since this is handled as a special case in the implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Support writing a 64-bit valueSimon Glass1-2/+13
Add support for writing a single 64-bit value into a property. Repurpose the existing tests to handle this case too. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Support writing a booleanSimon Glass1-0/+25
Add functions to write a boolean property. This involves deleting it if the value is false. Add a new ofnode_has_property() as well. Add a comment about the behaviour of of_read_property() when the property value is empty. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Add a way to convert a devicetree to a dtbSimon Glass1-0/+24
Add a way to flatten a devicetree into binary form. For livetree this involves generating the devicetree using fdt_property() and other calls. For flattree it simply involves providing the buffer containing the tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Add a way to delete a nodeSimon Glass1-0/+31
Add a function to delete a node in an existing tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Add a way to copy a nodeSimon Glass1-0/+63
Add a function to copy a node to another place under a new name. This is useful at least for testing, since copying a test node with existing properties is easier than writing the code to generate it all afresh. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Add a function to create an empty treeSimon Glass1-0/+16
Provide a function to create a new, empty tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Tidy up comments in the ofnode testsSimon Glass1-7/+39
Add comments to the functions where the test name does not indicate what is being tested. Rename functions in a few cases, so that a search for the function will also file its test. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Ensure we run flattree tests on ofnodeSimon Glass1-15/+18
We need the UT_TESTF_SCAN_FDT flag set for these tests to run with flat tree. In some cases it is missing, so add it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-06dm: core: Reverse the argument order in ofnode_copy_props()Simon Glass1-5/+4
Follow the order used by memcpy() as it may be less confusing. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-02Merge branch 'next'Tom Rini35-363/+1284
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-09-30test: build dependency for event unit testsHeinrich Schuchardt1-1/+1
The test_event_base and test_event_probe unit tests use function event_register() which depends on CONFIG_EVENT_DYNAMIC=y. Fixes: 7d02645fe4c0 ("event: Add a simple test") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-30test: fix comment indentation on tpm testsIlias Apalodimas1-4/+5
One out comments is off by one, adjust it Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-22efi: Use the installed SMBIOS tablesSimon Glass1-0/+1
U-Boot should set up the SMBIOS tables during startup, as it does on x86. Ensure that it does this correctly on non-x86 machines too, by creating an event spy for last-stage init. Tidy up the installation-condition code while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-09-21dm: core: ofnode: Add ofnode_read_bootscript_flash()Michal Simek1-2/+7
ofnode_read_bootscript_flash() reads bootscript address from /options/u-boot DT node. bootscr-flash-offset and bootscr-flash-size properties are read and values are filled. When bootscr-flash-size is not defined, bootscr-flash-offset property is unusable that's why cleaned. Both of these properties should be defined to function properly. Also add test to cover this new function. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/08a3e6c09cce13287c69ad370e409e7f1766b406.1693465465.git.michal.simek@amd.com
2023-09-21dm: core: ofnode: Add ofnode_read_bootscript_address()Michal Simek1-0/+14
ofnode_read_bootscript_address() reads bootscript address from /options/u-boot DT node. bootscr-address or bootscr-ram-offset properties are read and values are filled. bootscr-address has higher priority than bootscr-ram-offset and the only one should be described in DT. Also add test to cover this new function. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/23be3838502efef61803c90ef6e8b32bbd6ede41.1693465140.git.michal.simek@amd.com
2023-09-21clk: Dont return error when assigned-clocks is empty or missingAshok Reddy Soma1-0/+9
There is a chance that assigned-clock-rates is given and assigned-clocks could be empty. Dont return error in that case, because the probe of the corresponding driver will not be called at all if this fails. Better to continue to look for it and return 0. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/a9a9d853e0ac396cd9b3577cce26279a75765711.1693384296.git.michal.simek@amd.com
2023-09-21test/py: tpm2: skip tpm2_startup when env__tpm_device_test_skip=TrueMichal Simek1-0/+3
All tpm2 tests should be possible to skip when env__tpm_device_test_skip=True but test_tpm2_startup is missing it. Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/41f932e52bdd206b1b68d5ff313fc29b794a70e7.1693413381.git.michal.simek@amd.com
2023-09-21dm: core: support reading a single indexed u64 valueMichal Simek1-0/+8
Add helper function to allow reading a single indexed u64 value from a device-tree property containing multiple u64 values, that is an array of u64's. Co-developed-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/08043c8d204d0068f04c27de86afe78c75c50b69.1692956263.git.michal.simek@amd.com
2023-09-19test: Move POST under a renamed Testing sectionSimon Glass1-6/+6
Rename Unit tests to Testing, since it is a stretch to describe some of the tests as unit tests. Move POST there as well, so it doesn't show up by itself in the top-level menu. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>