aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-10-02Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-09-30test: build dependency for event unit testsHeinrich Schuchardt
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 Apalodimas
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 Glass
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 Simek
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 Simek
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 Soma
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 Simek
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 Simek
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 Glass
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>
2023-09-16test: build dependency for event unit testsHeinrich Schuchardt
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-13phy: Return success from generic_setup_phy() when phy is not foundJonas Karlman
Restore the old behavior of ehci_setup_phy() and ohci_setup_phy() to return success when generic_phy_get_by_index() return -ENOENT. Fixes: 84e561407a5f ("phy: Add generic_{setup,shutdown}_phy() helpers") Fixes: 10005004db73 ("usb: ohci: Make usage of generic_{setup,shutdown}_phy() helpers") Fixes: 083f8aa978a8 ("usb: ehci: Make usage of generic_{setup,shutdown}_phy() helpers") Fixes: 75341e9c16aa ("usb: ehci: Remove unused ehci_{setup,shutdown}_phy() helpers") Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2023-09-13phy: Fix generic_setup_phy() return value on power on failureJonas Karlman
generic_phy_exit() typically return 0 for a struct phy that has been initialized with a generic_phy_init() call. generic_setup_phy() returns the value from a generic_phy_exit() call when generic_phy_power_on() fails. This hides the failed state of the power_on ops from the caller of generic_setup_phy(). Fix this by ignoring the return value of the generic_phy_exit() call and return the value from the generic_phy_power_on() call. Fixes: 84e561407a5f ("phy: Add generic_{setup,shutdown}_phy() helpers") Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2023-09-13phy: Set phy->dev to NULL when generic_phy_get_by_index_nodev() failsJonas Karlman
Generic phy helpers typically use generic_phy_valid() to determine if the helper should perform its function on a passed struct phy. generic_phy_valid() treat any struct phy having phy->dev set as valid. With generic_phy_get_by_index_nodev() setting phy->dev to a valid struct udevice early, there can be situations where the struct phy is returned as valid when initialization in fact failed and returned an error. Fix this by setting phy->dev back to NULL when any of the calls to of_xlate ops, device_get_supply_regulator or phy_alloc_counts fail. Also extend the dm_test_phy_base test with a test where of_xlate ops fail. Fixes: 72e5016f878d ("drivers: phy: add generic PHY framework") Fixes: b9688df3cbf4 ("drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails") Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2023-09-13phy: Set phy->dev to NULL when generic_phy_get_by_name() failsJonas Karlman
generic_phy_get_by_name() does not initialize phy->dev to NULL before returning when dev_read_stringlist_search() fails. This can lead to an uninitialized or reused struct phy erroneously be report as valid by generic_phy_valid(). Fix this issue by initializing phy->dev to NULL, also extend the dm_test_phy_base test with calls to generic_phy_valid(). Fixes: b9688df3cbf4 ("drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails") Fixes: 868d58f69c7c ("usb: dwc3: Fix non-usb3 configurations") Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2023-09-11cmd: gpt: Add command to swap partition orderJoshua Watt
Adds a command called "gpt transpose" which will swap the order two partition table entries in the GPT partition table (but leaves them pointing to the same locations on disk). This can be useful for swapping bootloaders in systems that use an A/B partitioning scheme where the bootrom is hard coded to look for the bootloader in a specific index in the GPT partition table. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-11cmd: gpt: Preserve bootable flagJoshua Watt
Sets the bootable flag when constructing the partition string from the current partition configuration. This ensures that when the partitions are written back (for example, when renaming a partition), the flag is preserved. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-11cmd: gpt: Preserve type GUID if enabledJoshua Watt
If CONFIG_PARTITION_TYPE_GUID is enabled, the type GUID will be preserved when writing out the partition string. It was already respected when writing out partitions; this ensures that if you capture the current partition layout and write it back (such as when renaming), the type GUIDs are preserved. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-11cmd: gpt: Add command to set bootable flagsJoshua Watt
Adds a command that can be used to modify the GPT partition table to indicate which partitions should have the bootable flag set Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-11cmd: gpt: Add gpt_partition_bootable variableJoshua Watt
Adds an additional variable called gpt_partition_bootable that indicates if the given partition is bootable or not. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-11tests: gpt: Remove test order dependencyJoshua Watt
Re-create a clean disk image for each test to prevent modifications from one test affecting another Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2023-09-06test: print: Fix hexdump test on 64bit systemsMarek Vasut
Use the following regex to make this test compatible with both 32bit and 64bit systems. The trick is to use %0*lx format string for the address prefix in the test. " s@\(ut_assert_nextline("\)0\+\([^:]\+\)\(:.*"\)\();\)@\1%0*lx\3, IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x\2UL\4 " Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-06test: dm: test-fdt: Use fdtdec_get_int() in dm_check_devices()Marek Vasut
The current fdtdec_get_addr() takes into consideration #address-cells and #size-cells for "ping-expect" property which is clearly neither. Use fdtdec_get_int() instead and return negative one in case the property is not in DT or the platform under test is not DT based, i.e. mimic the current fdtdec_get_addr() behavior. This fixes ut dm dm_test_bus_children test. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-04nokia_rx51: Remove platformTom Rini
This platform is behind on migrations (it is the sole user of the oldest legacy version of the USB gadget stack and is long overdue for migration) and with Pali no longer being a maintainer, we remove this platform. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-09-04Merge tag 'v2023.10-rc4' into nextTom Rini
Prepare v2023.10-rc4
2023-08-31event: Convert existing spy records to simpleSimon Glass
Very few of the existing event-spy records use the arguments they are passed. Update them to use a simple spy instead, to simplify the code. Where an adaptor function is currently used, remove it where possible. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31initcall: Support emitting eventsSimon Glass
At present the initcall list consists of a list of function pointers. Over time the initcall lists will likely change to mostly emitting events, since most of the calls are board- or arch-specific. As a first step, allow an initcall to be an event type instead of a function pointer. Add the required macro and update initcall_run_list() to emit an event in that case, or ignore it if events are not enabled. The bottom 8 bits of the function pointer are used to hold the event type, with the rest being all ones. This should avoid any collision, since initcalls should not be above 0xffffff00 in memory. Convert misc_init_f over to use this mechanism. Add comments to the initcall header file while we are here. Also fix up the trace test to handle the change. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31event: Support a simple spy recordSimon Glass
The current event spy is always passed the event context and the event. The context is always NULL for a static spy. The event is not often used. Introduce a 'simple' spy which takes no arguments. This allows us to drop the adaptation code that many of these spy records use. Update the event script to find these in the image. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-30drivers/mtd/nvmxip: Move sandbox_set_enable_memio() to testMarek Vasut
The sandbox_set_enable_memio() should only ever be set during sandbox testing, not within driver itself, move it back to test/ . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-08-30fwu: Initialize global fwu library state during CI testMarek Vasut
The current CI test worked by sheer luck, the g_dev global pointer in the fwu library was never initialized and the test equally well failed on sandbox64. Trigger the main loop in sandbox tests too to initialize that global state, and move the sandbox specific exit from fwu_boottime_checks after g_dev is initialized. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-29test: capsule: Remove logic to add public key ESLSughosh Ganu
The public key EFI Signature List(ESL) needed for capsule authentication is now embedded into the platform's DTB as part of the build. Remove the superfluous logic from the test setup. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2023-08-29sandbox: trace: Increase trace buffer sizeSughosh Ganu
When running the trace test on the sandbox platform, the current size of 16MiB is no longer large enough for capturing the entire trace history, and results in truncation. Use a size of 32MiB for the trace buffer on the sandbox platform while running the trace test. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-29test: capsule: Generate EFI capsules through binmanSughosh Ganu
Support has been added for generating the EFI capsules through binman. Make changes in the EFI capsule update testing feature to generate capsules through binman. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2023-08-28bootstd: Adjust the default bootmeth orderSimon Glass
The existing distro scripts check extlinux and scripts before EFI. Adjust the default ordering to do the same, to avoid breaking existing flows. Add some documentation, mentioning that this order will likely change in future. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Da Xue <da@libre.computer>
2023-08-26bootstd: cros: Allow detection of any kernel partitionSimon Glass
The existing ChromiumOS bootmeth only supports reading a single kernel partition, either 2 or 4. In fact there are normally two options available. Use the GUID to detect kernel partitions, with the BOOTMETHF_ANY_PART flag, so that bootstd does not require a valid filesystem before calling the bootmeth. Tidy up and improve the logging while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> [trini: Add missing select of PARTITION_TYPE_GUID] Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-25bootstd: Add a test for bootmeth_crosSimon Glass
The ChromiumOS bootmeth has no tests at present. Before adding more features. add a basic test. This creates a disk which can be scanned by the bootmeth, so make sure things work. It is quite rudimentary, since the kernel is faked, the root disk is missing and there is no cmdline stored. Enable the bootmeth for snow so it can build the unit test. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25bootstd: test: Allow binding and using any mmc deviceSimon Glass
We currently use mmc4 for tests. Update the function which sets this up so that it can handle any device. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25bootflow: Show an empty filename when there is noneSimon Glass
At present 'bootflow list' shows <NULL> for the filename when it is not present. Show an empty string instead, since that is more user-friendly. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25test: Move 1MB.fat32.img and 2MB.ext2.imgSimon Glass
These are currently created in the source directory, which is not ideal. Move them to the persistent-data directory instead. Update the test so skip validating the filename, since it now includes a full path. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: cedit: Support reading settings from CMOS RAMSimon Glass
Add a command to read edit settings from CMOS RAM, using the cedit definition to indicate which registers and bits are used. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: cedit: Support writing settings to CMOS RAMSimon Glass
Add a command to write cedit settings to CMOS RAM so that it can be preserved across a reboot. This uses a simple bit-encoding, where each field has a 'bit position' and a 'bit length' in the schema. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: cedit: Support reading settings from environment varsSimon Glass
Add a command to read cedit settings from environment variables so that they can be restored as part of the environment. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: cedit: Support writing settings to environment varsSimon Glass
Add a command to write cedit settings to environment variables so that they can be stored with 'saveenv'. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: cedit: Support reading settings from a fileSimon Glass
Add a command to read cedit settings from a devicetree file. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: cedit: Support writing settings to a fileSimon Glass
Support writing settings from an expo into a file in FDT format. It consists of a single node with a two properties for each sceneitem, one with tag ID chosen by the user and another for its text value. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: Tidy up the expo.py tool and usageSimon Glass
Tidy up this tool a little: - define which arguments are needed - split the enum values out into a header file - warn if no enum values are found - display the dtc error if something goes wrong - avoid a Python traceback on error Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: Move cedit test into its own file and tidySimon Glass
Move this test out so it can have its own file. Rename the test to use a cedit_ prefix. This allows us to drop the check for CONFIG_CMD_CEDIT in the test. Also we don't need driver model objects for this test, so drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: Provide a way to iterate through all scene objectsSimon Glass
For some operations it is necessary to process all objects in an expo. Provide an iterator to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25abuf: Allow incrementing the sizeSimon Glass
Provide a convenience function to increment the size of the abuf. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-22test: acpi: Handle both 32bit and 64bit ACPI tablesMarek Vasut
Handle both 32bit and 64bit systems, i.e. sandbox and sandbox64 the same way drivers/cpu/cpu_sandbox.c sets those ACPI tables up. This fixes "$ ./u-boot -Tc 'ut dm dm_test_acpi_write_tables'" test failure on sandbox64. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>