summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeLines
* dm: test: usb: sandbox: Add keyboard tests for sandboxSimon Glass2015-11-19-0/+31
| | | | | | | Add a test that verifies that USB keyboards work correctly on sandbox. This verifies some additional parts of the USB stack. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: usb: Add a test for device reorderingSimon Glass2015-11-19-0/+50
| | | | | | | Add tests that 'usb tree' produces the right output when a device changes order on the bus. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: usb: Add tests for the 'usb tree' commandSimon Glass2015-11-19-0/+156
| | | | | | | Add tests that this command produces the right output, even when a rescan results in a device disappearing from the bus. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Record and silence console in testsSimon Glass2015-11-19-0/+13
| | | | | | | | | When running sandbox tests, silence the console to avoid unwanted output. Also, record the console in case tests want to check it. The -v option can be used to enable stdout during tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* Move console definitions into a new console.h fileSimon Glass2015-11-19-0/+2
| | | | | | | | The console includes a global variable and several functions that are only used by a small subset of U-Boot files. Before adding more functions, move the definitions into their own header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: usb: Avoid time delays in sandbox testsSimon Glass2015-11-19-0/+5
| | | | | | | Currently the USB tests take around two seconds to run. Remove these unnecessary time delays so that the tests run quickly. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: add a sandbox timer and basic testThomas Chou2015-11-19-0/+28
| | | | | | | | Add a sandbox timer which get time from host os and a basic test. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: fat: add error-checking to non-contig testStephen Warren2015-11-18-0/+32
| | | | | | | | | | | | | | | Check the result code of all command that are executed. Without this, if the fallocate invocation fails (this feature is not supported on ext3 filesystems for example) then a zero-length output file will be created, and subsequent the mkfs and mount invocations will fail, which will cause the subsequent dd invocation to attempt to fill up the host's entire free disk space. That's not a nice user experience! Related, if fallocate does fail, try to create the test disk image using dd instead. That should work everywhere. Fixes: 4a28274227d0 ("test: fat: add test of non-contiguous file reads") Signed-off-by: Stephen Warren <swarren@nvidia.com>
* sandbox: add ADC unit testsPrzemyslaw Marczak2015-11-02-0/+166
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds unit tests for ADC uclass's methods using sandbox ADC. Testing proper ADC binding: - dm_test_adc_bind() - device binding - dm_test_adc_wrong_channel_selection() - checking wrong channel selection Testing ADC supply operations: - dm_test_adc_supply(): - Vdd/Vss values validating - Vdd regulator updated value validating - Vdd regulator's auto enable state validating Testing ADC operations results: - dm_test_adc_single_channel_conversion() - single channel start/data - dm_test_adc_single_channel_shot() - single channel shot - dm_test_adc_multi_channel_conversion() - multi channel start/data - dm_test_adc_multi_channel_shot() - multi channel single shot Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* Merge branch 'master' of git://git.denx.de/u-boot-netTom Rini2015-10-29-0/+64
|\
| * dm: test: Add a new test case against dm eth codes for NULL pointer accessBin Meng2015-10-29-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | U-Boot crashes when doing a 'ping' with the following test scenario: - All ethernet devices are not probed - "ethaddr" for all ethernet devices are not set - "ethact" is set to a valid ethernet device name Add a new test case 'dm_test_eth_act' to hit such scenario. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* | Merge git://git.denx.de/u-boot-dmTom Rini2015-10-27-13/+13
|\ \ | |/ |/|
| * dm: Rename dev_get_parentdata() to dev_get_parent_priv()Simon Glass2015-10-23-13/+13
| | | | | | | | | | | | | | | | The current name is inconsistent with other driver model data access functions. Rename it and fix up all users. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | fs-test.sh: fix pre-requisite detectionStephen Warren2015-10-24-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following snippet: if [ ! -x `which $prereq` ]; then When $prereq does not exist, `which $prereq` evaluates to the empty string, which results in *no* argument being passed to the -x operator, which then evaluates to true, which is the equivalent of the prereq having been found. In order for this to fail as expected, we must pass an empty argument, which then causes -x to fail. Do this by wrapping the `` in quotes so there's always an argument to -x, even if the value of the argument is zero-length. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* | test: fat: add test of non-contiguous file readsStephen Warren2015-10-24-0/+113
|/ | | | | | | | | | | | | | | | | In my patch series to replace fs/fat with "ff.c", I enhanced ff.c to optimize file reading, so that reads of contiguous clusters are submitted to the IO device as a single read. This test attempts to torture-test edge-cases of that enhancement. BTW, the only way I found to validate that this script actually does create non-contiguous files was to manually inspect the FAT bitmap in a hex dump of the FAT image. hdparm --fibmap doesn't work on loop-mounted filesystems. filefrag -v -e seems to lie about files being contiguous when they aren't. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* test: Add basic tests for remoteprocNishanth Menon2015-10-22-0/+68
| | | | | | | | | Use the sandbox environment for the basic tests. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Simon Glass <sjg@chromium.org>
* test/fs/fs-test.sh: Update expected results and TC10 logicTom Rini2015-10-11-6/+6
| | | | | | | | | | | With the changes in 7a3e70c we now get read(2) behavior so trying to read 2MB with 1MB left in the file results in 1MB read and a warning. We update the test logic here to make sure we read back 1MB as expected. This change however changes the overall summary as while EXT4 continues to not have offset support the test now fails when expected to pass rather than fails when expected to fail (and we report that as pass). Signed-off-by: Tom Rini <trini@konsulko.com>
* Add support for LZ4 decompression algorithmJulius Werner2015-10-11-0/+57
| | | | | | | | | | | | | | | This patch adds support for LZ4-compressed FIT image contents. This algorithm has a slightly worse compression ration than LZO while being nearly twice as fast to decompress. When loading images from a fast storage medium this usually results in a boot time win. Sandbox-tested only since I don't have a U-Boot development system set up right now. The code was imported unchanged from coreboot where it's proven to work, though. I'm mostly interested in getting this recognized by mkImage for use in a downstream project. Signed-off-by: Julius Werner <jwerner@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* dm: test: Show the amount of leaked memory on errorSimon Glass2015-10-05-1/+6
| | | | | | | Adjust the memory leak tests to show the amount of memory leaked. This can be a useful signal as to what is wrong. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a new test case for dm_test_eth_rotateBin Meng2015-09-09-0/+5
| | | | | | | | | Add one more ethernet device node in the sandbox test device tree, with name 'sbe5'. This is to support a new test case for testing network device rotation. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* dfu:tests: Modify dfu_gadget_test.sh to accept USB device vendor:product IDLukasz Majewski2015-09-07-8/+19
| | | | | | | | | | | | | | dfu-util allows filtering on USB device vendor:product ID by using the -d flag (-d 0451:d022). Such option is very handy when many DFU devices are connected to a single host PC. This commit allows testing when above situation emerges. Signed-off-by: Lukasz Majewski <l.majewski@majess.pl> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Lukasz Majewski <l.majewski@majess.pl> Test HW - AM335x Beagle Bone Black NOTE: Max size of file to transfer: 2MiB
* fs-test.sh: minor fixesStephen Warren2015-08-18-3/+3
| | | | | | | | | | | | - Re-direct stderr into the log files, so any errors U-Boot emits are visible in the logs. This is relevant if the "reset" shell command attempts to report that it's not supported on the sandbox board. - Fix test_fs_nonfs() to name the files it created differently for each invocation. Otherwise, the logs from different tests overwrite each-other. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Suriyan Ramasami <suriyan.r@gmail.com>
* devres: add debug command to dump device resourcesMasahiro Yamada2015-08-06-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new command can dump all device resources associated to each device. The fields in every line shows: - The address of the resource - The size of the resource - The name of the release function - The stage in which the resource has been acquired (BIND/PROBE) Currently, there is no driver using devres, but if such drivers are implemented, the output of this command should look like this: => dm devres - root_driver - soc - extbus - serial@54006800 bfb541e8 (8 byte) devm_kmalloc_release BIND bfb54440 (4 byte) devm_kmalloc_release PROBE bfb54460 (4 byte) devm_kmalloc_release PROBE - serial@54006900 bfb54270 (8 byte) devm_kmalloc_release BIND - gpio@55000000 - i2c@58780000 bfb5bce8 (12 byte) devm_kmalloc_release PROBE bfb5bd10 (4 byte) devm_kmalloc_release PROBE - eeprom bfb54418 (12 byte) devm_kmalloc_release BIND Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
* test: Add a test for regmapSimon Glass2015-07-21-0/+83
| | | | | | We use syscon to test that the regmap functions work as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the system controller uclassSimon Glass2015-07-21-0/+32
| | | | | | | Add a test to confirm that we can access system controllers and find their driver data. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the LED uclassSimon Glass2015-07-21-0/+73
| | | | | | Add a test to confirm that we can adjust LEDs using the led_gpio driver. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the mmc uclassSimon Glass2015-07-21-0/+28
| | | | | | | Add a test to confirm that we can probe this device. Since there is no MMC stack support in sandbox at present, this is as far as the test goes. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the ram uclassSimon Glass2015-07-21-0/+29
| | | | | | | Add a test to confirm that we can probe this device and get information on the available RAM. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the reset uclassSimon Glass2015-07-21-0/+75
| | | | | | | Add tests that confirm that the drivers work as expected, and we can walk through the available reset types trying to reset the board. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add tests for the clk uclassSimon Glass2015-07-21-0/+60
| | | | | | Add tests of each API call using a sandbox clock device. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Allow test names to leave out the dm_test_ prefixSimon Glass2015-07-21-2/+13
| | | | | | | | | | | | | | All driver model tests have a dm_test_ prefix. Ignore it when matching a test name. This makes it easier to run individual tests, like this: ./sandbox/u-boot -d ./sandbox/arch/sandbox/dts/test.dtb \ -c "ut dm clk_periph" We can use 'clk_periph' instead of 'dm_test_clk_periph'. Also print a message if the requested test is not found. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: pmic: Split output from functionSimon Glass2015-07-21-1/+1
| | | | | | | | | | | | | | | The regulator_autoset() function mixes printf() output and PMIC adjustment code. It provides a boolean to control the output. It is better to avoid missing logic and output, and this permits a smaller SPL code size. So split the output into a separate function. Also rename the function to have a by_name() suffix, since we would like to be able to pass a device when we know it, and thus avoid the name search. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: Move the tree/uclass dump code into its own fileSimon Glass2015-07-21-79/+3
| | | | | | | | | | In SPL it is sometimes useful to be able to obtain a dump of the current driver model state. Since commands are not available, provide a way to directly call the functions to output this information. Adjust the existing commands to use these functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: pci: Allow PCI bus numbering aliasesSimon Glass2015-06-04-0/+11
| | | | | | | | | | | Commit 9cc36a2 'dm: core: Add a flag to control sequence numbering' changed the default uclass behaviour to not support bus numbering. This is incorrect for PCI and that commit should have enabled the flag for PCI. Enable it so that PCI buses can be found and the 'pci' command works again. Also add a test for this. Signed-off-by: Simon Glass <sjg@chromium.org>
* add test for two 'loadables'Karl Apsite2015-05-28-9/+63
| | | | | | | Nothing too fancy. A simple test that attmpts to load two loadables and verify that they are properly unpacked in the u-boot sandbox. Signed-off-by: Karl Apsite <Karl.Apsite@dornerworks.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: env: Add a test of the new regex behavior for attrsJoe Hershberger2015-05-21-0/+27
| | | | | | | | The behavior of the env attrs depends on CONFIG_REGEX. Add an additional test if that variable is set. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: env: Add test for verifying env attrsJoe Hershberger2015-05-21-0/+63
| | | | | | | Add a test of the env_attr_lookup() function. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: env: Add test framework for envJoe Hershberger2015-05-21-0/+59
| | | | | | | | | | Add a new "env" subcommand to the ut command. This will run unit tests on the env code. This should be targetable to any device that supports the env features needed for the tests. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: Recover the driver model tree after testsJoe Hershberger2015-05-21-0/+5
| | | | | | | | Put the driver model for the system back into a good state after completing the DM testing. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* test: dm: eth: Handle failed test env cleanupJoe Hershberger2015-05-21-25/+56
| | | | | | | Make sure that the env gets cleaned up after a test fails so that other tests aren't affected. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* test: dm: Don't bail on all tests if one test failsJoe Hershberger2015-05-21-5/+2
| | | | | | | | | | There's not much point in having a failure count if we always give up on the first failure. Also stop clearing the entire state between tests. Make sure that any failures are still passed out to the command line. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: Move the unit tests to their own menuJoe Hershberger2015-05-21-5/+9
| | | | | | | | Make all unit tests selectable as a menu of test suites instead of just sitting in the top-level menu individually. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* test: dm: Move the time test over to the ut commandJoe Hershberger2015-05-21-10/+11
| | | | | | | Unify the command for running unit tests further by moving the "ut_time" command over to "ut time". Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* test: dm: Move the dm tests over to the ut commandJoe Hershberger2015-05-21-33/+29
| | | | | | | | Unify the command for running unit tests further by moving the "dm test" command over to "ut dm". Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* test: Add a common unit test commandJoe Hershberger2015-05-21-0/+63
| | | | | | | | Add a command that all other unit tests should be a sub-command of. Also include a command that will run all tests. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* test: Generalize the unit test frameworkJoe Hershberger2015-05-21-149/+166
| | | | | | | | | Separate the ability to define tests and assert status of test functions from the dm tests so they can be used more consistently throughout all tests. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* net: Apply default format rules to all ethaddrJoe Hershberger2015-05-21-0/+3
| | | | | | | | Use a regular expression to apply the default formatting flags for all ethaddr env vars. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: test.dts - move to sandbox dts directoryPrzemyslaw Marczak2015-05-14-253/+2
| | | | | | | | | | | | | | | | | The file test.dts from driver model test directory, was compiled by call dtc in script: test/dm/test-dm.sh. This doesn't allow for including of dtsi files and using of C preprocessor routines in this dts file. Since the mentioned script builds U-Boot before tests, then moving the test.dts file into sandbox dts directory is reasonable. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Tested on sandbox: Tested-by: Simon Glass <sjg@chromium.org>
* test: dm: add sandbox PMIC framework testsPrzemyslaw Marczak2015-05-14-0/+396
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds new file to sandbox driver model test environment. The file is: test/dm/power.c, and it includes tests for PMIC framework, which includes PMIC uclass and REGULATOR uclass. All tests are based od Sandbox PMIC emulated device. Some test constants for this device are defined in the header: include/power/sandbox_pmic.h PMIC tests includes: - pmic get - tests, that pmic_get() returns the requested device - pmic I/O - tests I/O by writing and reading some values to PMIC's registers and then compares, that the write/read values are equal. The regulator tests includes: - Regulator get by devname/platname - Voltage set/get - Current set/get - Enable set/get - Mode set/get - Autoset - List autoset For the regulator 'get' test, the returned device pointers are compared, and their names are also compared to the requested one. Every other test, first sets the given attribute and next try to get it. The test pass, when the set/get values are equal. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Tested on sandbox: Tested-by: Simon Glass <sjg@chromium.org>
* test: Add a simple time testSimon Glass2015-05-06-0/+146
| | | | | | | Sometimes the time functions are incorrect due to bad time support on a board. Add a unit test which tries to detect this. Signed-off-by: Simon Glass <sjg@chromium.org>