summaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)Author
2018-11-20dm: core: Widen the dump tree to show more of the driver's name.Liviu Dudau
With drivers that have prefix names that are quite long (like 'versatile_') it is useful to have a wider column for the driver's name when dumping the device driver tree. Also update the tests to take into account the wider output format. Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-11-16test/py: test pinmux commandPatrice Chotard
Add pinmux test which test the following commands: - pinmux list - pinmux dev - pinmux status Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Mark some tests as sandbox-centric] Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2018-10-09log: Add helpers for common log levelsSimon Glass
At present to output a log message you need something like: log(UCLASS_SPI, LOCL_INFO, "message1"); log(UCLASS_SPI, LOCL_INFO, "message2"); but many files use the same category throughout. Also it is helpful to shorten the length of log names, providing helpers for common logging levels. Add some macros so that it is possible to do: (top of file, before #includes) #define LOG_CATEGORY UCLASS_SPI (later in the file) log_info("message1"); log_debug("message2"); log_err("message3"); Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08binman: Run tests concurrentlySimon Glass
At present the tests run one after the other using a single CPU. This is not very efficient. Bring in the concurrencytest module and run the tests concurrently, using one process for each CPU by default. A -P option allows this to be overridden, which is necessary for code-coverage to function correctly. This requires fixing a few tests which are currently not fully independent. At some point we might consider doing this across all pytests in U-Boot. There is a pytest version that supports specifying the number of processes to use, but it did not work for me. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08test/py: Fix unicode handling for log filteringSimon Glass
At present the unicode filtering seems to get confused at times with this error: UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 32: ordinal not in range(128) It seems to be due to self._nonprint being interpreted as UTF-8. Fix it by using ordinals instead of characters, changing the string to set. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Michal Simek <michal.simek@xilinx.com>
2018-10-07test_avb: Update pymark.buildconfigspec information for the AVB testsJens Wiklander
Update the pymark.buildconfigspec to depend on 'cmd_mmc' in addition to 'cmd_avb' for those tests that needs more a more complete MMC implementation or the "mmc" command. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-10-06test/py: test_fs: add docstring comments to helper functionsAkashi Takahiro
After Siomon's comment, add a descriptive comment (docstring) to each of helper functions in conftest.py. No functionality changed. Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-10-06test/py: test_fs: remove fs_type argument from umount_fs()Akashi Takahiro
Since there is no use of fs_type in umount_fs(), just remove it. Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-10-06test/py: ignore console read exceptions after test failureStephen Warren
After a test has failed, test/py drains the U-Boot console log to ensure that any relevant output is captured. At this point, we don't care about detecting any additional errors, since the test is already known to have failed, and U-Boot will be restarted. To ensure that the test cleanup code is not interrupted, and can correctly terminate the log sections for the failed test, ignore any exception that occurs while reading the U-Boot console output during this limited period of time. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2018-09-23efi_selftest: test key notification functionsHeinrich Schuchardt
Use a key notification function to leave the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL test. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOLHeinrich Schuchardt
Add a unit test for the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: rework test_efi_selftest_text_input()Heinrich Schuchardt
Use more precise regular expressions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: Unicode w/ EFI_SIMPLE_TEXT_INPUT_PROTOCOLHeinrich Schuchardt
Test that the Euro sign is correctly retrieved from the console via the EFI_SIMPLE_TEXT_INPUT_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: fs: add fstest/unlink testAkashi, Takahiro
In this commit, test cases for unlink interfaces are added as part of "test_fs" test suite. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: fs: add fstest/mkdir testAKASHI Takahiro
In this commit, test cases for mkdir interfaces are added as part of "test_fs" test suite. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: fs: add extended write operation testAKASHI Takahiro
In this commit and the following, test scripts for new filesystem functionalities introduced by my patch set, "fs: fat: extend FAT write operations," are provided. In particular, this patch adds test cases for sub-directory write and write with non-zero offset. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: convert fs-test.sh to pytestAKASHI Takahiro
In this commit, the same set of test cases as in test/fs/fs-test.sh is provided using pytest framework. Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs" (fatxx and etc.) and "fs" (hostfs), and this patch currently supports only "nonfs" variant; So it is not a replacement of fs-test.sh for now. Simple usage: $ py.test test/py/tests/test_fs [<other options>] You may also specify filesystem types to be tested: $ py.test test/py/tests/test_fs --fs-type fat32 [<other options>] Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: typo occuredHeinrich Schuchardt
%s/occured/occurred/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23test/py: test EFI_SIMPLE_TEXT_INPUT_PROTOCOLHeinrich Schuchardt
Execute the EFI selftest for the EFI_SIMPLE_TEXT_INPUT_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
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>