summaryrefslogtreecommitdiff
path: root/test/dm
AgeCommit message (Collapse)Author
2015-12-07CONFIG_NEEDS_MANUAL_RELOC: Fix warnings when not setTom Rini
Now that we may compile (but not link) code calling fixup_cmdtable when this is not set, we need to always have the declaration available. We should also make sure that anyone calling the function includes <command.h> as that's where the function declaration is. Signed-off-by: Tom Rini <trini@konsulko.com>
2015-12-07dm: cmd: Relocate subcommands when MANUAL_RELOCMichal Simek
Subcommands contain pointers to functions which are not updated when MANUAL_RELOC is enabled. This patch fix it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2015-11-19dm: test: usb: sandbox: Add keyboard tests for sandboxSimon Glass
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>
2015-11-19dm: test: usb: Add a test for device reorderingSimon Glass
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>
2015-11-19dm: test: usb: Add tests for the 'usb tree' commandSimon Glass
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>
2015-11-19test: Record and silence console in testsSimon Glass
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>
2015-11-19Move console definitions into a new console.h fileSimon Glass
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>
2015-11-19dm: usb: Avoid time delays in sandbox testsSimon Glass
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>
2015-11-19sandbox: add a sandbox timer and basic testThomas Chou
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>
2015-11-02sandbox: add ADC unit testsPrzemyslaw Marczak
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>
2015-10-29Merge branch 'master' of git://git.denx.de/u-boot-netTom Rini
2015-10-29dm: test: Add a new test case against dm eth codes for NULL pointer accessBin Meng
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>
2015-10-23dm: Rename dev_get_parentdata() to dev_get_parent_priv()Simon Glass
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>
2015-10-22test: Add basic tests for remoteprocNishanth Menon
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>
2015-10-05dm: test: Show the amount of leaked memory on errorSimon Glass
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>
2015-09-09dm: test: Add a new test case for dm_test_eth_rotateBin Meng
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>
2015-08-06devres: add debug command to dump device resourcesMasahiro Yamada
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>
2015-07-21test: Add a test for regmapSimon Glass
We use syscon to test that the regmap functions work as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21dm: test: Add a test for the system controller uclassSimon Glass
Add a test to confirm that we can access system controllers and find their driver data. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21dm: test: Add a test for the LED uclassSimon Glass
Add a test to confirm that we can adjust LEDs using the led_gpio driver. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21dm: test: Add a test for the mmc uclassSimon Glass
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>
2015-07-21dm: test: Add a test for the ram uclassSimon Glass
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>
2015-07-21dm: test: Add a test for the reset uclassSimon Glass
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>
2015-07-21dm: test: Add tests for the clk uclassSimon Glass
Add tests of each API call using a sandbox clock device. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21dm: test: Allow test names to leave out the dm_test_ prefixSimon Glass
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>
2015-07-21dm: pmic: Split output from functionSimon Glass
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>
2015-07-21dm: Move the tree/uclass dump code into its own fileSimon Glass
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>
2015-06-04dm: pci: Allow PCI bus numbering aliasesSimon Glass
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>
2015-05-21test: dm: Recover the driver model tree after testsJoe Hershberger
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>
2015-05-21test: dm: eth: Handle failed test env cleanupJoe Hershberger
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>
2015-05-21test: dm: Don't bail on all tests if one test failsJoe Hershberger
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>
2015-05-21test: Move the unit tests to their own menuJoe Hershberger
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>
2015-05-21test: dm: Move the dm tests over to the ut commandJoe Hershberger
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>
2015-05-21test: Generalize the unit test frameworkJoe Hershberger
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>
2015-05-21net: Apply default format rules to all ethaddrJoe Hershberger
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>
2015-05-14test: dm: test.dts - move to sandbox dts directoryPrzemyslaw Marczak
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>
2015-05-14test: dm: add sandbox PMIC framework testsPrzemyslaw Marczak
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>
2015-05-05dm: rtc: Add tests for real-time clocksSimon Glass
Add some simple tests to verify that the RTC uclass works correctly in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05dm: test: dts: Sort the aliases in the test device tree fileSimon Glass
Sort these aliases to avoid confusion as to what is present. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2015-05-05dm: i2c: Add an explicit test mode to the sandbox I2C driverSimon Glass
At present this driver has a few test features. They are needed for running the driver model unit tests but are confusing and unnecessary if using sandbox at the command line. Add a flag to enable the test mode, and don't enable it by default. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05test: dm: eth: Skip timeouts on ping testsJoe Hershberger
Indicate to the emulated sandbox Ethernet driver when we expect a timeout and tell it to leap forward. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-22dm: test: Don't clear global_data in dm_test_uclass_before_ready()Simon Glass
We must not clear global_data even in tests, since the ram_buffer (which is used by malloc()) will also be lost, and subsequent tests will fail. Zero only the global_data fields that are required for the test to function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com> Tested-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-22dm: test: Add tests for get/find uclass's device by namePrzemyslaw Marczak
This commit introduces simple tests for functions: - uclass_find_device_by_name() - uclass_get_device_by_name() Tests added by this commit: - Test: dm_test_uclass_devices_find_by_name: for uclass id: UCLASS_TEST_FDT * get uclass's devices by uclass_find_first/next_device() each as 'testdev', * for each returned device, call: uclass_find_device_by_name(), with previously returned device's name as an argument ('testdev->name'). * for the found device ('founddev') check if: * founddev != NULL * testdev == founddev * testdev->name == founddev->name (by strcmp) - Test: dm_test_uclass_devices_get_by_name: for uclass id: UCLASS_TEST_FDT * get uclass's devices by uclass_get_first/next_device() each as 'testdev', * for each returned device, call: uclass_get_device_by_name(), with previously returned device's name as an argument ('testdev->name'). * for the found device ('founddev') check if: * founddev != NULL * founddev is active * testdev == founddev * testdev->name == founddev->name (by strcmp) Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-22dm: test: Add tests for get/find uclass devicesPrzemyslaw Marczak
This commit introduces simple tests for functions: - uclass_find_first_device() - uclass_find_next_device() - uclass_first_device() - uclass_next_device() Tests added by this commit: - Test: dm_test_uclass_devices_find: * call uclass_find_first_device(), then check if: (dev != NULL), (ret == 0) * for the rest devices, call uclass_find_next_device() and do the same check - Test: dm_test_uclass_devices_get: * call uclass_first_device(), then check if: -- (dev != NULL), (ret == 0), device_active() * for the rest devices, call uclass_next_device() and do the same check Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-22dm: test: Add tests for device's uclass platform dataPrzemyslaw Marczak
This test introduces new test structure type:dm_test_perdev_uc_pdata. The structure consists of three int values only. For the test purposes, three pattern values are defined by enum, starting with TEST_UC_PDATA_INTVAL1. This commit adds two test cases for uclass platform data: - Test: dm_test_autobind_uclass_pdata_alloc - this tests if: * uclass driver sets: .per_device_platdata_auto_alloc_size field * the devices's: dev->uclass_platdata is non-NULL - Test: dm_test_autobind_uclass_pdata_valid - this tests: * if the devices's: dev->uclass_platdata is non-NULL * the structure of type 'dm_test_perdev_uc_pdata' allocated at address pointed by dev->uclass_platdata. Each structure field, should be equal to proper pattern data, starting from .intval1 == TEST_UC_PDATA_INTVAL1. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Fix checkpatch.pl failures in net.cJoe Hershberger
Finish eliminating CamelCase from net.c and other failures Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Change IPaddr_t to struct in_addrJoe Hershberger
This patch is simply clean-up to make the IPv4 type that is used match what Linux uses. It also attempts to move all variables that are IP addresses use good naming instead of CamelCase. No functional change. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18dm: usb: Add tests for the USB uclassSimon Glass
This adds a simple test for probing and a functional test using the flash stick emulator, which tests a large chunk of the USB stack. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18dm: test: Allow 'dm test' to select a particular test to runSimon Glass
As well as running all tests, it is useful to be able to run a selected test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18dm: test: Correct printf() output nit in 'dm uclass'Simon Glass
Neither the hyphen nor the equals sign is needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>