summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeLines
* Add a power domain framework/uclassStephen Warren2016-07-27-0/+47
| | | | | | | | | Many SoCs allow power to be applied to or removed from portions of the SoC (power domains). This may be used to save power. This API provides the means to control such power management hardware. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: Use dm_scan_fdt_dev() directly where possibleSimon Glass2016-07-27-4/+4
| | | | | | | Quite a few places have a bind() method which just calls dm_scan_fdt_dev(). We may as well call dm_scan_fdt_dev() directly. Update the code to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Convert users from dm_scan_fdt_node() to dm_scan_fdt_dev()Simon Glass2016-07-27-2/+1
| | | | | | | This new function is more convenient for callers, and handles pre-relocation situations automatically. Signed-off-by: Simon Glass <sjg@chromium.org>
* test/py: vboot can be run only at SandboxMichal Simek2016-07-22-0/+1
| | | | | | | | | | | | | | | Getting this error: Zynq> sb load hostfs - 100 /home/monstr/data/disk/u-boot/build-zynq_zc706/test.fit Unknown command 'sb' - try 'help' because sb command is present only for Sandbox obj-$(CONFIG_SANDBOX) += host.o that's why mark this test to be run only at Sandbox Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Simon Glass <sjg@chromium.org>
* test/py: use absolute dts path in vboot testStephen Warren2016-07-22-1/+1
| | | | | | | | | Without this, the test fails if the test is run with a cwd other than the root of the U-Boot source tree. Fixes: 8729d582595d ("test: Convert the vboot test to test/py") Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: Adjust the of-platdata test run conditionSimon Glass2016-07-16-1/+1
| | | | | | | This should be spl_of_platdata, since otherwise it will try to run on boards that don't support of-platdata. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-dmTom Rini2016-07-15-3/+72
|\
| * dm: Add a test for of-platdataSimon Glass2016-07-14-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a simple test which checks that the of-platdata system is working correctly. The sequence is as follows: - SPL starts up and probes all the UCLASS_MISC drivers - There are 3 of these in sandbox.dts - Therefore there should be 3 U_BOOT_DEVICE() declarations in dt-platdata.c - These should produce 3 sandbox_spl_test devices - Each device prints out its platform data when probed - This test checks for this output and compares it against expectations Signed-off-by: Simon Glass <sjg@chromium.org>
| * test/py: Start sandbox SPL when enabledSimon Glass2016-07-14-1/+5
| | | | | | | | | | | | | | When sandbox SPL is enabled we want to start that rather than U-Boot proper, since some tests may rely on running it first. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test/py: Provide a way to get early console outputSimon Glass2016-07-14-0/+23
| | | | | | | | | | | | | | Some tests want to check the console output from SPL or U-Boot proper. Provide a means to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test/py: Note which console produced unexpected outputSimon Glass2016-07-14-1/+1
| | | | | | | | | | | | | | | | At present the SPL and U-Boot consoles both present the same error message when the expected console output does not appear. Add "SPL" to the SPL error message to resolve this ambiguity. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test/py: Handle testing with the sandbox_spl boardSimon Glass2016-07-14-1/+1
| | | | | | | | | | | | | | | | | | | | This board can sometimes be used for tests. Handle it the same way as sandbox. Note: I plan to drop the sandbox_spl board at some point and merge its features into sandbox. So this commit may not be necessary. Signed-off-by: Simon Glass <sjg@chromium.org>
* | test: Convert the vboot test to test/pySimon Glass2016-07-14-155/+185
| | | | | | | | | | | | | | | | Now that we have a suitable test framework we should move all tests into it. The vboot test is a suitable candidate. Rewrite it in Python and move the data files into an appropriate directory. Signed-off-by: Simon Glass <sjg@chromium.org>
* | test/py: Add a helper to run a list of U-Boot commandsSimon Glass2016-07-14-0/+16
| | | | | | | | | | | | | | Some tests want to execute a sequence of commands. Add a helper for this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | test/py: Provide a way to check that a command failsSimon Glass2016-07-14-0/+22
| | | | | | | | | | | | | | | | Sometimes we want to run a command and check that it fails. Add a function to handle this. It can check the return code and also make sure that the output contains a given error message. Signed-off-by: Simon Glass <sjg@chromium.org>
* | test/py: Add an option to execute a string containing a commandSimon Glass2016-07-14-0/+12
| | | | | | | | | | | | | | | | It is sometimes inconvenient to convert a string into a list for execution with run_and_log(). Provide a helper function to do this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | test/py: Return output from run_and_log()Simon Glass2016-07-14-2/+3
| | | | | | | | | | | | | | | | It is useful to be able to obtain the output from a command. Return it from this function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | test/py: Provide output from exceptions with RunAndLog()Simon Glass2016-07-14-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Tests may want to look at the output from running a command, even if it fails (e.g. with a non-zero return code). Provide a means to obtain this. Another approach would be to return a class object containing both the output and the exception, but I'm not sure if that would result in a lot of refactoring. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | test/py: Allow RunAndLog() to return the outputSimon Glass2016-07-14-1/+2
| | | | | | | | | | | | | | | | Tests may want to look at the output from running a command. Return it so that this is possible. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | test/py: Allow tests to control the sandbox device-tree fileSimon Glass2016-07-14-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Normally tests will run with the test.dtb file designed for this purpose. However, the verified boot tests need to run with their own device-tree file, containing a public key. Make the device-tree file a config option so that it can be adjusted by tests. The default is to keep the current behaviour. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | test: Add a simple script to run tests on sandboxSimon Glass2016-07-14-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common check before sending patches is to run all available tests on sandbox. But everytime I do this I have to look up the README. This presents quite a barrier to actually doing this. Add a shell script to help. To run the tests, type: test/run in the U-Boot directory, which should be easy to remember. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | test: Add a READMESimon Glass2016-07-14-0/+82
|/ | | | | | | Add a few notes about how testing works in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* test/py: support 'memstart =' in u_boot_utils.find_ram_base()Daniel Schwierzeck2016-07-08-1/+1
| | | | | | | | | | Some archs like MIPS or PPC have a different 'bdinfo' output than ARM regarding the memory configuration. Also support 'memstart = 0x*' in u_boot_utils.find_ram_base() to make all tests requiring the RAM base working on those archs. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Acked-by: Stephen Warren <swarren@nvidia.com>
* test/py: strip VT100 codes from match bufferStephen Warren2016-07-08-0/+9
| | | | | | | | | | | | | | | | | | | | | Prior to this patch, any VT100 codes emitted by U-Boot are considered part of a command's output, which often causes tests to fail. For example, test_env_echo_exists executes printenv, and then considers any text on a line before an = sign as a valid U-Boot environment variable name. This includes any VT100 codes emitted. When the test later attempts to use that variable, the name would be invalid since it includes the VT100 codes. Solve this by stripping VT100 codes from the match buffer, so they are never seen by higher level test code. The codes are still logged unmodified, so that users can expect U-Boot's exact output without interference. This does clutter the log file a bit. However, it allows users to see exactly what U-Boot emitted rather than a modified version, which hopefully is better for debugging. It's also much simpler to implement, since logging happens as soon as text is received, and so stripping the VT100 codes from the log would require handling reception and stripping of partial VT100 codes. Signed-off-by: Stephen Warren <swarren@nvidia.com>
* test/py: fix CONFIG_ testsStephen Warren2016-07-08-5/+5
| | | | | | | | | | | Some CONFIG_ variables were recently renamed, but test/py wasn't updated to match. This causes some tests to be skipped. Fix test/py so the tests are run. Fixes: 11636258981a ("Rename reset to sysreset") Fixes: f1f9d4fac527 ("hush: complete renaming CONFIG_SYS_HUSH_PARSER to CONFIG_HUSH_PARSER") Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
* hush: complete renaming CONFIG_SYS_HUSH_PARSER to CONFIG_HUSH_PARSERMasahiro Yamada2016-06-24-1/+1
| | | | | | | There is no more define of CONFIG_SYS_HUSH_PARSER. Rename some remaining references and drop the backward compatible Kconfig entry. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* clk: convert API to match reset/mailbox styleStephen Warren2016-06-19-33/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following changes are made to the clock API: * The concept of "clocks" and "peripheral clocks" are unified; each clock provider now implements a single set of clocks. This provides a simpler conceptual interface to clients, and better aligns with device tree clock bindings. * Clocks are now identified with a single "struct clk", rather than requiring clients to store the clock provider device and clock identity values separately. For simple clock consumers, this isolates clients from internal details of the clock API. * clk.h is split so it only contains the client/consumer API, whereas clk-uclass.h contains the provider API. This aligns with the recently added reset and mailbox APIs. * clk_ops .of_xlate(), .request(), and .free() are added so providers can customize these operations if needed. This also aligns with the recently added reset and mailbox APIs. * clk_disable() is added. * All users of the current clock APIs are updated. * Sandbox clock tests are updated to exercise clock lookup via DT, and clock enable/disable. * rkclk_get_clk() is removed and replaced with standard APIs. Buildman shows no clock-related errors for any board for which buildman can download a toolchain. test/py passes for sandbox (which invokes the dm clk test amongst others). Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* reset: implement a reset testStephen Warren2016-06-19-0/+40
| | | | | | | | | This adds a sandbox reset implementation (provider), a test client device, instantiates them both from Sandbox's DT, and adds a DM test that excercises everything. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* test/py: fix printenv signon message disable codeStephen Warren2016-06-19-1/+2
| | | | | | | | | | | CONFIG_VERSION_VARIABLE isn't always defined, so we can't simply look up its value directly, or an exception will occur if it isn't defined. Instead, we must use .get() to supply a default value if the variable isn't defined. Fixes: da37f006e7c5 ("tests: py: disable main_signon check for printenv cmd") Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Stephen Warren <swarren@nvidia.com>
* tests: py: disable main_signon check for printenv cmdHeiko Schocher2016-06-09-1/+5
| | | | | | | | | | | | if CONFIG_VERSION_VARIABLE is set, the U-Boot environment contains a "vers" variable with the current U-Boot version string. If now "printenv" is called, test/py fails as it detects the main_sign string, which is in this case correct. So check only the main_sign as an error, if CONFIG_VERSION_VARIABLE is not set. Signed-off-by: Heiko Schocher <hs@denx.de>
* dm: test: Add GPIO open drain testsmario.six@gdsys.cc2016-06-03-0/+7
| | | | | | | | | | Add some tests for the new open drain setting feature of the GPIO uclass, and extend the capabilities of the sandbox GPIO driver accordingly. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: York Sun <york.sun@nxp.com>
* Merge git://git.denx.de/u-boot-dmTom Rini2016-05-27-75/+107
|\ | | | | | | | | | | | | | | | | | | | | | | | | For odroid-c2 (arch-meson) for now disable designware eth as meson now needs to do some harder GPIO work. Signed-off-by: Tom Rini <trini@konsulko.com> Conflicts: lib/efi_loader/efi_disk.c Modified: configs/odroid-c2_defconfig
| * mailbox: implement a sandbox testStephen Warren2016-05-26-0/+32
| | | | | | | | | | | | | | | | | | This adds a sandbox mailbox implementation (provider), a test client device, instantiates them both from Sandbox's DT, and adds a DM test that excercises everything. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org> # v1
| * Rename reset to sysresetStephen Warren2016-05-26-75/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current reset API implements a method to reset the entire system. In the near future, I'd like to introduce code that implements the device tree reset bindings; i.e. the equivalent of the Linux kernel's reset API. This controls resets to individual HW blocks or external chips with reset signals. It doesn't make sense to merge the two APIs into one since they have different semantic purposes. Resolve the naming conflict by renaming the existing reset API to sysreset instead, so the new reset API can be called just reset. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* | test/py: Support setting up specific timeoutMichal Simek2016-05-27-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Large file transfers, flash erasing and more complicated tests requires more time to finish. Provide a way to setup specific timeout directly in test. For example description for 50s test: timeout = 50000 with u_boot_console.temporary_timeout(timeout): u_boot_console.run_command(...) Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* | test/py: fix NameError exception if bdi cmd is not supportedHeiko Schocher2016-05-27-0/+1
|/ | | | | | | | | | | | test/py raises an error, if a board has not enabled bdi command > pytest.skip('bdinfo command not supported') E NameError: global name 'pytest' is not defined import pytest in test/py/u_boot_utils.py fixes this. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* dm: mmc: test: Add tests for MMCSimon Glass2016-05-17-3/+20
| | | | | | | | Add a simple test which checks that a sandbox-emulated SD card can be used correctly. This tests plumbing through the MMC stack's block-device implementaion. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: sandbox: mmc: Enable building MMC code for sandboxSimon Glass2016-05-17-2/+2
| | | | | | | Enable building the MMC code for sandbox. This increases build coverage for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: sandbox: Only enable the sandbox MMC driver when validSimon Glass2016-05-17-1/+3
| | | | | | | This driver will require generic MMC and block-device support in a future commit. To avoid test errors, make this change now. Signed-off-by: Simon Glass <sjg@chromium.org>
* tests: py: fix NameError exception if bdi cmd is not supportedHeiko Schocher2016-05-13-0/+1
| | | | | | | | | | | | test/py raises an error, if a board has not enabled bdi command > pytest.skip('bdinfo command not supported') E NameError: global name 'pytest' is not defined import pytest in test/py/u_boot_utils.py fixes this. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* test/py: dfu: wait for USB device to go away at bootStephen Warren2016-05-06-0/+2
| | | | | | | | | | | | | It can take a while for a host machine to notice that a USB device has disconnected, and process the change. At the end of the DFU test, we wait up to 10 seconds for this to happen. This change makes the test wait the same (up to) 10 seconds at the start of the test for any previously active USB device-mode session to be cleaned up. Such as session might have been used to download U-Boot into memory for example; this is certainly true on my Tegra test systems. This changes should solve the DFU test intermittency issues I've been seeing on some Tegra devices. Signed-off-by: Stephen Warren <swarren@nvidia.com>
* tests: py: dfu: Provide functionality to set test and dummy files alt settingsLukasz Majewski2016-04-25-5/+21
| | | | | | | | | | | | | | | | | | | | After concatenation of "dfu_alt_info" variable from "dfu_alt_boot" and "dfu_alt_system" it may happen that test and dummy files alt settings are different than default 0 and 1. This patch provides the ability to set different values for them. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Stephen Warren <swarren@nvidia.com> --- Changes for v3: - replace variables declarations with ones read from configuration file - remove not necessary str() conversion at DFU host command generation Changes for v2: - generate "alt_info" automatically - use file names as alt settings instead of numerical values - extend in-code documentation
* tests: py: dfu: Add functionality to set different u-boot's dfu env variableLukasz Majewski2016-04-25-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default (on almost all systems) the dfu env variable, which defines available alt settings, is named as "dfu_alt_info". However on some platforms (i.e. Odroid XU3), the 'dfu_alt_info' is concatenated from other variables - namely 'dfu_alt_boot' and 'dfu_alt_system' at run time (when one types 'dfu 0 mmc 0' for first time). 'dfu_alt_boot' describes alt settings which depend on boot medium - for example boot loader's LBA sectors which are different on eMMC and SD card because of e.g. MBR/GPT. 'dfu_alt_system' describes board agnostic alt settings - like rootfs, kernel. On such system we can only append/modify this env variable. Because of the above, we must have way to modify other than "dfu_ale_info" variable to perform tests. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Stephen Warren <swarren@nvidia.com> --- Changes for v3: - None Changes for v2: - Rewrite of "alt_info_env_name" variable description - Use of get() method on python's dictionary to easily obtain default value
* tests: py: dfu: Add variables to store dfu alt numbers for test and dummy filesLukasz Majewski2016-04-25-4/+8
| | | | | | | | | | | | | This patch replaces hardcoded (i.e. 0 and 1) values passed to dfu_{read|write} with variables. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Stephen Warren <swarren@nvidia.com> --- Changes for v3: - Replace per module global variables with ones defined inside a function Changes for v2: - None
* test/dm/core.c: Make pre-reloc test use pre-reloc structTom Rini2016-04-14-1/+1
| | | | | | | | | | | | | LLVM 3.5 noted: test/dm/core.c:41:35: warning: unused variable 'test_pdata_pre_reloc' [-Wunused-const-variable] static const struct dm_test_pdata test_pdata_pre_reloc = { And the correct fix here is that the driver_info_pre_reloc test should use the test_pdata_pre_reloc not test_pdata_manual variable Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test/py: README: link to example hook scriptsStephen Warren2016-04-11-0/+6
| | | | | | | | | | When implementing test/py hook scripts, it's helpful to read some working examples. Provide a link to some. The link was mentioned in the commit message which first added test/py, but not in any documentation file. Suggested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* test/py: Add support for loading image via tftp to specified locationMichal Simek2016-04-11-1/+5
| | | | | | | | | | | | | | For example this setting: env__net_tftp_readable_file = { "fn": "ep108/image.ub", "addr": 0x10000000, "size": 25846296, "crc32": "b726f9de", } Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com>
* test/py: pass -v option when executing sandboxStephen Warren2016-04-11-0/+1
| | | | | | | | | This shows more output, such as the internal output generated by the unit test ("ut") command, which makes it easier to debug issues. Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* spmi: Add sandbox test driverMateusz Kulikowski2016-04-01-0/+115
| | | | | | | | This patch adds emulated spmi bus controller with part of pm8916 pmic on it to sandbox and tests validating SPMI uclass. Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: blk: Add tests for block devicesSimon Glass2016-03-17-0/+97
| | | | | | | Add some tests to check that block devices work as expected. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>