summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test: py: Add an option to skip sleep testMichal Simek2017-12-121-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>
* test/py: gpt: update size of gpt partitionPatrick Delaunay2017-12-121-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>
* log: test: Add a pytest for loggingSimon Glass2017-12-071-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>
* log: Add a test commandSimon Glass2017-12-073-0/+213
| | | | | | Add a command which exercises the logging system. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini2017-12-052-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
| * test/py: check return code of helloworldHeinrich Schuchardt2017-12-011-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>
| * test/py: fix typo in test_efi_loader.pyHeinrich Schuchardt2017-12-011-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>
| * test/py: test reboot by EFI watchdogHeinrich Schuchardt2017-12-011-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>
* | test: compression: Convert to unit test frameworkSimon Glass2017-12-042-69/+123
| | | | | | | | | | | | | | | | | | | | | | Adjust this test to use the unit test framework. Drop the two existing commands for running the tests and replace them with a single 'ut compression' command, with sub-commands. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Continue to have ret = run_test_internal(...) in run_test so ret is always initialized] Signed-off-by: Tom Rini <trini@konsulko.com>
* | test/py: Allow any unit test suite to be foundSimon Glass2017-12-021-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>
* | test: compression: Put test variables in a structSimon Glass2017-12-021-54/+74
| | | | | | | | | | | | | | | | | | | | | | At present the test setup is somewhat mixed with the test itself. But if the test setup fails (which it should not) then the test is actually invalid. Put all the test buffers and sizes in a struct and separate out the core code into a function. This will make it easier to move the code to use the unit test framework. Signed-off-by: Simon Glass <sjg@chromium.org>
* | test: overlay: Use cmd_ut_category()Simon Glass2017-12-021-19/+2
| | | | | | | | | | | | Adjust the code to use the common test-execution function. Signed-off-by: Simon Glass <sjg@chromium.org>
* | test: Add a command function for test executionSimon Glass2017-12-022-18/+26
|/ | | | | | | | The logic to either iterate through a list of tests or pick a named test is common to at lest two test suits. Move this logic into a new function and call it from the environment tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Correct operation when tests passSimon Glass2017-11-271-1/+2
| | | | | | | When tests pass an error message is printed because of a variable that is not initialised. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
* test/run: Report and return failureSimon Glass2017-11-221-3/+17
| | | | | | | | | This script runs the tests but does not report failure. Also it always returns an exit code of 0 even on failure. Fix these problems by checking the result of each test. Signed-off-by: Simon Glass <sjg@chromium.org>
* test/py: add timestamps to logStephen Warren2017-11-173-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>
* test/py: regenerate persistent GPT image if code changesStephen Warren2017-11-062-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>
* test/py: fix typos in README.mdMasahiro Yamada2017-10-231-3/+3
| | | | | Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* cmd: gpt: solve issue for swap and rename commandPatrick Delaunay2017-10-231-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>
* test/py: gpt: test start LBA for sub-command rename and swapPatrick Delaunay2017-10-231-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>
* test/py: gpt: add test for sub-command writePatrick Delaunay2017-10-231-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>
* test/py: gpt: add test for sub-command read and verifyPatrick Delaunay2017-10-231-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>
* test/py: gpt: copy persistent filePatrick Delaunay2017-10-231-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>
* test/py/tests/test_sleep.py: test time approximatelyHeinrich Schuchardt2017-10-161-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>
* Merge git://git.denx.de/u-boot-dmTom Rini2017-10-091-0/+3
|\
| * test: print_ut: Add test for %ls stringsRob Clark2017-10-081-0/+3
| | | | | | | | | | | | | | Add a simple test for long strings. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | Merge git://git.denx.de/u-boot-videoTom Rini2017-10-091-12/+46
|\ \ | |/ |/|
| * video: test: Add ANSI escape sequence testsRob Clark2017-09-291-0/+34
| | | | | | | | | | | | | | This adds tests for clear, set-cursor and color escape sequences. Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Anatolij Gustschin <agust@denx.de>
| * video: test: Helper for writing stringsRob Clark2017-09-291-12/+12
| | | | | | | | | | | | | | | | | | | | I'll need some more of this, let's not just copy-pasta the vidconsole_put_char() loop. Named to match vidconsole_put_char() in case that is ever useful outside of the tests. Signed-off-by: Rob Clark <robdclark@gmail.com>
* | test/dm: Fix string handling issues in the eth testTom Rini2017-10-061-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Coverity scan has identified potential buffer overruns in these tests. Correct this by zeroing our buffer and using strncpy not strcpy. Reported-by: Coverity (CID: 155462, 155463) Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | test/overlay: Fix various malloc/free leaksTom Rini2017-10-061-4/+12
| | | | | | | | | | | | | | | | | | | | | | With the overlay tests now being built in sandbox Coverity has found a number of issues in the tests. In short, if malloc ever failed we would leak the previous mallocs, so we need to do the usual goto pattern to free each in turn. Finally, we always looked at the free()d location to see how many tests had failed for the return code. Reported-by: Coverity (CID: 167224, 167227, 167230, 167236) Signed-off-by: Tom Rini <trini@konsulko.com>
* | fs-test: Add test for a filename using '..' to go back to the rootTuomas Tynkkynen2017-10-061-14/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous commit fixed a problem in FAT code where going back to the root directory using '..' wouldn't work correctly on FAT12 or FAT16. Add a test to exercise this case (which was once fixed in commit 18a10d46f26 "fat: handle paths that include ../" but reintroduced due to the directory iterator refactoring). This test only very barely catches the problem - without the fix the size command still gives valid output but the additional spurious "Invalid FAT entry" error message makes it not get caught in the 'egrep -A3 ' output. I tried to make a proper test that grows the root directory to two clusters lots of with dummy files but that causes the write tests to crash the sandbox totally... Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Tom Rini <trini@konsulko.com>
* | fs-test: Add FAT16 supportTuomas Tynkkynen2017-10-061-19/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we can only test FAT32 which is the default FAT version that mkfs.vfat creates by default. Instead make it explicitly create either a FAT16 or a FAT32 volume. This allows us to exercise more code, for instance the root directory handling is done differently in FAT32 than the older FATs. Adding FAT12 support is a much bigger job since the test creates a 2.5GB file and the FAT12 maximum partition size is way smaller than that. Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Tom Rini <trini@konsulko.com>
* | Merge git://git.denx.de/u-boot-usbTom Rini2017-10-011-158/+5
|\ \
| * | test: dm: usb: Update test cases for USBBin Meng2017-10-011-158/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have changed to remove all devices under the root hub in usb_stop(), and corrected the USB emulator select logic, it makes no sense to do various tests based on 'usb tree' output since the order of devices is no longer fixed. Remove these USB test cases related to 'usb tree'. For the USB remove test, ideally we should remove an emulator device node from the device tree, but this is so far not working. Change to test the 'usb stop' only. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* | Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini2017-10-011-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
| * | test/py: add a test calling the EFI selftestHeinrich Schuchardt2017-09-181-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>
* | test/py: fix anchors in HTML status reportStephen Warren2017-09-291-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>
* | test/py: add skip marker for reliance on toolsStephen Warren2017-09-295-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>
* | test/py: provide more information about test skip reasonStephen Warren2017-09-291-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>
* | test/py: Document required tools/packagesStephen Warren2017-09-291-1/+6
|/ | | | | | Some tests rely on external tools. Mention these in the test/py README. Signed-off-by: Stephen Warren <swarren@nvidia.com>
* Merge git://git.denx.de/u-boot-fdtTom Rini2017-09-153-9/+63
|\
| * test: overlay: Add unit test for stacked overlayPantelis Antoniou2017-09-153-1/+55
| | | | | | | | | | | | | | Verify that stacked overlays work. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Acked-by: Simon Glass <sjg@chromium.org>
| * ut: fix fdt_getprop_u32() changePantelis Antoniou2017-09-151-8/+8
| | | | | | | | | | | | | | | | | | fdt_getprop_u32 is not exported and it's different than what the unit test uses. Rename u32 prop access methods to something that's unit test specific. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Acked-by: Simon Glass <sjg@chromium.org>
* | test/py: gpt: make use of infra-structureStephen Warren2017-09-152-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>
* | test/py: u_boot_console_base.py: fix typoHeinrich Schuchardt2017-09-151-1/+1
| | | | | | | | | | | | run_command does not have a parameter wait_for_each. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | add pytests for 'gpt rename' and 'gpt swap'Alison Chaiken2017-09-141-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>
* | add pytests for 'gpt guid' command in sandboxAlison Chaiken2017-09-141-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>
* | GPT: create block device for sandbox testingAlison Chaiken2017-09-141-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>
* dm: test: replace dm_scan_dt() by of dm_extended_scan_fdt() in dm_do_testPatrice Chotard2017-09-111-1/+1
| | | | | | | | | | | | | | This allows to scan the DT including all "clocks" node's sub-nodes in which fixed-clock are defined. All fixed-clock should be defined inside a clocks node which collect all external oscillators. Until now, all clocks sub-nodes can't be binded except if the "simple-bus" compatible string is added which is a hack. Update test.dts by moving clk_fixed node inside clocks. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>