summaryrefslogtreecommitdiff
path: root/test/lib
AgeCommit message (Collapse)AuthorFilesLines
2019-04-23test: call hexdump tests via `ut lib`Heinrich Schuchardt1-4/+5
The unit tests in test/lib/hexdump.c are not related to the device tree. So they should be executed via `ut lib` and not via `ut dm`. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-02-09test: provide unit test for memory functionsHeinrich Schuchardt3-0/+216
Memory functions may have architecture specific implementations. These should be tested. Provide unit tests for memset(), memcpy(), memmove(). Provide a 'ut lib' sub-command to execute the tests. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-02-02test: lib: lmb: add lmb test for multiple RAM banksSimon Goldschmidt1-19/+75
This adds one test case that checks that allocation with multiple DRAM banks works correctly. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-01-26lib: lmb: rename lmb_get_unreserved_size to lmb_get_free_sizeSimon Goldschmidt1-11/+11
As a follow-up, change the name of the newly introduced function 'lmb_get_unreserved_size' to 'lmb_get_free_size', which is more appropriate. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> [trini: Fix test/lib/lmb.c] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-01-17lib: lmb: extend lmb for checks at load timeSimon Goldschmidt1-0/+202
This adds two new functions, lmb_alloc_addr and lmb_get_unreserved_size. lmb_alloc_addr behaves like lmb_alloc, but it tries to allocate a pre-specified address range. Unlike lmb_reserve, this address range must be inside one of the memory ranges that has been set up with lmb_add. lmb_get_unreserved_size returns the number of bytes that can be used up to the next reserved region or the end of valid ram. This can be 0 if the address passed is reserved. Added test for these new functions. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-01-17lib: lmb: reserving overlapping regions should failSimon Goldschmidt1-8/+87
lmb_add_region handles overlapping regions wrong: instead of merging or rejecting to add a new reserved region that overlaps an existing one, it just adds the new region. Since internally the same function is used for lmb_alloc, change lmb_add_region to reject overlapping regions. Also, to keep reserved memory correct after 'free', reserved entries created by allocating memory must not set their size to a multiple of alignment but to the original size. This ensures the reserved region is completely removed when the caller calls 'lmb_free', as this one takes the same size as passed to 'lmb_alloc' etc. Add test to assert this. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-01-17lmb: fix allocation at end of address rangeSimon Goldschmidt1-3/+26
The lmb code fails if base + size of RAM overflows to zero. Fix this by calculating end as 'base + size - 1' instead of 'base + size' where appropriate. Added tests to assert this is fixed. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-01-17test: add test for lib/lmb.cSimon Goldschmidt2-0/+298
Add basic tests for the lmb memory allocation code used to reserve and allocate memory during boot. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-12test: hexdump: fix misplaced returnSimon Goldschmidt1-2/+2
One of the hexdump tests in test/lib/hexdump.c returns right at the start of the function without testing anything. Fix this by moving the 'return 0;' statement to the end of the function. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-28test: list: Add tests for hexdump.cMario Six2-0/+100
Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were recently added to U-Boot. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org>