summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2021-04-09dm: test: Add test case to check node name ignoring unit addressKishon Vijay Abraham I
Add test to check node name ignoring unit address. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2020-11-15Nokia RX-51: Update test scriptPali Rohár
Include emmc/nand suffix into bootmenu script names and fix leaking sleep processes when asynchronously waiting for them. 'wait -n' is not provided by /bin/sh, so run script under bash. Signed-off-by: Pali Rohár <pali@kernel.org>
2020-11-06Merge tag 'dm-pull5nov20' of git://git.denx.de/u-boot-dmTom Rini
patman status subcommand to collect tags from Patchwork patman showing email replies from Patchwork sandbox poweroff command minor fixes in binman, tests
2020-11-06board: Rename uclass to sysinfoSimon Glass
This uclass is intended to provide a way to obtain information about a U-Boot board. But the concept of a U-Boot 'board' is the whole system, not just one circuit board, meaning that 'board' is something of a misnomer for this uclass. In addition, the name 'board' is a bit overused in U-Boot and we want to use the same uclass to provide SMBIOS information. The obvious name is 'system' but that is so vague as to be meaningless. Use 'sysinfo' instead, since this uclass is aimed at providing information on the system. Rename everything accordingly. Note: Due to the patch delta caused by the symbol renames, this patch shows some renamed files as being deleted in one place and created in another. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-11-06acpi: Don't reset the tables with every new generationSimon Glass
At present if SSDT and DSDT code is created, only the latter is retained for examination by the 'acpi items' command. Fix this by only resetting the list when explicitly requested. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-11-05test: linking test/compression.c failsHeinrich Schuchardt
Building U-Boot with unit tests on a non-sandbox systems fails: ld.bfd: test/built-in.o: in function `compress_using_gzip': test/compression.c:138: undefined reference to `gzip' ld.bfd: test/built-in.o: in function `uncompress_using_bzip2': test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress' ld.bfd: test/built-in.o: in function `uncompress_using_lzma': test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress' ld.bfd: test/built-in.o: in function `uncompress_using_lzo': test/compression.c:257: undefined reference to `lzop_decompress' ld.bfd: test/built-in.o: in function `uncompress_using_lz4': test/compression.c:292: undefined reference to `ulz4fn Add the missing dependencies. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-11-05test: test/bloblist.c depends on asm/state.hHeinrich Schuchardt
Building test/bloblist.c fails for non sandbox devices: test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory #include <asm/state.h> ^~~~~~~~~~~~~ Build the test only on the sandbox. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-11-05test: adjust sysreset testsHeinrich Schuchardt
As we have a working COLD_RESET on the sandbox the sysreset test has to be adjusted. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-11-05test/py: test poweroffHeinrich Schuchardt
It is the 'poweroff' and not the 'reset' command that should shut down the sandbox. Adjust the unit test accordingly Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-11-01Merge tag 'efi-2020-01-rc2-2' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2021-01-rc2 (2) The series contains the following enhancements * preparatory patches for UEFI capsule updates * initialization of the emulated RTC using an environment variable and a bug fix * If DisconnectController() is called for a child controller that is the only child of the driver, the driver must be disconnected.
2020-10-30Merge tag 'dm-pull-30oct20' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-dm of-platdata and dtoc improvements sandbox SPL tests binman support for compressed sections
2020-10-30test: Add a test for log filter-*Sean Anderson
This exercises a few success and failure modes of the log filter-* commands. log filter-list is not tested because it's purely informational. I don't think there's a good way to test it except by testing if the output of the command exactly matches a sample run. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30test: Add a test for getoptSean Anderson
A few of these tests were inspired by those in glibc. The syntax for invoking test_getopt is a bit funky, but it's necessary so that the CPP can parse the arguments correctly. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2020-10-30test: Add test for LOGFF_MINSean Anderson
This tests log filters matching on a minimum level. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30test: Add tests for LOGFF_DENYSean Anderson
This adds some tests for log filters which deny if they match. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-30test: log: Give tests names instead of numbersSean Anderson
Now that the log test command is no more, we can give the log tests proper names. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2020-10-30test: log: Convert log_test from python to CSean Anderson
When rebasing this series I had to renumber all my log tests because someone made another log test in the meantime. This involved updaing a number in several places (C and python), and it wasn't checked by the compiler. So I though "how hard could it be to just rewrite in C?" And though it wasn't hard, it *was* tedious. Tests are numbered the same as before to allow for easier review. A note that if a test fails, everything after it will probably also fail. This is because that test won't clean up its filters. There's no easy way to do the cleanup, except perhaps removing all filters in a wrapper function. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2020-10-30test: unit test for efi_create_indexed_name()Heinrich Schuchardt
Provide a unit test for function efi_create_indexed_name(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-10-29dm: Use driver_info index instead of pointerSimon Glass
At present we use a 'node' pointer in the of-platadata phandle_n_arg structs. This is a pointer to the struct driver_info for a particular device, and we can use it to obtain the struct udevice pointer itself. Since we don't know the struct udevice pointer until it is allocated in memory, we have to fix up the phandle_n_arg.node at runtime. This is annoying since it requires that SPL's data is writable and adds a small amount of extra (generated) code in the dm_populate_phandle_data() function. Now that we can find a driver_info by its index, it is easier to put the index in the phandle_n_arg structures. Update dtoc to do this, add a new device_get_by_driver_info_idx() to look up a device by drive_info index and update the tests to match. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: Add a test for of-platdata parent informationSimon Glass
Add a simple test that we can obtain the correct parent for an I2C device. This requires updating the driver names to match the compatible strings, adding them to the devicetree and enabling a few options. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: Use an allocated array for run-time device infoSimon Glass
At present we update the driver_info struct with a pointer to the device that it created (i.e. caused to be bound). This works fine when U-Boot SPL is stored in read-write memory. But on some platforms, such as Intel Apollo Lake, it is not possible to update the data memory. In any case, it is bad form to put this information in a structure that is in the data region, since it expands the size of the binary. Create a new driver_rt structure which holds runtime information about drivers. Update the code to store the device pointer in this instead. Also update the test check that this works. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Add a test for of-platdata phandlesSimon Glass
We have a test in dtoc for this feature, but not one in U-Boot itself. Add a simple test that checks that the information comes through correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Add a check that all devices have a dev valueSimon Glass
With of-platdata, the driver_info struct is updated with the device pointer when it is bound. This makes it easy for a device to be found by its driver info with the device_get_by_driver_info() function. Add a test that all devices (except the root device) have such an entry. Fix a bug that the function does not set *devp to NULL on failure, which the documentation asserts. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: Add a C test for of-platdata propertiesSimon Glass
At present properties are tested in a roundabout way. The driver's probe() method writes out the values of the properties and the Python test checks the output from U-Boot SPL. Add a C test which checks these values more directly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Drop of-platdata pytestSimon Glass
Now that we have a C version of this test, drop the Python implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29test: Run only the selected SPL testSimon Glass
Use the new -k option to select the test to run. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29test: Run SPL unit testsSimon Glass
Update the 'run' script to include SPL unit tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29pytest: Collect SPL unit testsSimon Glass
Add a new test_spl fixture to handle running SPL unit tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Add a very simple of-platadata testSimon Glass
At present we have a pytest that covers of-platadata. Add a very simple unit test that just checks that a device can be found. This shows the ability to write these tests in C. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Add a way to run SPL testsSimon Glass
Add a -u flag for U-Boot SPL which requests that unit tests be run. To make this work, export dm_test_main() and update it to skip test features that are not used with of-platdata. To run the tests: $ spl/u-boot-spl -u U-Boot SPL 2020.10-rc5 (Oct 01 2020 - 07:35:39 -0600) Running 0 driver model tests Failures: 0 At present there are no SPL unit tests. Note that there is one wrinkle with these tests. SPL has limited memory available for allocation. Also malloc_simple does not free memory (free() is a nop) and running tests repeatedly causes driver-model to reinit multiple times and allocate memory. Therefore it is not possible to run more than a few tests at a time. One solution is to increase the amount of malloc space in sandbox_spl. This is not a problem for pytest, since it runs each test individually, so for now this is left as is. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Update the test runner to support of-platdataSimon Glass
At present DM tests assume that a devicetree is available. This is not the case with of-platadata. Update the code to add this condition. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Build tests for SPLSimon Glass
We want to run unit tests in SPL. Add a new Kconfig to control this and enable it for sandbox_spl Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dtoc: Fix widening of int to bytesSimon Glass
At present an integer is converted to bytes incorrectly. The whole 32-bit integer is inserted as the first element of the byte array, and the other three bytes are skipped. This was not noticed because the unit test did not check it, and the functional test was checking for wrong values. Update the code to handle this as a special case. Add one more test to cover all code paths. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Disable some tests that should not run in SPLSimon Glass
Tests are easier to run in U-Boot proper. Running them in SPL does not add test coverage in most cases. Also some tests use features that are not available in SPL. Update the build rules to disable these tests in SPL. We still need test-main to be able to actually run SPL tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Make use of CONFIG_UNIT_TESTSimon Glass
At present we always include test/dm from the main Makefile. We have a CONFIG_UNIT_TEST that should control whether the test/ directory is built, so rely on that instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Update Makefile conditionsSimon Glass
At present most of the tests in test/Makefile are dependent on CONFIG_SANDBOX. But this is not ideal since they rely on commands being available and SPL does not support commands. Use CONFIG_COMMAND instead. This has the dual purpose of allowing these tests to be used on other boards and allowing SPL to skip them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: test: Sort the MakefileSimon Glass
Move everything into alphabetical order. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29dm: Avoid using #ifdef for CONFIG_OF_LIVESimon Glass
At present this option results in a number of #ifdefs due to the presence or absence of the global_data of_root member. Add a few macros to global_data.h to work around this. Update the code accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29Merge tag 'xilinx-for-v2021.01-v2' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze Xilinx changes for v2021.01-v2 common: - Add support for 64bit loadables from SPL xilinx: - Update documentation and record ownership - Enable eeprom board detection based legacy and fru formats - Add support for FRU format microblaze: - Optimize low level ASM code - Enable SPI/I2C - Enable distro boot zynq: - Add support for Zturn V5 zynqmp: - Improve silicon detection code - Enable several kconfig options - Align DT with the latest state - Enabling security commands - Enable and support FPGA loading from SPL - Optimize xilinx_pm_request() calling versal: - Some DTs/Kconfig/defconfig alignments - Add binding header for clock and power zynq-sdhci: - Add support for tap delay programming zynq-spi/zynq-qspi: - Use clock framework for getting clocks xilinx-spi: - Fix some code issues (unused variables) serial: - Check return value from clock functions in pl01x
2020-10-28test: mux-cmd: Add tests for the 'mux' commandPratyush Yadav
Tests tests run the three mux subcommands: list, select, and deselect, and verify that the commands do what we expect. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-28test: Add tests for the multiplexer frameworkJean-Jacques Hiblot
Provide tests to check the behavior of the multiplexer framework. Two sets of tests are added. One is using an emulated multiplexer driver that can be used to test basic functionality like select, deselect, etc. The other is using the mmio mux which adds tests specific to it. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27test: log: test message continuationHeinrich Schuchardt
Provide a unit test checking that a continuation message will use the same log level and log category as the previous message. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27dm: core: Add support for getting node from aliasesMichal Simek
Add support for getting a node/property from aliases. The similar functionality is provided for chosen node and this implemenatation is copy of it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-23cmd: fat: Use do_save() for fatwriteLad Prabhakar
do_save() function defined in fs.c also supports FAT file system re-use the same for fatwrite command. Also fix the FAT test script to match the expected output. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
2020-10-23test: unit tests for print_freq(), print_size()Heinrich Schuchardt
Provide unit tests for functions print_freq() and print_size(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-10-22common: rename getc() to getchar()Heinrich Schuchardt
The sandbox is built with the SDL2 library with invokes the X11 library which in turn calls getc(). But getc() in glibc is defined as int getc(FILE *) This does not match our definition. int getc(void) The sandbox crashes when called with parameter -l. Rename our library symbol getc() to getchar(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-18video: backlight: fix pwm's duty cycle calculationDario Binacchi
For levels equal to the maximum value, the duty cycle must be equal to the period. Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-17test: Fix sandbox tests failing to buildSean Anderson
syslog_test.h is in test/log/, not include/ Fixes: 52d3df7fef ("log: Allow LOG_DEBUG to always enable log output") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-14cmd/button: return button statusHeinrich Schuchardt
To make the button command useful in a shell script it should return the status of the button: * 0 (true) - pressed, on * 1 (false) - not pressed, off The button command takes only one argument. Correct maxargs. Adjust the Python unit test. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-10-14test: sharpen button label unit testHeinrich Schuchardt
Using different strings for the device tree node labels and the label property of buttons sharpens the button label unit test. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>