aboutsummaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)AuthorFilesLines
2018-03-22test/py: add spi_flash testsLiam Beguin1-0/+218
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 Beguin1-0/+23
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 Beguin1-1/+0
Signed-off-by: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-03-22test/py: README: add HOSTNAME to PYTHONPATHLiam Beguin1-2/+2
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 Beguin1-1/+1
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 Warren3-3/+50
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 Warren1-0/+129
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 Glass1-1/+27
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 Glass1-2/+2
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 Yamada1-1/+1
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 Warren1-1/+10
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 Simek1-0/+13
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 Delaunay1-15/+17
- 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 Glass1-0/+101
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 Rini2-2/+16
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 Glass1-1/+1
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 Schuchardt1-0/+2
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 Schuchardt1-1/+1
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 Schuchardt1-1/+13
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 Warren3-0/+44
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 Warren2-17/+92
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 Yamada1-3/+3
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 Delaunay1-10/+6
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 Delaunay1-4/+12
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 Delaunay1-0/+20
+ 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 Delaunay1-2/+29
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 Delaunay1-9/+14
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 Schuchardt1-1/+1
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 Rini1-0/+25
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 Warren1-4/+4
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>
2017-09-29test/py: add skip marker for reliance on toolsStephen Warren5-5/+43
Some tests use external tools (executables) during their operation. Add a test.py mark to indicate this. This allows those tests to be skipped if the required tool is not present. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2017-09-29test/py: provide more information about test skip reasonStephen Warren1-3/+3
When skipping tests, explicitly mention the board type or config option that caused the skip. This will help people understand/fix any issues. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2017-09-29test/py: Document required tools/packagesStephen Warren1-1/+6
Some tests rely on external tools. Mention these in the test/py README. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2017-09-18test/py: add a test calling the EFI selftestHeinrich Schuchardt1-0/+25
A Python test script is provided that runs the EFI selftest if CONFIG_CMD_EFI_SELFTEST=y. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-15test/py: gpt: make use of infra-structureStephen Warren2-40/+66
Make various changes to the GPT test: 1) Reference the disk image using an absolute path in all cases. This allows test/py to operate correctly if it's run from a directory other than the root of the U-Boot source tree. 2) Store the disk image in the teswt/py persistent data directory. This removes the need to re-generate it every time the tests are run. 3) Execute sgdisk using u_boot_utils.run_and_log() so that its output is captured in the test log. This allows debugging any problems running it. 4) Make the disk image a test fixture. This removes the requirement to always run all GPT tests, and run them in order. The current code doesn't create the disk image if e.g. just test_gpt_uuid() is executed via the test.py -k command-line option. 5) Use @pytest.mark.buildconfigspec for all feature dependencies, rather than manually implementing some of them. 6) Make all tests depend on sandbox, since they use the sandbox-specific host command. Fixes: a2f422555fc8 ("add pytests for 'gpt guid' command in sandbox") Fixes: c5772188ede9 ("add pytests for 'gpt rename' and 'gpt swap'") Signed-off-by: Stephen Warren <swarren@nvidia.com> Tested-by: Tom Rini <trini@konsulko.com>
2017-09-15test/py: u_boot_console_base.py: fix typoHeinrich Schuchardt1-1/+1
run_command does not have a parameter wait_for_each. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2017-09-14add pytests for 'gpt rename' and 'gpt swap'Alison Chaiken1-0/+31
Add unit tests for the 'gpt rename' and 'gpt swap' commands that rely on the block device created by test/py/make_test_disk.py. Add CONFIG_CMD_GPT_RENAME to the sandbox_defconfig. Remove the testdisk.raw test device at the end of the tests. Signed-off-by: Alison Chaiken <alison@peloton-tech.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-14add pytests for 'gpt guid' command in sandboxAlison Chaiken1-0/+38
Run unit tests for the 'gpt guid' command, making use of the block device created by test/py/make_test_disk.py. Remove this device at the end of the tests. Signed-off-by: Alison Chaiken <alison@peloton-tech.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-14GPT: create block device for sandbox testingAlison Chaiken1-0/+19
Provide a Python function that creates a small block device for the purpose of testing the cmd/gpt.c or cmd/part.c functions in the u-boot sandbox. Signed-off-by: Alison Chaiken <alison@peloton-tech.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-13test: Move the FIT test into the correct placeSimon Glass1-0/+428
Move this test so that it will run when 'make tests' is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-22tests: test_dfu.py: Add example udev rule for host_usb_dev_nodeTom Rini1-0/+7
If one does not already have a rule to create a custom device node when a given device enumerates it can be useful to have udev create a bus path based node to the entry in /dev/bus/usb that was just enumerated. Given that DFU itself does not require a /dev entry it is a good idea to provide a rule that will generate one. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-07-11sandbox: Stop printing platdata at the start of SPLSimon Glass1-29/+1
Currently we have code which prints out platform data at the start of SPL. Now that we have tests for dtoc this is probably not necessary. Drop it. Update test_ofplatdata to check for empty output since it is useful to check that sandbox_spl works as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05test: py: hush: Add echo dependencyMichal Simek1-0/+2
Some tests depends on echo command to be present. Reported-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2017-06-05test: py: Use global pytestmark for hush testsMichal Simek1-4/+2
All tests in test_hush_if_test depends on hush parser to be present. This patch simplify test dependencies by using global pytestmark. Reported-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com>
2017-05-22test: py: Add cmd_echo dependencyMichal Simek2-0/+7
There is missing dependency on echo command. Mark tests which requires echo. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2016-11-27travis: Add efi_loader grub2 testAlexander Graf1-10/+47
We have all the building blocks now to run arbitrary efi applications in travis. The most important one out there is grub2, so let's add a simple test to verify that grub2 still comes up. Signed-off-by: Alexander Graf <agraf@suse.de>
2016-11-27efi_loader: Allow to compile helloworld.efi w/o bundling itAlexander Graf1-1/+1
Today we can compile a self-contained hello world efi test binary that allows us to quickly verify whether the EFI loader framwork works. We can use that binary outside of the self-contained test case though, by providing it to a to-be-tested system via tftp. This patch separates compilation of the helloworld.efi file from including it in the u-boot binary for "bootefi hello". It also modifies the efi_loader test case to enable travis to pick up the compiled file. Because we're now no longer bloating the resulting u-boot binary, we can enable compilation always, giving us good travis test coverage. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-11-26tests: Add efi_loader hello world testAlexander Graf1-0/+158
Now that we have working network tests and a hello world efi application built inside our tree, we can automatically test that efi binary running inside of U-Boot. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-11-26tests: net: Offset downloads to 4MBAlexander Graf1-2/+2
The network test currently downloads files at 0MB offset of RAM start. This works for most ARM systems, but x86 has weird memory layout constraints on the first MB of RAM. To not get caught into any of these, let's add a 4MB pad from start of RAM to the default memory offset. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-11-21test/py: expose config and log as session scoped fixtureStefan Brüns1-0/+26
If a test uses a fixture which is expensive to setup, the fixture can possibly created with session or module scope. As u_boot_console has function scope, it can not be used in this case. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Stephen Warren <swarren@wwwdotorg.org>