summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2021-11-27test: fix pylint error in u_boot_console_exec_attach.pyHeinrich Schuchardt1-2/+4
* provide module docstring Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-27test: fix pylint error in u_boot_console_sandbox.pyHeinrich Schuchardt1-1/+3
* provide module docstring Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-27test: fix pylint errors in u_boot_utils.pyHeinrich Schuchardt1-11/+14
* there is no os.path.unlink() method * don't inherit from object * add module docstring * move imports to the top * avoid unused variable Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-27test: fix pylint errors in u_boot_spawn.pyHeinrich Schuchardt1-13/+13
* don't inherit from object * imports should be on the top level * avoid unused variable names * avoid unnecessary else after raise Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-27test: fix pylint errors in multiplexed_log.pyHeinrich Schuchardt1-6/+8
* don't inherit from object * remove superfluous comprehension * add module docstring Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-26test: address some pylint warningsHeinrich Schuchardt2-9/+7
* remove unused variables * module description must precede import statements * fix inconsistent return values Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-11-20test: test truncation in snprintf()Heinrich Schuchardt1-0/+18
Test that the return value of snprintf() is correct in the case of truncation. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-20lmb: remove lmb_is_nomap() from includeHeinrich Schuchardt1-0/+5
Defining static functions in includes should be avoided. Function lmb_is_nomap() is only used in the unit test. So move it to the unit test. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-11-13test/dm: fix watchdog testHeinrich Schuchardt1-1/+3
For successful execution of the watchdog test we need both the GPIO as well as the SANDBOX watchdog. Avoid a build failure for CONFIG_WDT_GPIO=n. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-12lib: Add a function to convert a string to a hex valueSimon Glass1-0/+24
Add an xtoa() function, similar to itoa() but for hex instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com>
2021-11-12lib: Add tests for simple_itoa()Simon Glass1-0/+17
Add test and a comment for this function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com>
2021-11-09test: dm: add test for ofnode_for_each_compatible_node()Michael Walle1-0/+18
Check that all matching nodes have the correct compatible and that there is at least one match. Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2021-10-31test: Add tests for IOMMU uclassMark Kettenis2-0/+29
Add a set of tests for the IOMMU uclass. Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-16Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegraTom Rini1-15/+13
On merge, fixup order of fdtdec_add_reserved_memory parameters in arch/arm/cpu/armv8/fsl-layerscape/soc.c Signed-off-by: Tom Rini <trini@konsulko.com>
2021-10-15pytest: Show a message when sandbox crashesSimon Glass1-12/+44
When a test hands on a real board there is no way on the console to obtain any information about why it hung. With sandbox we can actually find out that it died and get a signal or exit code. Add this to make it easier to figure out what happened. So instead of: test/py/u_boot_spawn.py:171: in expect c = os.read(self.fd, 1024).decode(errors='replace') E OSError: [Errno 5] Input/output error We get: test/py/u_boot_spawn.py:171: in expect c = os.read(self.fd, 1024).decode(errors='replace') E ValueError: U-Boot exited with signal 11 (Signals.SIGSEGV) Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-15pytest: 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-14fdtdec: 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-14fdtdec: 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-14fdtdec: 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 ↵Tom 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 ↵Tom 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-14pci: 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>