summaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)AuthorFilesLines
2020-07-16efi_loader: skip warnings for network configurationHeinrich Schuchardt1-5/+11
Skip messages should only be written if the setup is not suitable for testing. If DHCP is enabled, we should not write a skip message if no static network configuration is supplied. Likewise if a static network configuration is supplied, we should not write a skip message if DHCP is not enabled. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-12test: use virt-make-fs to build imageHeinrich Schuchardt2-30/+4
Avoid sudo for test/py/tests/test_efi_secboot by using virt-make-fs. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-12test/py: efi_secboot: add a test for verifying with digest of signed imageAKASHI Takahiro2-0/+59
Signature database (db or dbx) may have not only certificates that contain a public key for RSA decryption, but also digests of signed images. In this test case, if database has an image's digest (EFI_CERT_SHA256_GUID) and if the value matches to a hash value calculated from image's binary, authentication should pass in case of db, and fail in case of dbx. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Use defined time stamps for sign-efi-sig-list. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-12test/py: efi_secboot: add a test for multiple signaturesAKASHI Takahiro2-1/+59
In this test case, an image is signed multiple times with different keys. If any of signatures contained is not verified, the whole authentication check should fail. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Provide a defined time stamp for dbx_hash1.auth. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-12test/py: efi_secboot: add a test against certificate revocationAKASHI Takahiro2-1/+31
Revocation database (dbx) may have not only certificates, but also message digests of certificates with revocation time (EFI_CERT_X509_SHA256_GUILD). In this test case, if the database has such a digest and if the value matches to a certificate that created a given image's signature, authentication should fail. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Set defined time stamp for dbx_hash.auth. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-12test/py: efi_secboot: split "signed image" test case-1 into two casesAKASHI Takahiro1-28/+38
Split the existing test case-1 into case1 and a new case-2: case-1 for non-SecureBoot mode; case-2 for SecureBoot mode. In addition, one corner case is added to case-2; a image is signed but a corresponding certificate is not yet installed in "db." Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-07-12test/py: efi_secboot: more fixes against pylintAKASHI Takahiro4-83/+79
More fixes against pylint warnings that autopep8 didn't handle in the previous commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-07-12test/py: efi_secboot: apply autopep8AKASHI Takahiro5-60/+67
Python's autopep8 can automatically correct some of warnings from pylint and rewrite the code in a pretty print format. So just do it. Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-07-10drivers: rename drivers to match compatible stringWalter Lozano1-27/+27
When using OF_PLATDATA, the bind process between devices and drivers is performed trying to match compatible string with driver names. However driver names are not strictly defined, and also there are different names used when declaring a driver with U_BOOT_DRIVER, the name of the symbol used in the linker list and the used in the struct driver_info. In order to make things a bit more clear, rename the drivers names. This will also help for further OF_PLATDATA improvements, such as checking for valid driver names. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Add a fix for sandbox of-platdata to avoid using an invalid ANSI colour: Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-10log: don't show function by defaultHeinrich Schuchardt1-0/+2
The name of the function emitting a log message may be of interest for a developer but is distracting for normal users. See the example below: try_load_entry() Booting: Debian Make the default format for log messages customizable. By default show only the message text. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-08test_sleep.py: make sleep time and margin configurableHeiko Schocher1-3/+11
make the sleep time and the margin configurable. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2020-07-07cmd: blkls: Add blkls commandNiel Fourie1-0/+13
Add a command to print a list of available block device drivers, and for each, the list of known block devices. Signed-off-by: Niel Fourie <lusus@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
2020-07-07cmd: dm: Fixed/Added DM driver listing subcommandsNiel Fourie1-2/+20
Renamed dm "drivers" subcommand to "compat" (as it listed compatibility strings) and prevent it from segfaulting when drivers have no of_match populated. Added a new "drivers" subcommand to dump a list of all known DM drivers and for each, their uclass id, uclass driver and names of attached devices. Added a new "static" subcommand to dump a list of DM drivers with statically defined platform data. Signed-off-by: Niel Fourie <lusus@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-07cmd: fs: Add command to list supported fs typesNiel Fourie1-0/+13
Added command "fstypes" to list supported/included filesystems. Signed-off-by: Niel Fourie <lusus@denx.de> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Limit to sandbox] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-07-07cmd: part: Add subcommand to list supported partition tablesNiel Fourie1-0/+14
Add a subcommand "types" to the part command, which lists the supported partition table types. Signed-off-by: Niel Fourie <lusus@denx.de> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-03test: correct time stamps for UEFI authenticationHeinrich Schuchardt1-8/+8
A time authenticated variable cannot be overwritten with another value with the same time stamp. So we must ensure the correct sequence of time stamps when generating out test data. Using parameter -t for sign-efi-sig-list gives reproducible results and avoids sleep statements. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-03test/py: efi_secboot: fix test case 1g of test_authvarAKASHI Takahiro1-6/+6
In the test case (1g) of test_authvar, "db" is mistakenly used, and it ends up being the exact same as (1f). So correct it as "dbx" test case. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-03test/py: efi_secboot: remove all "re.search"AKASHI Takahiro3-74/+65
Currently, we don't use any regular expression in matching outputs from U-Boot. Since its use is just redundant, we can remove all. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-03Revert "test: stabilize test_efi_secboot"AKASHI Takahiro3-9/+9
This reverts commit 5827c2545849441dd60467565aac11964259972f. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-06-30test/py: test_efi_fit: Update #size-cells to 1Bin Meng1-2/+2
test_efi_fit tests fail on RISC-V currently. This is due to the RISC-V arch_fixup_fdt() checks the #size-cells of the root node in order to correctly fix up the reserved memory node. Per the DT binding, the /reserved-memory node requires both <#address-cells> and <#size-cells> and they should use the same values as the root node. For the root node, it's not very useful if <#size-cells> is zero. Update #size-cells to 1 so tests can pass. Signed-off-by: Bin Meng <bin.meng@windriver.com>
2020-06-02test/py: use actual core count for parallel buildsHeinrich Schuchardt1-1/+1
When building U-Boot we should not blindly use make -j8 but consider the actual core count given by os.cpu_count(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Stephen Warren <swarren@nvidia.com>
2020-05-09test: describe naming conventions for macro UNIT_TESTHeinrich Schuchardt1-1/+16
Strict naming conventions have to be followed for Python function generate_ut_subtest() to collect C unit tests to be executed via command 'ut'. Describe the requirements both on the C as well on the Python side. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-04test: stabilize test_efi_secbootHeinrich Schuchardt3-9/+9
When setting up the console via function efi_console_register() we call query_console_serial(). This functions sends an escape sequence to the terminal to query the display size. The response is another escape sequence. console.run_command_list() is looking for a regular expression '^==>'. If the escape sequence for the screen size precedes the prompt without a line break, no match is found. When efi_disk_register() is called before efi_console_register() this leads to a test failuere of the UEFI secure boot tests. We can avoid the problem if the first UEFI command passed to u_boot_console.run_command_list() produces output. This patch achieves this by appending '; echo' to the first UEFI related command of the problematic tests. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-05-01test/py: vboot: add a test to check fit signature on fit with paddingPhilippe Reynes1-19/+33
The pytest vboot does all his tests on fit without padding. We add the same tests on fit with padding. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-04-30test/py: fix test_efi_secboot/conftest.pyHeinrich Schuchardt1-24/+6
If udisksctl is present test/py/tests/test_efi_secboot/conftest.py fails because the disk image is never mounted. Normal users can only mount fuse file systems. Unfortunately fusefat is still in an experimental state and seems not to work here correctly. So as we have to be root or use the sudo command anyway delete all coding referring to udisksctl. -- We should not use mount point /mnt as this directory or one of its sub-directories might already be in use as active mount points. Instead create a new directory in the build root as mount point. -- Remove debug print statements that have been commented out. print without parentheses is anyway invalid in Python 3. And pytest anyway filters out the output if there is no exception reported. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-04-27test: test_fs error messageHeinrich Schuchardt1-2/+3
For non-root users mkfs.vfat is not in the search path at least on Debian. Hence when running 'make tests' a message indicates that file system tests have been skipped: SKIPPED [13] test/py/tests/test_fs/conftest.py:340: Setup failed for filesystem: fat16 This message is not really helpful as the executed program is not indicated. Provide a more complete message like SKIPPED [13] test/py/tests/test_fs/conftest.py:340: Setup failed for filesystem: fat16. Command 'mkfs.vfat -F 16 build-sandbox/persistent-data/3GB.fat16.img' returned non-zero exit status 127. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-04-17test: pinmux: add pincontrol-gpio for pin configurationPatrick Delaunay1-0/+10
Add a simple pincontrol associated to the sandbox gpio driver, that allows to check pin configuration with the command pinmux. The pinmux test is also updated to test behavior with 2 pincontrols. Example to check LED pin configuration: => pinmux list | Device | Driver | Parent | pinctrl-gpio | sandbox_pinctrl_gpio | root_driver | pinctrl | sandbox_pinctrl | root_driver => pinmux dev pinctrl-gpio => pinmux status a0 : gpio input . a1 : gpio input . a2 : gpio input . a3 : gpio input . a4 : gpio input . a5 : gpio output . a6 : gpio output . ... Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-17test: dm: update test for pins configuration in pinctrl nodePatrick Delaunay1-10/+18
Add test for "pins" configuration in gpio uclass with set_state() ops and test for generic parsing of pinconf_param array). set_state() is called by: - pinctrl_generic_set_state |- pinctrl_generic_set_state_subnode Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-16efi_loader, pytest: add UEFI secure boot tests (image)AKASHI Takahiro2-0/+238
Provide test cases for * image authentication for signed images (test_efi_secboot/test_signed.py) * image authentication for unsigned images (test_efi_secboot/test_unsigned.py) Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-04-16efi_loader, pytest: add UEFI secure boot tests (authenticated variables)AKASHI Takahiro1-0/+282
Provide a couple of test cases for variable authentication. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-04-16efi_loader, pytest: set up secure boot environmentAKASHI Takahiro3-0/+180
A fixture for UEFI secure boot tests (image authentication and variable authentication) is defined. A small file system with test data in a single partition formatted in fat is created. This test requires efitools v1.5.2 or later. If the system's efitools is older, you have to build it on your own and define EFITOOLS_PATH. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-04-13Merge branch 'next'Tom Rini3-13/+37
Pull in changes that have been pending in our 'next' branch. This includes: - A large number of CI improvements including moving to gcc-9.2 for all platforms. - amlogic, xilinx, stm32, TI SoC updates - USB and i2c subsystem updtaes - Re-sync Kbuild/etc logic with v4.19 of the Linux kernel. - RSA key handling improvements
2020-04-11test/py: Allow using buildman to build U-BootSimon Glass2-10/+33
It is a pain to have to set the CROSS_COMPILE environment variable when using test.py's --build option. It is possible to get this using the -A option from buildman. But it seems better to just use buildman to do the build when it is available. However using buildman adds a new dependency to the test system which we want to avoid. So leave the default as is and add a flag to make it use buildman. Note that most of these changes relate to test.py and the parts of the travis/gitlab/azure scripts which relate to running test and building a suitable U-Boot to run the tests on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2020-04-10test/py: Update u_boot_utils.find_ram_base to bypass the low 2MiB memoryBin Meng1-3/+4
On some RISC-V targets the low memory is protected that prevents S-mode U-Boot from access. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2020-04-09cmd: Add test and fix bugs for dm driversSean Anderson1-0/+17
Add a test for the dm drivers command. Also fix a null pointer dereference revealed by said test. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-01test: vboot: Reduce fake kernel size to 500 bytesSimon Glass1-1/+1
We don't need 5KB to test things out. A smaller size makes it easier to look at the FIT with fdtdump. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01test: vboot: Move key creation into a functionSimon Glass1-21/+18
This code is repeated so move it into a function with a parameter. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01test: vboot: Fix pylint errorsSimon Glass1-34/+19
Fix various minor things noticed by pylint. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01test: vboot: Tidy up the code a littleSimon Glass1-13/+21
Fix some long lines and comments. Use a distinct name for the 'required key' test. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01test: vboot: Parameterise the testSimon Glass1-6/+14
This test is actually made up of five separate tests. Split them out so that they appear as separate tests. Unfortunately this restarts U-Boot multiple times which adds about a second to the already-long vboot test, about 8 seconds total on my machine. We could add a special 'teardown' test afterwards but if the tests are executed out of order that would not work. Changing test_vboot into a class causes it not to be discovered and makes it different from all other tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01test: vboot: Add a test for a forged configurationSimon Glass2-1/+440
Add a check to make sure that it is not possible to add a new configuration and use the hashed nodes and hash of another configuration. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01test: vboot: Drop unnecessary parameter for fit_check_signSimon Glass1-2/+1
This tool only uses the last -k parameter provided. Drop the earlier one since it has no effect. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-03-30test/py: test_efi_grub_net() requires OF_CONTROLHeinrich Schuchardt1-0/+1
With CONFIG_OF_CONTROL environment variable $fdtcontroladdr is not defined and test_efi_grub_net() fails. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-28test/py: UEFI helloworld requires OF_CONTROLHeinrich Schuchardt1-2/+3
With CONFIG_OF_CONTROL environment variable $fdtcontroladdr is not defined and test_efi_helloworld_net() fails. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-03-27test/py: mmc: Fix 'mmc info' testcaseHarald Seiler1-2/+2
Commit 41e30dcf8796 ("cmd: mmc: Make Mode: printout consistent") fixed the layout of `mmc info` output. Reflect this change in the respective testcase. Also fix a typo in the documentation. Fixes: 41e30dcf8796 ("cmd: mmc: Make Mode: printout consistent") Signed-off-by: Harald Seiler <hws@denx.de> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-03-13cmd: gpio: Make `gpio input` return pin value againAlex Kiernan1-0/+37
4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value") correctly changed the behaviour of the gpio command to return CMD_RET_SUCCESS or CMD_RET_FAILURE, but any existing script which expects the return value to be the pin value is broken by this change. Reinstate the legacy behaviour for `gpio input` only. Fixes: 4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value") Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alex Kiernan <alex.kiernan@hivehome.com> Reviewed-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>