summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2019-12-03common: Move command functions out of common.hSimon Glass2-0/+2
Move these functions into the command.h header file which is a better fit. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-03common: Move get_ticks() function out of common.hSimon Glass1-0/+1
This function belongs in time.h so move it over and add a comment. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-03common: Add a new lz4.h header fileSimon Glass1-0/+1
Add a header file to house the lz4 compression function. Add a comment while we are here, since it not even clear from the name what the function actuall does. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-11-25dm: test: usb: rework keyboard testHeinrich Schuchardt1-8/+276
Allow the unit test to pass full 8 byte scan code sequences to the USB keyboard emulation driver and to parse multi-byte escape sequences. The following features are not yet tested: * LED status * caps-lock * num-lock * numerical pad keys The following features are not yet implemented by the USB keyboard driver and therefore not tested: * modifiers for non-alpha-numeric keys, e.g. <SHIFT><TAB> and <ALT><F4> * some special keys, e.g. <PRINT> * some modifiers, e.g. <ALT> and <META> * alternative keyboard layouts Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-11-14tests: add OP-TEE test suiteHeiko Stuebner8-0/+234
OP-TEE can get supplied with a devicetree and will then insert its firmware node and reserved-memory sections into it. As this devicetree often is not the one supplied to a later loaded kernel, a previous commit added functionality to transfer these nodes onto that new devicetree. To make sure this functionality stays intact, also add a test for the transfer functionality. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-11-10dm: regulator: support regulator more stateJoseph Chen1-0/+57
support parse regulator standard property: regulator-off-in-suspend; regulator-init-microvolt; regulator-suspend-microvolt: regulator_get_suspend_enable regulator_set_suspend_enable regulator_get_suspend_value regulator_set_suspend_value Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-11-03spi: Add support for memory-mapped flashSimon Glass1-0/+9
On x86 platforms the SPI flash can be mapped into memory so that the contents can be read with normal memory accesses. Add a new SPI method to find the location of the SPI flash in memory. This differs from the existing device-tree "memory-map" mechanism in that the location can be discovered at run-time. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-01Merge tag 'dm-pull-29oct19' of git://git.denx.de/u-boot-dmTom Rini1-3/+16
- Fix for patman with email addresses containing commas - Bootstage improvements for TPL, SPL - Various sandbox and dm improvements and fixes
2019-10-31test: provide test for errno_str()Heinrich Schuchardt2-0/+47
Provide a unit test for errno_str(). Test that known and unknown error numbers are handled correctly. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-10-31test/py: Use raw strings more to avoid deprecation warningsTom Rini2-6/+3
We have two further uses of raw string usage in the test/py codebase that are used under CI. The first of which is under the bind test and is a direct update. The second of which is to strip VT100 codes from the match buffer. While switching this to a raw string is also a direct update, the comment it notes that problems were encountered on Ubuntu 14.04 (and whatever Python 2 version that was) that required slight tweaks to the regex. Replace that now that we're saying Python 3.5 is the minimum. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: Update docs, add requirements.txt for pipTom Rini2-21/+48
To be more closely aligned with Python community best practices, we need to better document our usage of pip and make use of a requirements.txt file that shows the versions of the tools that we are using. This will aide in ensuring reproducibility of our tests as well. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: Rework test.py to be a different kind of wrapperTom Rini1-16/+4
Now that we have moved to being based on pytest for python3 we need to make our test.py wrapper more robust in terms of only calling python3 rather than possibly finding and using python2. To do this, change from execvp()'ing pytest to invoking the package itself via python. In the event that pytest is unavailable we still get a user-friendly error: pkg_resources.DistributionNotFound: The 'pytest' distribution was not found and is required by the application Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: Update test_fs to decode check_output callsTom Rini1-12/+12
The check_output function from the subprocess Python module by default returns data as encoded bytes and leaves decoding to the application. Given our uses of the call, it makes the most sense to immediately decode the results. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: test_efi_selftest.py: Updates for python 3 supportTom Rini1-18/+18
- In python 3 you must use raw strings for regex as other forms are deprecated and would require further changes to the pattern here. In one case this lets us have a simpler match pattern. - As strings are now Unicode our complex tests (Euro symbol, SHIFT+ALT+FN 5) we need to declare that as a bytes string and then decode it for use. Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: test_ut.py: Ensure we use bytesTom Rini1-3/+3
In the case of some unit tests we are working with providing a fake flash device that we have written some text strings in to. In this case we want to tell Python to encode things to bytes for us. Reviewed-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: Manual python3 fixesTom Rini5-12/+19
- Modern pytest is more visible in telling us about parameters that we had not described, so describe a few more. - ConfigParser.readfp(...) is now configparser.read_file(...) - As part of the "strings vs bytes" conversions in Python 3, we use the default encoding/decoding of utf-8 but in some places tell Python to replace problematic conversions rather than throw a fatal error. - Fix a typo noticed while doing the above ("tot he" -> "to the"). - As suggested by Stephen, re-alphabetize the import list - Per Heinrich, replace how we write contents in test_fit.py Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: Automated conversion to Python 3Tom Rini8-80/+71
Use the 2to3 tool to perform numerous automatic conversions from Python 2 syntax to Python 3. Also fix whitespace problems that Python 3 catches that Python 2 did not. Reviewed-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: Fix pytest4 deprecation warningsMarek Vasut1-18/+12
Fix the following spit from pytest: u-boot/test/py/conftest.py:438: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. Please use node.get_closest_marker(name) or node.iter_markers(name). Docs: https://docs.pytest.org/en/latest/mark.html#updating-code for board in mark.args: In both cases, the later suggestion is applicable. Reviewed-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Igor Opaniuk <igor.opaniuk@gmail.com> [trini: Update for current file with a few more cases, un-pin pytest in CI] Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-31test/py: Split mark to multiple linesTom Rini2-4/+9
We inconsistently note multiple dependencies today in our tests, sometimes with a single line that declares multiple and sometimes multiple single lines. Current pytest seems to fail on the single line format so change to multiple declarations. Reviewed-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-27test: regmap: check the values read from the regmapJean-Jacques Hiblot1-3/+16
The test did reads after writes but didn't check the value. It probably was because the sandbox didn't implement the writeX/readX functions. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Updated to use sandbox_set_enable_memio(): Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-22test: clk: test clock self assignmentJean-Jacques Hiblot1-2/+2
Make sure that the clock self-assignment works by having a clock of clk-sbox be configured automatically when clk-sbox is probed. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-22test: clk: Update tests to also check the managed APIJean-Jacques Hiblot1-1/+35
Add a few more clocks the clk_sandbox clock provider and get them using the managed API. Make sure they are released when the device is removed. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-15dm: Tidy up dump output when there are many devicesPatrick Delaunay1-1/+1
At present the 'Index' column of 'dm tree' assumes there is two digits, this patch increase it to 3 digits. It also aligns output of 'dm uclass', assuming the same 3 digits index. The boards with CONFIG_PINCTRL_FULL activated have one pinconfig by pin configuration, so they can have more than 100 devices pinconfig (for example with stm32mp157c-ev1 board we have 106 pinconfig node). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-10-15pytest: vboot: add a test for required keyPhilippe Reynes2-0/+103
This commit add a test in the vboot test to check that when a required key is asked, only FIT signed with this key is used/accepted by u-boot. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2019-10-14dm: Add a dsi host uclassYannick Fertré2-0/+59
Display Serial Interface (DSI) host can usefully be modelled as their own uclass. DSI defines a serial bus and a communication protocol between the host and the device (panel, bridge). Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
2019-10-11remoteproc: elf_loader: Introduce rproc_elf_get_boot_addr() apiLokesh Vutla1-0/+2
Introduce rproc_elf_get_boot_addr() that returns the entry point of the elf file. This api auto detects the 64/32 bit elf file and returns the boot addr accordingly. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2019-10-11remoteproc: elf_loader: Always check the validity of the image before loadingLokesh Vutla1-4/+1
rproc_elf32_load_image() rely on user to send a valid address for elf loading. Instead do a sanity check on the address passed by user. This will help all rproc elf users to not call sanity_check explicitly before calling elf_loading. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
2019-10-11dm: core: Add a function to count the children of a deviceLokesh Vutla1-26/+15
Add a function to count the available children of a device. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2019-10-08dm: pci: Add a function to read a PCI BARSimon Glass1-0/+45
At present PCI address transaction is not supported so drivers must manually read the correct BAR after reading the device tree info. The ns16550 has a suitable implementation, so move this code into the core DM support. Note that there is no live-tree equivalent at present. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: correct the unclear comments in test.dts] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08sandbox: Rename PCI ID for swap_case to be more specificSimon Glass1-3/+3
Rename this ID to SANDBOX_PCI_SWAP_CASE_EMUL_ID since it is more descriptive and allows us to add new PCI emulators without any conflict or confusion. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08dm: test: Correct a stray backslash in dm_test_destroy()Simon Glass1-1/+1
This should perhaps be a period. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: add the ending period and reword the commit message] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08dm: core: Correct the return value for uclass_find_first_device()Simon Glass1-2/+1
This function returns -ENODEV when there is no device. This is inconsistent with other functions, such as uclass_find_next_device(), which returns 0. Update it and tidy up the incorrect '-1' values in the comments. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08dm: test: Don't fail when tests are skipped due to buildSimon Glass1-4/+4
At present tests that are marked as only for livetree fail when executed on sandbox_flattree. They cannot actually be executed, but we should not resport them as 'not found', since this causes errors. Instead, they should be silently skipped. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08dm: test: Fix running of multiple test from command lineSimon Glass1-1/+5
At present when multiple 'ut dm' commands are executed, all but the first is run with a flat tree, even if live tree is enabled. This is because the live tree node pointer is set to NULL and never restored. This does not affect normal test running, which just runs all the test in one go, but can be confusing when several individual tests are run during the same U-Boot run. Correct this by restoring the pointer. Fixes: c166c47ba3 (dm: test: Add support for running tests with livetree) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-09-20test: add tests for u16_str<n>cmp()AKASHI Takahiro1-0/+13
New seven test cases for u16_str<n>cmp() are added under Unicode unit test, which should be executed by "ut unicode" command. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-09-03dm: cache: Add enable and disable ops for sandbox and testRick Chen1-0/+2
Add cache enable and disable ops for test coverage. Signed-off-by: Rick Chen <rick@andestech.com> Cc: KC Lin <kclin@andestech.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-22sandbox: clk: add clk enable/disable test codePeng Fan1-0/+28
Since we added clk enable_count and prograte clk child enabling operation to clk parent, so add a new function sandbox_clk_enable_count to get enable_count for test usage. And add test code to get the enable_count after we enable/disable the device clk. Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-08-22test/py: Add cmd_memory dependency back to test_mmc_wrMichal Simek1-1/+1
Based on discussion with Stephen Warren there was recommendation to list both memory and random command dependencies just in case that dependency is not properly handled by Kconfig. Fixes: a09c1f7e1c1b ("test/py: Fix MMC/SD block write test dependency") Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com>
2019-08-13Merge branch '2019-08-11-ti-imports'Tom Rini2-4/+13
- More DaVinci updates and fixes - PCIe support on am65x - Watchdog converted to DM - Assorted other bugfixes
2019-08-12dm: core: add support for getting register address and sizeSekhar Nori1-4/+12
Current dev_read_*() API lacks support to get address and size of a "reg" property by name or index. Add support for the same. Livetree support has been added but not tested on real hardware. The existing unit tests testing reading address from device-tree have been updated to test address as well as size. Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2019-08-12clk: add support for clk_is_match()Sekhar Nori1-0/+1
Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock. Also add a unit test for the new API. Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2019-08-11env: Drop the ACTION typedefSimon Glass1-4/+4
Avoid using a typedef here which is unnecessary. Add an 'env_' prefix to both the enum and its members to make it clear that these are related to the environment. Add an ENV prefix to these two flags so that it is clear what they relate to. Also move them to env.h since they are part of the public API. Use an enum rather than a #define to tie them together. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Drop the ENTRY typedefSimon Glass1-6/+6
U-Boot is not supposed to use typedef for structs anymore. Also this name is the same as the ENTRY() macro used in assembler files, and 'entry' itself is widely used in U-Boot (>8k matches). Drop the typedef and rename the struct to env_entry to reduce confusion. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-08-11env: Move env_set() to env.hSimon Glass1-0/+1
Move env_set() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11common: Move gzip functions into a new gzip headerSimon Glass1-0/+1
As part of the effort to remove things from common.h, create a new header for the gzip functions. Move the function declarations to it and add missing documentation. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-08-09test/py: Fix MMC/SD block write test dependencyMichal Simek1-1/+1
Test is using random command which has own Kconfig symbol CMD_RANDOM which already depends on CMD_MEMORY. That's why replace cmd_memory by cmd_random. Fixes: 09da18deab8b ("test/py: add MMC/SD block write test") Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-08-08test/py: avb: Move AVB test to android dirSam Protsenko1-0/+0
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2019-08-07fit: Do not automatically decompress ramdisk imagesJulius Werner1-1/+9
The Linux ramdisk should always be decompressed by the kernel itself, not by U-Boot. Therefore, the 'compression' node in the FIT image should always be set to "none" for ramdisk images, since the only point of using that node is if you want U-Boot to do the decompression itself. Yet some systems populate the node to the compression algorithm used by the kernel instead. This used to be ignored, but now that we support decompression of all image types it becomes a problem. Since ramdisks should never be decompressed by U-Boot anyway, this patch adds a special exception for them to avoid these issues. Still, setting the 'compression' node like that is wrong in the first place, so we still want to print out a warning so that third-party distributions doing this can notice and fix it. Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-08-02Merge https://gitlab.denx.de/u-boot/custodians/u-boot-clkTom Rini1-0/+8
- Port more CCF code to work with i.MX8 devices.
2019-07-31test/py: add MMC/SD block write testJean-Jacques Hiblot1-0/+105
Add a standalone MMC block write test. This allows direct testing of MMC access rather than relying on doing so as a side-effect of e.g. DFU or UMS testing, which may not be enabled on all platforms. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>