summaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)Author
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>
2017-09-29test/py: add skip marker for reliance on toolsStephen Warren
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 Warren
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 Warren
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 Schuchardt
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 Warren
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 Schuchardt
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 Chaiken
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 Chaiken
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 Chaiken
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 Glass
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 Rini
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 Glass
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 Simek
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 Simek
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 Simek
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 Graf
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 Graf
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 Graf
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 Graf
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üns
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>
2016-10-23test/py: ensure a log section exists for skipped testsStephen Warren
In pytest 3, runtestprotocol() may not call pytest_runtest_setup() if the test is skipped. That call is required to create a section for the test in the log file. If this is skipped, the call to log.end_section() at the tail of pytest_runtest_protocol() will throw an exception. This patch ensures that a log section always exists, both to avoid the exception and to ensure that a consistently structured log file is always created. Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reported-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Stephen Warren <swarren@nvidia.com> Tested-by: Tom Rini <trini@konsulko.com>
2016-10-14test/py/tests/test_sleep.py: Add check for CONFIG_CMD_MISCTom Rini
We can only run this command if the sleep command is enabled and that depends on CONFIG_CMD_MISC Signed-off-by: Tom Rini <trini@konsulko.com>
2016-10-13test: add NFS download testGuillaume GARDET
Add a NFS download test, based on TFTP test. Tested on i.MX6 SabreLite board. Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> Cc: Tom Rini <trini@konsulko.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-09-22test/py/tests/test_vboot.py: Add check that we boot the imageTom Rini
Make sure that when we're telling bootm to boot an image, and we expect the image to boot we get the output from sandbox that we attempted to run Linux and that U-Boot completed its job. Cc: Simon Glass <sjg@chromium.org> Cc: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Stephen Warren <swarren@nvidia.com>
2016-08-20test/py: match prompt only at line boundariesStephen Warren
This prevents capture of command output from terminating early on boards that use a simple prompt (e.g. "=> ") that appears in the middle of command output (e.g. crc32's "... ==> 2fa737e0"). Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Tested-by: Tom Rini <trini@konsulko.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2016-08-05test: Adjust run_command_list() to return a list of stringsSimon Glass
Return one string for each command that was executed. This seems cleaner. Suggested-by: Teddy Reed <teddy.reed@gmail.com> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2016-08-05test: Add a function to restart U-BootSimon Glass
Add a proper function for this rather than using internal functions. Use it in the single call site. Also, do a restart at the end of the vboot test to reset to the normal device tree. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Stephen Warren <swarren@nvidia.com>