summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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-13Merge git://git.denx.de/u-boot-fdtTom Rini
2016-10-13libfdt: Bring in upstream stringlist functionsSimon Glass
These have now landed upstream. The naming is different and in one case the function signature has changed. Update the code to match. This applies the following upstream commits by Thierry Reding <treding@nvidia.com> : 604e61e fdt: Add functions to retrieve strings 8702bd1 fdt: Add a function to get the index of a string 2218387 fdt: Add a function to count strings Signed-off-by: Simon Glass <sjg@chromium.org>
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-23fs-test.sh: Update expected resultsTom Rini
Thanks to Stefan Brüns we have more tests and a few more passes too, update the expected output now. Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23test/fs: Check writes using "." (same dir) relative pathStefan Brüns
<path>/<fname> and <path>/./<fname> should reference the same file. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23test/fs: Check ext4 behaviour if dirent is first entry in directory blockStefan Brüns
This is a regression test for a crash happening if the first dirent in the block matches. Code tried to access a predecessor entry which does not exist. The crash happened for any block, but "." is always the first entry in the first directory block and thus easy to check for. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23test/fs: strip noise from filesystem code prior to checking resultsStefan Brüns
ext4 and fat code emit some diagnostic messages during command execution. These additional lines force a match window size which strictly is not necessary. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23test/fs: remove use of undefined WRITE_FILE variableStefan Brüns
The write file is created from $SMALL_FILE by appending ".w" on all other occurences in the code. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23test/fs: Restructure file path specification to allow some flexibilityStefan Brüns
Instead of providing the full path, specify directory and filename separately. This allows to specify intermediate directories, required for some additional tests. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
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-22fs-test.sh: Correct check_md5() test with newlinesTom Rini
The fs-test.sh script expected there to be a \n\r style newline at the end of the output. This is no longer the case, so use 'tr' to remove the \r that we get. Fixes: (c5917b4b054d "dm: serial-uclass: Move a carriage return before a line feed") Signed-off-by: Tom Rini <trini@konsulko.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-20tests: Introduce DT overlay testsMaxime Ripard
This adds a bunch of unit tests for the "fdt apply" command. They've all been run successfully in the sandbox. However, as you still require an out-of-tree dtc with overlay support, this is disabled by default. Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
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>
2016-08-05test: vboot: Put each test variant in its own sectionSimon Glass
Use 'cons.log.section' feature to split up the test output. This makes it easier to read. Suggested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2016-08-05test: Rename sha to sha_algo and pass it aroundSimon Glass
Rename this argument and pass it to each function that needs it, instead of making it global. Suggested-by: Stephen Warren <swarren@nvidia.com> Suggested-by: Teddy Reed <teddy.reed@gmail.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2016-08-05test: Drop the cmd() functionSimon Glass
Instead of this, use the existing run_and_log() function, enhanced to support a command string as well as a list of arguments. Suggested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2016-08-05test: Fix typos in commentsSimon Glass
Fix some typos in various files introduced with the vboot test conversion. Reported-by: Teddy Reed <teddy.reed@gmail.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2016-08-05test: Check exit status in run_and_log_expect_exception()Simon Glass
This check was missed. Add it and make the message more verbose. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Rini <trini@konsulko.com> Fixes: 9e17b034 (test/py: Provide a way to check that a command fails)
2016-08-05test: Fix typos and tidy upSimon Glass
Fix review comments that were missed at the time. Also explain why we need to regenerate the device tree for each test. Reported-by: Teddy Reed <teddy.reed@gmail.com> Suggested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: f6349c3c (test: Add a README)
2016-07-27Add a power domain framework/uclassStephen Warren
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>
2016-07-27dm: Use dm_scan_fdt_dev() directly where possibleSimon Glass
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>
2016-07-27dm: Convert users from dm_scan_fdt_node() to dm_scan_fdt_dev()Simon Glass
This new function is more convenient for callers, and handles pre-relocation situations automatically. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-22test/py: vboot can be run only at SandboxMichal Simek
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>
2016-07-22test/py: use absolute dts path in vboot testStephen Warren
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>
2016-07-16test: Adjust the of-platdata test run conditionSimon Glass
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>
2016-07-15Merge git://git.denx.de/u-boot-dmTom Rini
2016-07-14dm: Add a test for of-platdataSimon Glass
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>
2016-07-14test/py: Start sandbox SPL when enabledSimon Glass
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>
2016-07-14test/py: Provide a way to get early console outputSimon Glass
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>
2016-07-14test/py: Note which console produced unexpected outputSimon Glass
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>
2016-07-14test/py: Handle testing with the sandbox_spl boardSimon Glass
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>
2016-07-14test: Convert the vboot test to test/pySimon Glass
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>
2016-07-14test/py: Add a helper to run a list of U-Boot commandsSimon Glass
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>
2016-07-14test/py: Provide a way to check that a command failsSimon Glass
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>
2016-07-14test/py: Add an option to execute a string containing a commandSimon Glass
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>
2016-07-14test/py: Return output from run_and_log()Simon Glass
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>
2016-07-14test/py: Provide output from exceptions with RunAndLog()Simon Glass
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>
2016-07-14test/py: Allow RunAndLog() to return the outputSimon Glass
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>
2016-07-14test/py: Allow tests to control the sandbox device-tree fileSimon Glass
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>
2016-07-14test: Add a simple script to run tests on sandboxSimon Glass
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>
2016-07-14test: Add a READMESimon Glass
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>
2016-07-08test/py: support 'memstart =' in u_boot_utils.find_ram_base()Daniel Schwierzeck
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>
2016-07-08test/py: strip VT100 codes from match bufferStephen Warren
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>
2016-07-08test/py: fix CONFIG_ testsStephen Warren
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>
2016-06-24hush: complete renaming CONFIG_SYS_HUSH_PARSER to CONFIG_HUSH_PARSERMasahiro Yamada
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>
2016-06-19clk: convert API to match reset/mailbox styleStephen Warren
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>