summaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)Author
2018-09-11test/py: Extend fpga command to test all fpga load typesMichal Simek
Add support for info, load, loadp, loadb, loadbp, loadmk_legacy, loadmk_legacy_gz, loadmk_fit, loadfs also with variable support. There are probably missing failed tests. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-08-21cmd: Add bind/unbind commands to bind a device to a driver from the command lineJean-Jacques Hiblot
In some cases it can be useful to be able to bind a device to a driver from the command line. The obvious example is for versatile devices such as USB gadget. Another use case is when the devices are not yet ready at startup and require some setup before the drivers are bound (ex: FPGA which bitsream is fetched from a mass storage or ethernet) usage example: bind usb_dev_generic 0 usb_ether unbind usb_dev_generic 0 usb_ether or unbind eth 1 bind /ocp/omap_dwc3@48380000/usb@48390000 usb_ether unbind /ocp/omap_dwc3@48380000/usb@48390000 Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-07-28test/py: tpm2: switch from 'tpm' to 'tpm2' commandMiquel Raynal
While using the 'tpm' command should work on most cases, this test suite only works with TPMv2 and since the work to make both versions build at the same time, we might end up having both 'tpm' (TPMv1) and 'tpm2' (TPMv2) commands available at the same time. Ensure this test suite always use the right one. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-20test/py: add test for whitelist of variables while importing environmentQuentin Schulz
This tests that the importing of an environment with a specified whitelist works as intended. If there are variables passed as parameter to the env import command, those only should be imported in the current environment. For each variable passed as parameter, if - foo is bar in current env and bar2 in exported env, after importing exported env, foo shall be bar2, - foo does not exist in current env and foo is bar2 in exported env, after importing exported env, foo shall be bar2, - foo is bar in current env and does not exist in exported env (but is passed as parameter), after importing exported env, foo shall be empty ONLY if the -d option is passed to env import, otherwise foo shall be bar, Any variable not passed as parameter should be left untouched. Two other tests are made to test that size cannot be '-' if the checksum protection is enabled. Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2018-07-20test/py: remove hacks for non-zero RAM base address in testsQuentin Schulz
Some functions have different behaviour when the given address is 0 (assumed to be NULL by the function). find_ram_base() does not return 0 anymore so it's safe to remove those offsets. Suggested-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2018-07-20test/py: return a RAM address different from 0 as it can be interpreted as NULLQuentin Schulz
Some functions test that the given address is not NULL (0) and fail or have a different behaviour if that's the case (e.g. hexport_r). Let's make the RAM base address to be not zero by setting it to 2MiB if that's the case. 2MiB is chosen because it represents the size of an ARM LPAE/v8 section. Suggested-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2018-07-11Merge git://git.denx.de/u-boot-dmTom Rini
2018-07-10vboot: Add FIT_SIGNATURE_MAX_SIZE protectionTeddy Reed
This adds a new config value FIT_SIGNATURE_MAX_SIZE, which controls the max size of a FIT header's totalsize field. The field is checked before signature checks are applied to protect from reading past the intended FIT regions. This field is not part of the vboot signature so it should be sanity checked. If the field is corrupted then the structure or string region reads may have unintended behavior, such as reading from device memory. A default value of 256MB is set and intended to support most max storage sizes. Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Teddy Reed <teddy.reed@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-10test/py: vboot: Remove stderr redirect from openssl commandPaul Burton
The openssl command specified in test_with_algo() ultimately ends up being run by RunAndLog::run(), which uses it to construct a Popen object with the default shell=False. The stderr redirect in the command is therefore simply passed to openssl as an argument. With at least openssl 1.1.0f this causes openssl, and therefore test_vboot, to fail with: genpkey: Use -help for summary. Exit code: 1 Any stderr output ought to be captured & stored in the RunAndLog object's output field and returned from run() via run_and_log() to test_with_algo() which then ignores it anyway, so we can drop the shell-like redirection with no ill effects. With this fix test_vboot now passes for me. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-07-10test/py: hush_if_test: Use open() in place of file()Paul Burton
In python 3.x the file() function has been removed. Use open() instead, which works on both python 2.x & 3.x, and is described as the preferred method of opening a file by python 2.x documentation anyway. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-07-10test/py: fit: Open files as binary filesPaul Burton
The read_file() function in test_fit is used with files that are not text files, as well as some that are. It is never used in a way that requires it to decode text files to characters, so open all files in binary mode such that read() doesn't attempt to decode characters for files which are not text files. Without this test_fit fails on python 3.x when reading an FDT in run_fit_test() with: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-07-10test/py: Import 'configparser' lower case to be python 3.x safePaul Burton
In python 3.x the configparser module is named with all lower case. Import it as such in order to avoid errors when running on python 3.x, and fall back to the CamelCase version in order to keep working with python 2.x. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-07-10test/py: Use range() rather than xrange()Paul Burton
In python 3.x the xrange() function has been removed, and range() returns an iterator much like Python 2.x's xrange(). Simply use range() in place of xrange() in order to work on both python 2.x & 3.x. This will mean a small cost on python 2.x since range() will return a list there rather than an iterator, but the cost should be negligible. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-07-10test/py: Make print statements python 3.x safePaul Burton
In python 3.x print must be called as a function rather than used as a statement. Update uses of print to the function call syntax in order to be python 3.x safe. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-06-19test_avb: Add pymark.buildconfigspec information for the AVB testsTom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-06-18test/py: avb2.0: add tests for avb commandsIgor Opaniuk
1. Run AVB 2.0 full verification chain, avb verify 2. Check if 'avb get_uuid' works, compare results with 'part list mmc 1' output 3. Test `avb read` commands, which reads N bytes from a partition identified by a name Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2018-05-31tests: Make test_log.py tests depend on cmd_log not logTom Rini
While the tests in this testcase are for the log subsystem they are only able to be run if CONFIG_CMD_LOG is enabled as well as CONFIG_LOG, so update the buildconfigspec requirement. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-25test/py: add TPMv2.x test suiteMiquel Raynal
Add tests for the TPMv2.x commands. These commands may run both on a physical TPM and with the sandbox driver. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-04efi_selftest: check installation of the device treeHeinrich Schuchardt
The unit test checks if a device tree is installed. It requires that the 'compatible' property of the root node exists. If available it prints the 'serial-number' property. The serial-number property is derived from the environment variable 'serial#'. This can be used to check if the image_setup_libfdt() function is executed. A Python test is supplied. It sets a value for serial# and checks that the selftest shows this as serial-number. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-03-22test/py: add spi_flash testsLiam Beguin
Add basic tests for the spi_flash subsystem. Signed-off-by: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-03-22test/py: add generic CRC32 functionLiam Beguin
Add a generic function which can be used to compute the CRC32 value of a region of RAM. Signed-off-by: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-03-22test/py: do not import pytest multiple timesLiam Beguin
Signed-off-by: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-03-22test/py: README: add HOSTNAME to PYTHONPATHLiam Beguin
As opposed to PATH, HOSTNAME is not appended to PYTHONPATH automatically. Lets add it to the examples to make it more obvious to new users. Signed-off-by: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-03-22test/py: README: fix typoLiam Beguin
Fix a minor typo causing vim (and possibly other) to get confused with coloring. Signed-off-by: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-03-13test/py: highlight warnings in the log summaryStephen Warren
Currently, if a test emits a warning message but otherwise passes, there's no indication of this in the log summary, which can lead to warnings being missed. Enhance the test logic to explicitly mention warnings in otherwise passing tests, and not to collapse the log sections for tests with warnings, so that they're more easily seen when scanning the log. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2018-03-13test/py: add MMC/SD block read testStephen Warren
Add a standalone MMC block read 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: Stephen Warren <swarren@nvidia.com>
2018-02-03log: Add tests for the new log featuresSimon Glass
Add a test of the 'log format' and 'log rec' commands. This also covers things like log_get_cat_by_name(), since they are used by these commands. Fix a style nit in the tests also. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-02-03log: Update log_console to honour the log formatSimon Glass
At present this just outputs the message. Update it to output whatever the format requests. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-01-28host-tools: use python2 explicitly for shebangMasahiro Yamada
All of these host tools are apparently written for Python2, not Python3. Use 'python2' in the shebang line according to PEP 394 (https://www.python.org/dev/peps/pep-0394/). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-12-18test/py: Setup variables based on HUSH selectionStephen Warren
After adding our small zynq uboot which has hush parser off same variable tests start to failed. Use quotes only when hush is enabled. Reported-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
2017-12-12test: py: Add an option to skip sleep testMichal Simek
Some QEMUs have a problem with time setup that's why sleep test is failing. Introduce env__sleep_accurate boardenv variable to have an option to skip sleep test. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2017-12-12test/py: gpt: update size of gpt partitionPatrick Delaunay
- avoid disturbing 0MiB partition size (in fact < 1MiB) - test overlap limit between part1 and part2 - test gpt write with data with modifier 'M' for MiB Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2017-12-07log: test: Add a pytest for loggingSimon Glass
Add a test which tries out various filters and options to make sure that logging works as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-05Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini
Patch queue for efi - 2017-12-05 Highlights for this release: - Dynamic EFI object creation (lists instead of static arrays) - EFI selftest improvements - Minor fixes
2017-12-02test/py: Allow any unit test suite to be foundSimon Glass
The u-boot.sym file is scanned to find unit test suites for execution. At present it only finds those whose names start with 'dm' or 'env'. This code is buried in the bowels of the test code so when adding a new suite it is not easy to discover why it is ignored by the test framework. There seems to be no need to make this restriction. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Stephen Warren <swarren@nvidia.com>
2017-12-01test/py: check return code of helloworldHeinrich Schuchardt
Check that helloworld.efi returns EFI_SUCCESS. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01test/py: fix typo in test_efi_loader.pyHeinrich Schuchardt
Make a comment line easier to read. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01test/py: test reboot by EFI watchdogHeinrich Schuchardt
Clear environment variable efi_selftest before executing the default tests. Provide a test verifying that the EFI watchdog reboots the system upon timeout. The test depends on CONFIG_CMD_EFI_SELFTEST=y. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-11-17test/py: add timestamps to logStephen Warren
It can be useful to record how long tests take; this can help debug slow running test systems or track changes in performance over time. Enhance the test system to record timestamps while running test: - Whenever a new log file section is started. - After U-Boot is started and communication has been established. - After each host or U-Boot command is executed. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2017-11-06test/py: regenerate persistent GPT image if code changesStephen Warren
test_gpt generates a persistent disk image which can be re-used across multiple test runs. Currently, if the Python code that generates the disk image change, the image is not regenerated, which could cause test failures e.g. if a test was updated to expect some new partition name or size, yet the persistent disk image contained the old name or size. This change introduces functionality to regenerate the disk image if the instructions to generate the image have changed. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2017-10-23test/py: fix typos in README.mdMasahiro Yamada
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2017-10-23cmd: gpt: solve issue for swap and rename commandPatrick Delaunay
don't use prettyprint_part_size() in create_gpt_partitions_list() that avoid to align offset and size to 1 MiB and increase precision for start and size. This patch avoid the risk to change partition size and lost data during rename or swap. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2017-10-23test/py: gpt: test start LBA for sub-command rename and swapPatrick Delaunay
Add test of first and last LBA in gpt for rename and swap. Only the name is expected to change, so test 3 columns for part command 1: first LBA (start) 2: last LBA (end) 3: partition name After rename, the last LBA change and it is a error in current U-Boot code + "first" = 0x7ff : invalid value (<start) + "second" = 0x17ff => size increasing ! Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2017-10-23test/py: gpt: add test for sub-command writePatrick Delaunay
+ test write for one partition on all the device (size=0) + test write with disk uuid and 2 partitions Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2017-10-23test/py: gpt: add test for sub-command read and verifyPatrick Delaunay
add sandbox test for some gpt sub-command - gpt read / part list : read the gpt partition created by sgdisk on host test start, size, LBA and name output - gpt verify : verify the gpt partition create by sgdisk on host PS: persistent data test_gpt_disk_image.bin are udpated Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2017-10-23test/py: gpt: copy persistent filePatrick Delaunay
copy the persistent gpt binary file as it can be modified during the test that avoid issue if the test fail: the test always restart with clean file Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2017-10-16test/py/tests/test_sleep.py: test time approximatelyHeinrich Schuchardt
On qemu errors like assert 2.999650001525879 >= 3 occur. According to the comment in the code the test is meant to be approximate. So we should accept some milliseconds less. Cc: Stephen Warren <swarren@nvidia.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2017-10-01Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini
Patch queue for efi - 2017-10-01 Lots of new things this time. High level highlights are: - Shim support (to boot Fedora) - Initial set of unit tests - Preparations to support UEFI Shell
2017-09-29test/py: fix anchors in HTML status reportStephen Warren
The current code wraps a pre tag inside an a tag. For some reason, this causes at least Firefox to attempt to drag the pre section content when using a mouse drag to select text. Re-order the tags so that the text can be selected using the mouse, at least if you start the drag outside the text (after the end of the line, for example). Signed-off-by: Stephen Warren <swarren@nvidia.com>