aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2022-01-28rsa: adds rsa3072 algorithmJamin Lin3-2/+97
Add to support rsa 3072 bits algorithm in tools for image sign at host side and adds rsa 3072 bits verification in the image binary. Add test case in vboot for sha384 with rsa3072 algorithm testing. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-25dm: Fix OF_BAD_ADDR definitionPatrice Chotard3-4/+4
When OF_LIVE flag is enabled on a 64 bits platform, there is an issue when dev_read_addr() is called and need to perform an address translation using __of_translate_address(). In case of error, __of_translate_address() return's value is OF_BAD_ADDR (wich is defined in include/dm/of.h to ((u64)-1) = 0xffffffffffffffff). The return value of dev_read_addr() is often compared to FDT_ADDR_T_NONE which is defined as (-1U) = 0xffffffff. In this case the comparison is always false. To fix this issue, define FDT_ADDR_T_NONE to (ulong)(-1) in case of AARCH64. Update accordingly related tests. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-25acpi: Tidy up the table listSimon Glass1-7/+8
At present this is really just a debugging aid, but it is a bit untidy. Add proper columns so it is easier to read. Sample output for coral: => acpi list Name Base Size Detail ---- -------- ----- ------ RSDP 79925000 24 v02 U-BOOT RSDT 79925030 48 v01 U-BOOT U-BOOTBL 20220101 INTL 0 XSDT 799250e0 6c v01 U-BOOT U-BOOTBL 20220101 INTL 0 FACP 79929570 f4 v04 U-BOOT U-BOOTBL 20220101 INTL 1 DSDT 79925280 32ea v02 U-BOOT U-BOOTBL 20110725 INTL 20180105 FACS 79925240 40 MCFG 79929670 2c v01 U-BOOT U-BOOTBL 20220101 INTL 0 SPCR 799296a0 50 v02 U-BOOT U-BOOTBL 20220101 INTL 0 TPM2 799296f0 4c v04 U-BOOT U-BOOTBL 20220101 INTL 0 APIC 79929740 6c v02 U-BOOT U-BOOTBL 20220101 INTL 0 SSDT 799297b0 1523 v02 U-BOOT U-BOOTBL 20220101 INTL 1 NHLT 7992ace0 e60 v05 coral coral 3 INTL 0 DBG2 7992db40 61 v00 U-BOOT U-BOOTBL 20220101 INTL 0 HPET 7992dbb0 38 v01 U-BOOT U-BOOTBL 20220101 INTL 0 Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25acpi: Tidy up the item listSimon Glass1-6/+14
At present this is really just a debugging aid, but it is a bit untidy. Add proper columns and display the type name instead of a number. Sample output for coral: => acpi items Seq Type Addr Size Device/Writer --- ----- -------- ---- ------------- 0 other 79925000 240 0base 1 other 79925240 40 1facs 2 dsdt 799252a4 58 board 3 dsdt 799252fc 10 lpc 4 other 79925280 32f0 3dsdt 5 other 79928570 1000 4gnvs 6 other 79929570 100 5fact 7 other 79929670 30 5mcfg 8 other 799296a0 50 5spcr 9 other 799296f0 50 5tpm2 a other 79929740 70 5x86 b ssdt 799297d4 fe maxim-codec c ssdt 799298d2 28 i2c2@16,0 d ssdt 799298fa 270 da-codec e ssdt 79929b6a 28 i2c2@16,1 f ssdt 79929b92 28 i2c2@16,2 10 ssdt 79929bba 83 tpm@50 11 ssdt 79929c3d 28 i2c2@16,3 12 ssdt 79929c65 282 elan-touchscreen@10 13 ssdt 79929ee7 285 raydium-touchscreen@39 14 ssdt 7992a16c 28 i2c2@17,0 15 ssdt 7992a194 d8 elan-touchpad@15 16 ssdt 7992a26c 163 synaptics-touchpad@2c 17 ssdt 7992a3cf 28 i2c2@17,1 18 ssdt 7992a3f7 111 wacom-digitizer@9 19 ssdt 7992a508 8f sdmmc@1b,0 1a ssdt 7992a597 4b wifi 1b ssdt 7992a5e2 1a0 cpu@0 1c ssdt 7992a782 1a0 cpu@1 1d ssdt 7992a922 1a0 cpu@2 1e ssdt 7992aac2 211 cpu@3 1f other 799297b0 1530 6ssdt 20 other 7992ace0 2f10 8dev Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: Move base tables to a writer functionSimon Glass1-6/+11
Use the new ACPI writer to write the base tables at the start of the area, moving this code from the x86 implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: Use the ACPI table writerSimon Glass1-3/+3
Use the new ACPI writer to write the ACPI tables. At present this is all done in one monolithic function. Future work will split this out. Unfortunately the QFW write_acpi_tables() function conflicts with the 'writer' version, so disable that for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: acpi: Split out context creation from base tablesSimon Glass1-5/+26
At present acpi_setup_base_tables() both sets up the ACPI context and writes out the base tables. We want to use an ACPI writer to write the base tables, so split this function into two, with acpi_setup_ctx() doing the context set, and acpi_setup_base_tables() just doing the base tables. Disable the writer's write_acpi_tables() function for now, to avoid build errors. It is enabled in a following patch. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: Move the acpi table to generic global_dataSimon Glass1-1/+1
Allow this to be used on any arch. Also convert to using macros so that we can check the CONFIG option in C code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-24test: fix pylint warnings in test_env.pyHeinrich Schuchardt1-8/+12
* assert does not need parentheses * add module docstring * fix misspelled constant True * limit lines to 100 characters Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-22Merge tag 'efi-2022-04-rc1-2' of ↵WIP/22Jan2022Tom Rini1-4/+16
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-04-rc1-2 Documentation: * describe printf() format codes UEFI * enable more algorithms for UEFI image verification, e.g. SHA256-RSA2048 General * simplify printing short texts for GUIDs * provide a unit test for printing GUIDs
2022-01-19doc: replace @return by Return:Heinrich Schuchardt8-20/+20
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-19test: add test for %pUsHeinrich Schuchardt1-4/+16
Add a unit test for the %pUs printf code. Use ut_asserteq_str() for checking string results. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-14phy: Track power-on and init counts in uclassAlper Nebi Yasak1-5/+78
On boards using the RK3399 SoC, the USB OHCI and EHCI controllers share the same PHY device instance. While these controllers are being stopped they both attempt to power-off and deinitialize it, but trying to power-off the deinitialized PHY device results in a hang. This usually happens just before booting an OS, and can be explicitly triggered by running "usb start; usb stop" in the U-Boot shell. Implement a uclass-wide counting mechanism for PHY initialization and power state change requests, so that we don't power-off/deinitialize a PHY instance until all of its users want it done. The Allwinner A10 USB PHY driver does this counting in-driver, remove those parts in favour of this in-uclass implementation. The sandbox PHY operations test needs some changes since the uclass will no longer call into the drivers for actions matching its tracked state (e.g. powering-off a powered-off PHY). Update that test, and add a new one which simulates multiple users of a single PHY. The major complication here is that PHY handles aren't deduplicated per instance, so the obvious idea of putting the counts in the PHY handles don't immediately work. It seems possible to bind a child udevice per PHY instance to the PHY provider and deduplicate the handles in each child's uclass-private areas, like in the CLK framework. An alternative approach could be to use those bound child udevices themselves as the PHY handles. Instead, to avoid the architectural changes those would require, this patch solves things by dynamically allocating a list of structs (one per instance) in the provider's uclass-private area. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Peter Robinson <pbrobinson@gmail.com> - Rock960
2022-01-14test: test_lsblk: Mark as sandbox specificPatrick Delaunay1-0/+1
This test checks for output specific to the sandbox blk device "sandbox_host_blk", mark it as sandbox specific. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2022-01-13bloblist: Add functions to obtain base address and sizeSimon Glass1-0/+2
Add a few convenience functions to obtain useful information about the bloblist. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-13bloblist: Use explicit numbering for the tagsSimon Glass1-6/+6
At present if someone adds a tag in the middle of the list it works well enough within a U-Boot build. But if these tags are used in another project, or with an older version of SPL, the numbers make become inconsistent. Use explicit tag numbers that never change, to resolve this problem. Allocate areas for existing U-Boot tags and set up an area for use by projects and vendors, as well as for private use. Keep tags above 0x10000 unallocated for now. Update bloblist_tag_name() and the tests to work with this new setup. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-13bloblist: Drop unused tagsSimon Glass1-2/+2
The EC event log tag is no-longer used. The vboot handoff is now handled by the vboot context instead. Drop these unused tags. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-13bloblist: Put the magic number firstSimon Glass1-0/+7
It seems best to put the magic number right at the start of the bloblist header, so it is easier to check. This is how devicetree works. Make this change now, before other projects make use of bloblist. Other changes may be needed / discussed, but that is TBD. Add a checker function as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-26video: Support showing the U-Boot logoSimon Glass1-9/+34
Show the U-Boot logo by default. This is only 7KB in size so seems like a useful default for boards that enable a display. If SPLASH_SCREEN is enabled, it is not enabled by default, so as not to conflict with that feature. Also disable it for tests, since we don't want to complicate the output. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-26video: theadorable: Use RGB565 for BMP blittingSimon Glass1-0/+46
At present this uses RGB555 format for blitting to a display. Sandbox uses 565 and that seems to be more normal for BMP as well. Update the code accordingly and add a test. Note that this likely breaks the theadorable board so we may need to discuss supporting both formats. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-26video: Add a test for 16bpp BMP filesSimon Glass1-0/+24
Add a compressed 16bpp BMP file and a test to cover this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-26video: bmp: Update RLE8 support to use the write functionSimon Glass1-0/+38
Update this code to use write_pix8() rather than writing the pixels only for a single supported display depth. This allows us to support any depth. Add some more tests too. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-26sandbox: video: Add BMP tests for 32bpp and 8bpp modesSimon Glass1-0/+38
Add a few more tests for BMP rendering. Use a back door into the sandbox SDL driver to adjust the resolution at runtime. The truetype code does not support 8bpp. Add this so that the display is not blank when running in this mode. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-23dm: core: Allow getting some basic statsSimon Glass1-0/+41
Add a function that returns some basic stats about driver model. For now we only have two. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-20Merge tag 'v2022.01-rc4' into nextWIP/20Dec2021-nextTom Rini4-0/+46
Prepare v2022.01-rc4
2021-12-09efi: Add uclass for devices provided by UEFI firmwareSimon Glass2-0/+25
UCLASS_EFI_LOADER is used for devices created by applications and drivers loaded by U-Boots UEFI implementation. This patch provides a new uclass (UCLASS_EFI_MEDIA) to be used for devices that provided by a UEFI firmware calling U-Boot as an EFI application. If the two uclasses can be unified, is left to future redesign. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-11-30test: unit test for the EFI_TCG2_PROTOCOLHeinrich Schuchardt1-0/+20
Encapsulate the UEFI EFI_TCG2_PROTOCOL unit test in an Python test. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-11-30configs: enable CMD_TPM on QEMU ARMHeinrich Schuchardt1-0/+1
With TPM emulation enabled in u-boot-test-hooks we should also provide the tpm2 command used for the test/py/tests/test_tpm2.py test. One of the Python TPMv2 tests expects sandbox specific values. So disable it on other platforms. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-11-29Merge tag 'v2022.01-rc3' into nextTom Rini9-42/+72
Prepare v2022.01-rc3 Signed-off-by: Tom Rini <trini@konsulko.com>
2021-11-28test/py: Raise a ValueError if a command failsSimon Glass1-1/+1
At present an Exception is raised if a command fails. This is a very broad class and makes it difficult for callers to catch the error without also catching other things, like programming bugs. Change it to ValueError to make this easier. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-28test/py: Relax the naming rules for unit testsSimon Glass1-1/+1
At present the collection function used by pytest is quite strict on the naming of the functions it detects. In particular it requires the name of the test to be repeated in the function name. This is not enforced anywhere else, but instead the tests are silently omitted from the pytest run. This affects a few dozen tests. The rule does not seem to have any particular purpose. Relax it, so that all tests that use the UNIT_TEST() macro will run, regardless of the name of the test function. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-28dm: core: Add a way to obtain a string listSimon Glass1-0/+20
At present we support reading a string list a string at a time. Apart from being inefficient, this makes it impossible to separate reading of the devicetree into the of_to_plat() method where it belongs, since any code which needs access to the string must read it from the devicetree. Add a function which returns the string property as an array of pointers to the strings, which is easily used by clients. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-28dm: core: Add tests for stringlist functionsSimon Glass1-0/+76
These functions currently lack tests so add some. The error handling differs betwee livetree and flattree at present, so only check the error codes with livetree. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-28test/py: Allow passing input to a programSimon Glass2-5/+8
When running a program on the host, allow input to be passed in as stdin. This is needed for running sfdisk, for example. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-26test: 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-26test: 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-26test: 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-26test: 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-26test: 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-16env: Allow U-Boot scripts to be placed in a .env fileSimon Glass1-0/+107
At present U-Boot environment variables, and thus scripts, are defined by CONFIG_EXTRA_ENV_SETTINGS. It is painful to add large amounts of text to this file and dealing with quoting and newlines is harder than it should be. It would be better if we could just type the script into a text file and have it included by U-Boot. Add a feature that brings in a .env file associated with the board config, if present. To use it, create a file in a board/<vendor> directory, typically called <board>.env and controlled by the CONFIG_ENV_SOURCE_FILE option. The environment variables should be of the form "var=value". Values can extend to multiple lines. See the README under 'Environment Variables:' for more information and an example. In many cases environment variables need access to the U-Boot CONFIG variables to select different options. Enable this so that the environment scripts can be as useful as the ones currently in the board config files. This uses the C preprocessor, means that comments can be included in the environment using /* ... */ Also support += to allow variables to be appended to. This is needed when using the preprocessor. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Tested-by: Marek Behún <marek.behun@nic.cz>
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-11lib: 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-11lib: 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-15Merge 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-14pytest: 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>