aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2021-10-14pytest: Shorten traceback length by defaultSimon Glass1-0/+5
This produces a lot of code output which is not very helpful and is quite annoying to wade through. Use the short format by default. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-13fdtdec: Support reserved-memory flagsThierry Reding1-6/+7
Reserved memory nodes can have additional flags. Support reading and writing these flags to ensure that reserved memory nodes can be properly parsed and emitted. This converts support for the existing "no-map" flag to avoid extending the argument list for fdtdec_add_reserved_memory() to excessive length. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
2021-10-13fdtdec: Reorder fdtdec_set_carveout() parameters for consistencyThierry Reding1-9/+6
The fdtdec_set_carveout() function's parameters are inconsistent with the parameters passed to fdtdec_add_reserved_memory(). Fix up the order to make it more consistent. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
2021-10-13fdtdec: Support compatible string list for reserved memoryThierry Reding1-9/+9
Reserved memory nodes can have a compatible string list to identify the type of reserved memory that they represent. Support specifying an optional compatible string list when creating these nodes. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
2021-10-12Merge tag 'u-boot-stm32-20211012' of ↵Tom Rini2-1/+8
https://source.denx.de/u-boot/custodians/u-boot-stm - Disable ATAGS for STM32 MCU and MPU boards - Disable bi_boot_params for STM32 MCU and MPU boards - Update stm32-usbphyc node management - Convert CONFIG_STM32_FLASH to Kconfig for STM32 MCU boards - Convert some USB config flags to Kconfig for various boards - Convert CONFIG_BOOTCOMMAND flag to Kconfig for STM32 F429 board - Remove specific CONFIG_STV0991 flags - Remove unused CONFIG_USER_LOWLEVEL_INIT flag - Add ofdata_to_platdata() callback for stm32_spi driver - Update for stm32f7_i2c driver - Remove gpio_hog_probe_all() from STM32 MP1 board - Fix bind command Signed-off-by: Tom Rini <trini@konsulko.com>
2021-10-12test/py: Add usb gadget binding testPatrice Chotard1-0/+7
Add a specific usb gadget binding test which check that binding a driver without compatible string is working as expected. the command "bind /usb@1 usb_ether" should give the following "dm tree" command output: [...] usb 0 [ ] usb_sandbox |-- usb@1 usb_hub 0 [ ] usb_hub | |-- hub usb_emul 0 [ ] usb_sandbox_hub | | `-- hub-emul usb_emul 1 [ ] usb_sandbox_flash | | |-- flash-stick@0 usb_emul 2 [ ] usb_sandbox_flash | | |-- flash-stick@1 usb_emul 3 [ ] usb_sandbox_flash | | |-- flash-stick@2 usb_emul 4 [ ] usb_sandbox_keyb | | `-- keyb@3 eth 4 [ ] usb_ether | `-- usb@1 [...] Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Vasut <marex@denx.de> Cc: Herbert Poetzl <herbert@13thfloor.at> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-12cmd: bind: Fix driver binding on a devicePatrice Chotard1-1/+1
Fix a regression brings by commit 84f8e36f03fa ("cmd: bind: allow to bind driver with driver data") As example, the following bind command doesn't work: bind /soc/usb-otg@49000000 usb_ether As usb_ether driver has no compatible string, it can't be find by lists_bind_fdt(). In bind_by_node_path(), which called lists_bind_fdt(), the driver entry is known, pass it to lists_bind_fdt() to force the driver entry selection. For this, add a new parameter struct *driver to lists_bind_fdt(). Fix also all lists_bind_fdt() callers. Fixes: 84f8e36f03fa ("cmd: bind: allow to bind driver with driver data") Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reported-by: Herbert Poetzl <herbert@13thfloor.at> Cc: Marek Vasut <marex@denx.de> Cc: Herbert Poetzl <herbert@13thfloor.at> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-09lz4: Use a private header for U-BootSimon Glass1-1/+1
At present U-Boot has a header file called lz4.h for its own use. If the host has its own lz4 header file installed (e.g. from the 'liblz4-dev' package) then host builds will use that instead. Move the U-Boot file into its own directory, as is done with various other headers with the same problem. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08Add support for an owned bufferSimon Glass2-0/+345
When passing a data buffer back from a function, it is not always clear who owns the buffer, i.e. who is responsible for freeing the memory used. An example of this is where multiple files are decompressed from the firmware image, using a temporary buffer for reading (since the compressed data has to live somewhere) and producing a temporary or permanent buffer with the resuilts. Where the firmware image can be memory-mapped, as on x86, the compressed data does not need to be buffered, but the complexity of having a buffer which is either allocated or not, makes the code hard to understand. Introduce a new 'abuf' which supports simple buffer operations: - encapsulating a buffer and its size - either allocated with malloc() or not - able to be reliably freed if necessary - able to be converted to an allocated buffer if needed This simple API makes it easier to deal with allocated and memory-mapped buffers. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08lib: Add memdup()Simon Glass1-0/+32
Add a function to duplicate a memory region, a little like strdup(). Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-07clk: k210: Try harder to get the best configSean Anderson1-0/+4
In some cases, the best config cannot be used because the VCO would be out-of-spec. In these cases, we may need to try a worse combination of r/od in order to find the best representable config. This also adds a few test cases to catch this and other (possible) unlikely errors. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-07test: dm: k210: Reduce duplication in test casesSean Anderson1-19/+13
Having to copy-paste the same 3 lines makes adding new test cases error-prone. Use a macro. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2021-10-06acpi: Use U-Boot version for OEM_REVISIONPali Rohár1-6/+14
OEM_REVISION is 32-bit unsigned number. It should be increased only when changing software version. Therefore it should not depend on build time. Change calculation to use U-Boot version numbers and set this revision to date number. Prior this change OEM_REVISION was calculated from build date and stored in the same format. After this change macro U_BOOT_BUILD_DATE is not used in other files so remove it from global autogenerated files and also from Makefile. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-05test: Allow tpm2 tests to run in parallelSimon Glass1-6/+46
These tests currently run in a particular sequence, with some of them depending on the actions of earlier tests. Add a check for sandbox and reset to a known state at the start of each test, so that all tests can run in parallel. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-05test: Allow hush tests to run in parallelSimon Glass1-14/+6
The -z tests don't really need to be part of the main set. Separate them out so we can drop the test setup/cleans functions and thus run all tests in parallel. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-05test: Allow vboot tests to run in parallelSimon Glass1-13/+16
Update the tests to use separate working directories, so we can run them in parallel. It also makes it possible to see the individual output files after the tests have completed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-05test/py: Check hashes produced by mkimage against known valuesAlexandru Gagniuc2-0/+187
Target code and mkimage share the same hashing infrastructure. If one is wrong, it's very likely that both are wrong in the same way. Thus testing won't catch hash regressions. This already happened in commit 92055e138f28 ("image: Drop if/elseif hash selection in calculate_hash()"). None of the tests caught that CRC32 was broken. Instead of testing hash_calculate() against itself, create a FIT with containing a kernel with pre-calculated hashes. Then check the hashes produced against the known good hashes. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-09-30WS cleanup: remove trailing empty linesWolfgang Denk2-2/+0
Signed-off-by: Wolfgang Denk <wd@denx.de>
2021-09-29Merge branch 'network_master' of ↵WIP/29Sep2021-nextTom Rini1-1/+1
https://source.denx.de/u-boot/custodians/u-boot-net into next - Fix some non-NULL terminated strings in the networking subsystem - net: tsec: Mark tsec_get_interface as __maybe_unused
2021-09-28net: update NXP copyright textVladimir Oltean1-1/+1
NXP Legal insists that the following are not fine: - Saying "NXP Semiconductors" instead of "NXP", since the company's registered name is "NXP" - Putting a "(c)" sign in the copyright string - Putting a comma in the copyright string The only accepted copyright string format is "Copyright <year-range> NXP". This patch changes the copyright headers in the networking files that were sent by me, or derived from code sent by me. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-09-28test/py: tpm2: Skip tpm pytest based on env variableT Karthik Reddy1-0/+28
Tpm test cases relies on tpm device setup. Provide an environment variable "env__tpm_device_test_skip = True" to skip the test case if tpm device is not present. Only needed will have to add variable to the py-test framework. Test runs successfully even this variable is absent. Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-09-27Merge tag 'dm-pull-next-27sep21' of ↵WIP/27Sep2021-nextTom Rini4-8/+80
https://source.denx.de/u-boot/custodians/u-boot-dm into next Various of-platdata improvements, including CONFIG_OF_REAL
2021-09-27Merge tag 'v2021.10-rc5' into nextTom Rini1-0/+28
Prepare v2021.10-rc5
2021-09-25sandbox: correct cpu nodesHeinrich Schuchardt2-4/+4
The cpu nodes in arch/sandbox/dts/test.dts should conform to the devicetree specification: * property device_type must be set to "cpu" * the reg property must be provided * the cpu nodes must have an address Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-09-25dm: gpio: Add of-platdata supportSimon Glass1-0/+20
Add support for accessing GPIOs using of-plata. This uses the same mechanism as for clocks, but allows use of the xlate() method so that the driver can interpret the parameters. Update the condition for GPIO_HOG so that it is not built into SPL, since it needs SPL_OF_REAL which is not enabled in sandbox_spl. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-25irq: Tidy up of-platdata irq supportSimon Glass1-4/+22
This function is available but not exported. More generally it does not really work as intended. Reimplement it and add a sandbox test too. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-25clk: Rename clk_get_by_driver_info()Simon Glass1-0/+19
This is actually a misnomer now, since the phandle info may contain a driver_info index or a udevice index. Rename it to use the word 'phandle', which seems more accurate. Add a comment while we are here. Also add a test for this function. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-25treewide: fdt: Move fdt_get_config_... to ofnode_conf_read...Simon Glass1-0/+15
The current API is outdated as it requires a devicetree pointer. Move these functions to use the ofnode API and update this globally. Add some tests while we are here. Correct the call in exynos_dsim_config_parse_dt() which is obviously wrong. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-24test/py: tpm2: Skip tpm pytest based on env variableT Karthik Reddy1-0/+28
Tpm test cases relies on tpm device setup. Provide an environment variable "env__tpm_device_test_skip = True" to skip the test case if tpm device is not present. Only needed will have to add variable to the py-test framework. Test runs successfully even this variable is absent. Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-09-17Remove including timestamp.h in version.hPali Rohár1-0/+1
Header file version.h does not use anything from timestamp.h. Including of timestamp.h has side effect which cause recompiling object file at every make run because timestamp.h changes at every run. So remove timestamp.h from version.h and include timestamp.h in files which needs it. This change reduce recompilation time of final U-Boot binary when U-Boot source files were not changed as less source files needs to be recompiled. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Add in lib/acpi/acpi_table.c and test/dm/acpi.c, rework a few others] Signed-off-by: Tom Rini <trini@konsulko.com>
2021-09-17version: Move version_string[] from version.h to version_string.hPali Rohár1-1/+1
More C files do not use compile time timestamp macros and do not have to be recompiled every time when SOURCE_DATE_EPOCH changes. This patch moves version_string[] from version.h to version_string.h and updates other C files which only needs version_string[] string to include version_string.h instead of version.h. After applying this patch these files are not recompiled every time when SOURCE_DATE_EPOCH changes. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2021-09-16test: Add a way to skip console checking until a string matchesSimon Glass1-0/+26
Some tests produce a lot of output that does not need to be individually checked by an assertion. Add a macro to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-16test: Tidy a comment in the bloblist testSimon Glass1-1/+1
Fix up a copy error. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-16Merge tag 'v2021.10-rc4' into nextTom Rini1-1/+1
Prepare v2021.10-rc4 Signed-off-by: Tom Rini <trini@konsulko.com> # gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT # gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C # gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate] # Conflicts: # board/Arcturus/ucp1020/spl.c # cmd/mvebu/Kconfig # common/Kconfig.boot # common/image-fit.c # configs/UCP1020_defconfig # configs/sifive_unmatched_defconfig # drivers/pci/Kconfig # include/configs/UCP1020.h # include/configs/sifive-unmatched.h # lib/Makefile # scripts/config_whitelist.txt
2021-09-13pci: Drop DM_PCISimon Glass1-1/+1
This option has not effect now. Drop it, using PCI instead where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-04serial: Rename SERIAL_SUPPORT to SERIALSimon Glass1-2/+2
Rename these options so that CONFIG_IS_ENABLED can be used with them. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-31sandbox: add test of wdt-uclass' watchdog_reset()Rasmus Villemoes1-0/+54
Check that the watchdog_reset() implementation in wdt-uclass behaves as expected: - resets all activated watchdog devices - leaves unactivated/stopped devices alone - that the rate-limiting works, with a per-device threshold Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-08-31sandbox: add test of wdt_gpio driverRasmus Villemoes1-1/+35
It seems that no other test has claimed gpio_a:7 yet, so use that. The only small wrinkle is modifying the existing wdt test to use uclass_get_device_by_driver() since we now have two UCLASS_WDT instances in play, so it's a little more robust to fetch the device by driver and not merely uclass+index. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-08-22bootcount: add a new driver with syscon as backendNandor Han1-3/+45
The driver will use a syscon regmap as backend and supports both 16 and 32 size value. The value will be stored in the CPU's endianness. Signed-off-by: Nandor Han <nandor.han@vaisala.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-22i2c: add dm_i2c_reg_clrsetSebastian Reichel1-0/+29
Add function to apply a bitmask to an i2c register, so that specific bits can be cleared and/or set. Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-16test: dm: Add test for ECDSA UCLASS supportAlexandru Gagniuc2-0/+39
This test verifies that ECDSA_UCLASS is implemented, and that ecdsa_verify() works as expected. The definition of "expected" is "does not find a device, and returns -ENODEV". The lack of a hardware-independent ECDSA implementation prevents us from having one in the sandbox, for now. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-08-08dm: core: Don't allow uclass use before readySimon Glass1-0/+1
At present it is possible to call uclass_get() before driver model is inited. In fact this happens on x86 boards which use Intel FSPv1, since mrccache_get_region() tries to get the SPI flash device very early during init. This has always been undefined behaviour. Previously it generally worked, i.e. returned an error code without crashing, because gd->uclass_root_s is zeroed and the uclass can be added despite driver model not being ready, due to the way lists are implemented. With the change to use a gd->uclass_root pointer, this no-longer works. For example, it causes a hang on minnowmax. Fix this by adding a check that driver model is ready when uclass_get() is called. This function is called in the process of locating any device, so it is a good place to add the check. This fixes booting on minnowmax. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 8a715530bb1 ("dm: core: Allow the uclass list to move")
2021-08-03Merge https://source.denx.de/u-boot/custodians/u-boot-samsungTom Rini1-2/+2
2021-08-02lib: Allow using 0x when a decimal value is requestedSimon Glass1-2/+2
U-Boot mostly uses hex for value input, largely because addresses are much easier to understand in hex. But in some cases a decimal value is requested, such as where the value is small or hex does not make sense in the context. In these cases it is sometimes useful to be able to provide a hex value in any case, if only to resolve any ambiguity. Add this functionality, for increased flexibility. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02lib: Add octal tests for simple_strtoul/l()Simon Glass1-0/+10
This function support decoding octal but no tests are included yet. Add some. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02lib: Add tests for simple_strtoull()Simon Glass1-0/+61
Add some tests that check the behaviour of this function. These are the same as for simple_strtoul() but with a few longer values. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02lib: Drop unnecessary check for hex digitSimon Glass1-0/+2
If we see 0x then we can assume this is the start of a hex value. It does not seem necessary to check for a hex digit after that since it will happen when parsing the value anyway. Drop this check to simplify the code and reduce size. Add a few more test cases for when a 0x prefix is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02global: Convert simple_strtoul() with decimal to dectoul()Simon Glass1-0/+12
It is a pain to have to specify the value 10 in each call. Add a new dectoul() function and update the code to use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02global: Convert simple_strtoul() with hex to hextoul()Simon Glass1-0/+12
It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01dtoc: Support widening a bool valueSimon Glass1-0/+3
At present if we see 'ranges' property (with no value) we assume it is a boolean, as per the devicetree spec. But another node may define 'ranges' with a value, forcing us to widen it to an int array. At present this is not supported and causes an error. Fix this and add some test cases. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Rini <trini@konsulko.com>