aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2020-03-12test: add rsa_verify() unit testAKASHI Takahiro3-0/+217
In this patch, a very simple test is added to verify that rsa_verify() using rsa_verify_with_pkey() work correctly. To keep the code simple, all the test data, either public key and verified binary data, are embedded in the source. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-02-13test: aes: fix memleakPhilippe Reynes1-6/+7
In the first version, the result of malloc is checked with ut_assertnonnull. But on a fail, this macro exit the function, so previously malloc are not freed. So to avoid a memleak, we don't use ut_assertnonnull, but simply check the return of malloc. If one has failed, we freed all the allocated memory and quit the function. Reported-by: Coverity (CID: 284403) Reported-by: Coverity (CID: 284404) Reported-by: Coverity (CID: 284405) Reported-by: Coverity (CID: 284406) Reported-by: Coverity (CID: 284407) Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-02-11Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dmTom Rini20-4/+216
sandbox conversion to SDL2 TPM TEE driver Various minor sandbox video enhancements New driver model core utility functions
2020-02-10Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86Tom Rini2-0/+87
- Move P2SB from Apollo Lake to a more generic location - Add a function to find a device by drvdata in DM core - Enhancement of DM IRQ uclass driver - Add a clock driver for Intel devices - Add support for ACPI general-purpose events - Add a TPM driver for H1/Cr50 - Enable TPM on Google Chromebook Coral
2020-02-07dm: irq: Add support for requesting interruptsSimon Glass1-0/+32
At present driver model supports the IRQ uclass but there is no way to request a particular interrupt for a driver. Add a mechanism, similar to clock and reset, to read the interrupts required by a device from the device tree and to request those interrupts. U-Boot itself does not have interrupt-driven handlers, so just provide a means to read and clear an interrupt. This can be useful to handle peripherals which must use an interrupt to determine when data is available, for example. Bring over the basic binding file as well, from Linux v5.4. Note that the older binding is not supported in U-Boot; the newer 'special form' must be used. Add a simple test of the new functionality. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-02-07dm: irq: Add support for interrupt controller typesSimon Glass1-0/+13
There can be different types of interrupt controllers in a system and some drivers may need to distinguish between these. In general this can be handled using the device tree by adding the interrupt information to device nodes. However on x86 devices we have interrupt controllers which are not tied to any particular device and not really used in U-Boot. These still need to be inited, so a convenient method is to give each controller a type and allow a particular controller type to be probed. Add support for this in sandbox along with a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: remove the new bland line at EOF of test/dm/irq.c] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2020-02-07dm: core: Add a function to find a device by drvdataSimon Glass1-0/+21
It is sometimes useful to find a device in a uclass using only its driver data. The driver data often indicates the 'subtype' of the device, e,g, via its compatible string. Add a function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-02-07dm: core: Allow iterating devices without uclass_get()Simon Glass1-0/+21
At present we have uclass_foreach_dev() which requires that uclass_get() be called beforehand to find the uclass. This is good if we suspect that that function might fail, but often we know that the uclass is available. Add a new helper which does this uclass_get() automatically, so that only the uclass ID is needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-02-05dm: core: Create a new header file for 'compat' featuresSimon Glass11-0/+11
At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Require users of devres to include the headerSimon Glass4-0/+4
At present devres.h is included in all files that include dm.h but few make use of it. Also this pulls in linux/compat which adds several more headers. Drop the automatic inclusion and require files to include devres themselves. This provides a good indication of which files use devres. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de>
2020-02-05sound: Add a new stop_play() methodSimon Glass1-0/+1
At present there is no positive indication that U-Boot has finished sending sound data. This means that it is not possible to power down an audio codec, for example. Add a new method that is called once all sound data has been sent. Add a new method for this, called when the sound_play() call is done. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05test: Add a way to check each line of console outputSimon Glass1-0/+46
When writing tests to check the output from commands it is useful to be able to check the output line by line using an assertion. Add helper macros to support this and to check that there is no unexpected trailing data. Also some commands produce a dump using print_buffer(). Add a way to check that the correct number of bytes are dumped (ignoring the actual contents). Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05test: Enable console recording in testsSimon Glass1-2/+2
At present we reset the console buffer before each test but do not actually set the recording flag. Without this, the output is not recorded. Update the code to set the flag before the test and clear it afterwards. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05bloblist: Zero records when addingSimon Glass1-2/+25
It is convenient for bloblist to zero out the contents of a records when it is added. This saves the callers having to do it. Update the API accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05bloblist: Add a new function to add or check sizeSimon Glass1-0/+34
A common check is to see if a blob is present, create it if not and make sure that the size is large enough. Add a function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Add a way to iterate through children, probing eachSimon Glass1-0/+19
It is sometimes useful to process all children, making sure they are probed first. Add functions to help with this and a macro to make it more convenient. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Add a way to read platdata for all child devicesSimon Glass1-0/+19
When generating ACPI tables we need to make sure that all devices have read their platform data, so that they can generate the tables correctly. Rather than adding this code in ACPI, create a core function to handle it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Add ofnode_get_chosen_prop()Simon Glass1-0/+8
Add a function to read a property from the chosen node, providing access to its length. Update ofnode_get_chosen_string() to make use of it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Add ofnode_read_prop()Simon Glass1-0/+26
Add a new function to read a property that supports reading the length as well. Reimplement ofnode_read_string() using it and fix its comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Rename ofnode_get_chosen_prop()Simon Glass1-0/+21
This function is actually intended to read a string rather than a property. All of its current callers use it that way. Also there is no way to return the length of the property from this function. Rename it to better indicate its purpose, using ofnode_read as the prefix since this matches most other functions. Also add some tests which are missing for these functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05test: efi_selftest: fix pylint warningsHeinrich Schuchardt1-174/+187
Fix pylint warnings: * add missing module and function documentation * correct indentation Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-02-05test: test_efi_fit: fix pylint warningsHeinrich Schuchardt1-38/+39
Fix warnings issued by pylint: * naming of variables * usage of commas and semicolons * indentation * placement of module description Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-02-04test/py: android: Add test for abootimgSam Protsenko1-0/+159
Unit test for 'abootimg' command. Right now it covers dtb/dtbo functionality in Android Boot Image v2, which was added recently. Running test: $ ./test/py/test.py --bd sandbox --build -k test_abootimg shows that 1/1 tests passes successfully. Signed-off-by: Sam Protsenko <joe.skb7@gmail.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-04doc: android: Convert to Sphinx formatSam Protsenko1-1/+1
Convert Android documentation from regular txt format to Sphinx (RST). Also add Android index.rst file and reference it in root index.rst, so that Android documentation is visible. Test: $ make htmldocs $ xdg-open doc/output/index.html Signed-off-by: Sam Protsenko <joe.skb7@gmail.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-30Consistently use nproc for counting the CPUsHeinrich Schuchardt2-2/+2
Coreutils command nproc can be used on Linux and BSD to count the number of available CPU cores. Use this instead of relying on the parsing of the Linux specific proc file system. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-27test: dm: spi: Fix sandbox dm_test_spi_find()Bin Meng1-3/+3
Per sandbox_cs_info(), sandbox spi controller only supports chip select 0. Current test case tries to locate devices on chip select 1, and any call to spi_get_bus_and_cs() or spi_cs_info() with cs number 1 should not return 0. This updates the test case to handle it correctly. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2020-01-17aes: add test unit for aes196 and aes256Philippe Reynes1-0/+4
This commit add test unit for aes196 and aes256. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-17aes: add test unit for aes128Philippe Reynes2-0/+163
This commit add test unit for aes128. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-16Merge tag 'xilinx-for-v2020.04' of ↵Tom Rini1-0/+31
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze Xilinx/FPGA changes for v2020.04 ARM64: - Add INIT_SPL_RELATIVE dependency SPL: - FIT image fix - Enable customization of bl2_plat_get_bl31_params() Pytest: - Add test for octal/hex conversions Microblaze: - Fix manual relocation for one SPI instance Nand: - Convert zynq/zynqmp drivers to DM Xilinx: - Enable boot script location via Kconfig - Support OF_SEPARATE in board FDT selection - Remove low level uart setup it is done later by code - Add support for DEVICE_TREE variable passing for SPL Zynq: - Enable jtag boot mode via distro boot - Removing unused baseaddresses from hardware.h - DT fixups ZynqMP: - Fix emmc boot sequence - Simplify spl logic around bss and board_init_r() - Support psu_post_config_data() calling - Tune mini-nand DTS - Fix psu wiring for a2197 boards - Add runtime MMC device boot order filling in spl - Clear ATF handoff handling with custom bl2_plat_get_bl31_params() - Add support u-boot.its generation - Use single image configuration for all platforms - Enable PANIC_HANG via Kconfig - DT fixups - Firmware fixes - Add support for zcu208 and zcu1285 Versal: - Fix emmc boot sequence - Enable board_late_init() by default
2020-01-15test/py: use valid device tree in test_fit.pyHeinrich Schuchardt1-3/+6
The device tree compiler expects that a node with a unit-address has a reg property. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-14test/py: hush_if_test: Add tests to cover octal/hex valuesMichal Simek1-0/+31
Extend test suite to cover also automatic octal/hex converstions which haven't been implemented in past. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2020-01-10test/cmd_ut.c: fix cmd_ut_categoryPhilippe Reynes1-1/+1
In the function cmd_ut_category, the prefix is used with the function strncmp to know if the prefix should be removed from the test name, even if the prefix is NULL. To avoid this issue, we consider that a prefix NULL mean no prefix. So we only try to remove the prefix from the test_name if the prefix is not NULL, then we avoid to call the function strncmp with a NULL prefix. Reported-by: Coverity CID 281110 Fixes: 4ad4edfe ("cmd_ut: add a parameter prefix to the function cmd_ut_category") Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-01-09Merge tag 'dm-pull-8jan20' of git://git.denx.de/u-boot-dmTom Rini4-0/+259
dm: Increased separation of ofdata_to_platdata() and probe methods
2020-01-08Merge tag 'efi-2020-04-rc1' of ↵Tom Rini5-4/+490
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-04-rc1 This pull request provides: * support for FIT images for UEFI binaries * drivers for hardware random number generators * an implementation of the EFI_RNG_PROTOCOL * a sub-command for efidebug to display configuration tables
2020-01-07dm: devres: Add a new OFDATA phaseSimon Glass2-3/+22
Since the ofdata_to_platdata() method can allocate resources, add it as a new devres phase. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-07dm: devres: Add testsSimon Glass2-0/+179
The devres functionality has very few users in U-Boot, but it still should have tests. Add a few basic tests of the main functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-07dm: test: Add a test driver for devresSimon Glass1-0/+47
Add a driver which does devres allocations so that we can write tests for devres. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-07test: Add functions to find the amount of allocated memorySimon Glass1-0/+14
The malloc() implementations provides a way of finding out the approximate amount of memory that is allocated. Add helper functions to make it easier to access this and see changes over time. This is useful for tests that want to check if memory has been allocated or freed. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-07test: rng: Add basic test for random number generator(rng) uclassSughosh Ganu2-0/+27
Add a unit test for testing the rng uclass functionality using the sandbox rng driver. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-07test/py: Create a test for launching UEFI binaries from FIT imagesCristian Ciocaltea1-0/+458
This test verifies the implementation of the 'bootm' extension that handles UEFI binaries inside FIT images (enabled via CONFIG_BOOTM_EFI). Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07test/py: describe env__efi_loader_helloworld_fileHeinrich Schuchardt1-3/+4
Describe the components of environment variable env__efi_loader_helloworld_file. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07test/py: Fix broken 'notbuildconfigspec' markerCristian Ciocaltea1-1/+1
Consider the following test sample: @pytest.mark.buildconfigspec('fit') @pytest.mark.notbuildconfigspec('generate_acpi_table') def test_sample(u_boot_console): Whatever the argument of the 'notbuildconfigspec' is, the test ends up being skipped with the message: ('/uboot/test/py/conftest.py', 463, 'Skipped: .config feature "fit" enabled') Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07cmd_ut: add a parameter prefix to the function cmd_ut_categoryPhilippe Reynes8-11/+23
There is black magic in the file conftest.py that list all the test unit. Then, all those test unit are called in pytest. This call is done with the end of the name (for example checksum if the full name is bloblist_test_checksum). The result is that only test for dm are really executed. by pytest, all others tests are listed but never executed. This behaviour happens because the dm test unit only check the end of the name and others tests checks the full name. To fix this issue, I've added a prefix to the function cmd_ut_category, and this prefix is removed when looking for the unit test. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07remoteproc: elf_loader: Add elf resource table load supportFabien Dessenne1-11/+80
Add rproc_elf_load_rsc_table(), which searches for a resource table in an elf64/elf32 image, and if found, copies it to device memory. Add also the elf32 and elf64 variants of this API. Add a test for this. Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Acked-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-06Merge branch 'next'Tom Rini6-26/+222
Bring in the following merges: commit 8fbbec12f7d2c18f8883f3371cfca74a98b5dd87 Merge: 87f69f467a83 63618e71e89b Author: Tom Rini <trini@konsulko.com> Date: Fri Jan 3 09:48:47 2020 -0500 Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq into next - updates and fixes on ls1028a, lx2, ls1046a, MC-DPSPARSER support commit 87f69f467a8335b171c71bf217d2625d515acd7c Merge: c0912f9bbfb2 4466b9970319 Author: Tom Rini <trini@konsulko.com> Date: Tue Dec 24 08:18:19 2019 -0500 Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx into next - Enable DM driver on ppc/km boards - Enable DM_USB for some of NXP powerpc platforms: P5040, T4240, T208x, T104x, P4080, P2041, P2020, P1020, P3041 - Some updates in mpc85xx-ddr driver, km boards commit c0912f9bbfb26dd03d189953678691b799d35b6e Merge: 533c9f5714bd a1d6dc3f8407 Author: Tom Rini <trini@konsulko.com> Date: Wed Dec 18 07:20:19 2019 -0500 Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-x86 into next - Various x86 common codes updated for TPL/SPL - I2C designware driver updated for PCI - ICH SPI driver updated to support Apollo Lake - Add Intel FSP2 base support - Intel Apollo Lake platform specific drivers support - Add a new board Google Chromebook Coral commit 533c9f5714bdba79dc6f2629284d4c1a08a611d1 Merge: 553cb0688782 033e18b47bd0 Author: Tom Rini <trini@konsulko.com> Date: Tue Dec 17 07:53:08 2019 -0500 Merge tag '20191217-for-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c into next i2c: for next - misc: i2c_eeprom: Add partition support and add ability to query size of eeprom device and partitions - i2c common: add support for offset overflow in to address and add sandbox tests for it. commit 553cb06887825314e74a9bdac337467c77d1db88 Merge: f39abbbc531e b4f98b3b16ec Author: Tom Rini <trini@konsulko.com> Date: Thu Dec 12 08:18:59 2019 -0500 Merge tag 'dm-next-13dec19' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm into next buildman improvements including toolchain environment feature sandbox unicode support in serial
2020-01-02test: Fix the boardspec for the SPL handoff testSimon Glass1-1/+1
This test currently does not run because it specifies the sandbox board instead of sandbox_spl. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-02test_env: don't strip() printenv resultsStephen Warren1-1/+1
get_env() was originally written to strip() the output of printenv to isolate the test from any whitespace changes in printenv's output. However, this throws away any whitespace in the variable value, which can cause issues when test code expects to see that whitespace. In fact, printenv never adds any whitespace at all, so there's no need to strip. The strip causes a practical problem for test_env_echo_exists() if state_test_env.get_existent_var() happens to choose a U-Boot variable that contains trailing whitespace. This is true for variable boot_targets. With Python 2, get_existent_var() never returned boot_targets so this issue never caused a practical problem. With Python 3, get_existent_var does sometimes return boot_targets, no doubt due to Python 3's different dict hash key order implementation, about 0.5-2% of the time, so this test appears intermittent. With the strip removed, this intermittency is solved, since the test passes for all possible U-Boot variables. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2019-12-18Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-x86 ↵Tom Rini4-0/+96
into next - Various x86 common codes updated for TPL/SPL - I2C designware driver updated for PCI - ICH SPI driver updated to support Apollo Lake - Add Intel FSP2 base support - Intel Apollo Lake platform specific drivers support - Add a new board Google Chromebook Coral
2019-12-17dm: i2c: EEPROM simulator add tests for addr offset maskRobert Beckett1-0/+65
Add support for setting the chip address offset mask to EEPROM sumulator and add tests to test it. Signed-off-by: Robert Beckett <bob.beckett@collabora.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2019-12-17dm: i2c: EEPROM simulator allow tests visibility of addr and offsetRobert Beckett1-15/+35
Improve i2c EEPROM simulator testing by providing access functions to check the previous chip addr and offset. Given that we can now directly test the offsets, also simplified the offset mapping and allow for wrapping acceses. Signed-off-by: Robert Beckett <bob.beckett@collabora.com> Reviewed-by: Heiko Schocher <hs@denx.de>