summaryrefslogtreecommitdiffstats
path: root/test/ut.c
Commit message (Collapse)AuthorAgeFilesLines
* common: Drop asm/global_data.h from common headerSimon Glass2021-02-021-0/+1
| | | | | | | | | | | | Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
* test: Avoid assuming sandbox board for bloblist testSimon Glass2021-01-161-0/+18
| | | | | | | | | This tests assumes it is running on sandbox. Add a few functions to handle silencing the console on any board and use those instead. Reported-by: Kever Yang <kever.yang@rock-chips.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add a way to check part of a console line or skip itSimon Glass2020-08-071-0/+22
| | | | | | | | | | | | | Some lines of the output are not worth testing, or not worth testing in their entirety. For example, when checking a hex dump we know that the hex-dump routine can display ASCII so we only need to check the hex bytes, not the ASCII dump. Add a new test macros which can check only part of a console line. Sometimes it is useful to skip a line altogether, so add a macro for that also. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add a way to check each line of console outputSimon Glass2020-02-051-0/+46
| | | | | | | | | | | | | When writing tests to check the output from commands it is useful to be able to check the output line by line using an assertion. Add helper macros to support this and to check that there is no unexpected trailing data. Also some commands produce a dump using print_buffer(). Add a way to check that the correct number of bytes are dumped (ignoring the actual contents). Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add functions to find the amount of allocated memorySimon Glass2020-01-071-0/+14
| | | | | | | | | The malloc() implementations provides a way of finding out the approximate amount of memory that is allocated. Add helper functions to make it easier to access this and see changes over time. This is useful for tests that want to check if memory has been allocated or freed. Signed-off-by: Simon Glass <sjg@chromium.org>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-071-2/+1
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* test: Record and silence console in testsSimon Glass2015-11-191-0/+4
| | | | | | | | | 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>
* test: Generalize the unit test frameworkJoe Hershberger2015-05-211-0/+31
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>