test: call lmb tests vi 'ut lib'
PATCH 1/1 test: call lmb tests vi 'ut lib'
The unit tests in test/lib/lmb.c are not related to the device tree. So they should be executed via ut lib and not via ut dm.
---
test/lib/lmb.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
test/lib/lmb.c +11 -12
@@ -5,7 +5,8 @@#include <common.h> #include <lmb.h> -#include <dm/test.h> +#include <test/lib.h> +#include <test/test.h> #include <test/ut.h> static int check_lmb(struct unit_test_state *uts, struct lmb *lmb,
@@ -197,7 +198,7 @@ static int lib_test_lmb_simple(struct unit_test_state *uts)return test_multi_alloc_512mb (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_simple,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_simple,0 );/* Create two memory regions with one reserved region and allocate */ static int lib_test_lmb_simple_x2 (struct unit_test_state *uts)
@@ -213,7 +214,7 @@ static int lib_test_lmb_simple_x2(struct unit_test_state *uts)return test_multi_alloc_512mb_x2 (uts,0xE0000000 ,0x40000000 ); } -DM_TEST (lib_test_lmb_simple_x2,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_simple_x2,0 );/* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */ static int test_bigblock (struct unit_test_state *uts,const phys_addr_t ram)
@@ -280,7 +281,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts)return test_bigblock (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_big,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_big,0 );/* Simulate 512 MiB RAM, allocate a block without previous reservation */ static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram,
@@ -355,7 +356,7 @@ static int lib_test_lmb_noreserved(struct unit_test_state *uts)return test_noreserved (uts,0xE0000000 ,4 ,1 ); } -DM_TEST (lib_test_lmb_noreserved,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_noreserved,0 );static int lib_test_lmb_unaligned_size (struct unit_test_state *uts) {
@@ -370,7 +371,7 @@ static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)return test_noreserved (uts,0xE0000000 ,5 ,8 ); } -DM_TEST (lib_test_lmb_unaligned_size,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_unaligned_size,0 );/* * Simulate a RAM that starts at 0 and allocate down to address 0, which must * fail as '0' means failure for the lmb_alloc functions.
@@ -413,7 +414,7 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts)return 0 ; } -DM_TEST (lib_test_lmb_at_0,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_at_0,0 );/* Check that calling lmb_reserve with overlapping regions fails. */ static int lib_test_lmb_overlapping_reserve (struct unit_test_state *uts)
@@ -451,8 +452,7 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)return 0 ; } -DM_TEST (lib_test_lmb_overlapping_reserve, -DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_overlapping_reserve,0 );/* * Simulate 512 MiB RAM, reserve 3 blocks, allocate addresses in between.
@@ -582,7 +582,7 @@ static int lib_test_lmb_alloc_addr(struct unit_test_state *uts)return test_alloc_addr (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_alloc_addr,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_alloc_addr,0 );/* Simulate 512 MiB RAM, reserve 3 blocks, check addresses in between */ static int test_get_unreserved_size(struct unit_test_state *uts,
@@ -653,5 +653,4 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts)return test_get_unreserved_size (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_get_free_size, -DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_get_free_size,0 );
Signature · 1 line
2.17.1
PATCH 1/1 test: call lmb tests vi 'ut lib'
Quoted 5 lines · Simon Goldschmidt
The unit tests in
test/lib/lmb.care not related to the device tree. So they should be executed viaut liband not viaut dm.Signed-off-by Simon Goldschmidt <[email protected]>---
With sandbox_defconfig:
./u-boot -D
=> ut lib
Running 12 lib tests
Test: lib_memcpy
Test: lib_memmove
Test: lib_memset
Test: lib_test_lmb_alloc_addr
ERROR: Failed to allocate 0x1 bytes below 0x0.
ERROR: Failed to allocate 0x1 bytes below 0x0.
Test: lib_test_lmb_at_0
ERROR: Failed to allocate 0x4 bytes below 0x0.
Test: lib_test_lmb_big
ERROR: Failed to allocate 0x10000000 bytes below 0x0.
ERROR: Failed to allocate 0x20000000 bytes below 0x0.
ERROR: Failed to allocate 0x10000000 bytes below 0x0.
ERROR: Failed to allocate 0x20000000 bytes below 0x0.
Test: lib_test_lmb_get_free_size
Test: lib_test_lmb_noreserved
Test: lib_test_lmb_overlapping_reserve
Test: lib_test_lmb_simple
Test: lib_test_lmb_simple_x2
Test: lib_test_lmb_unaligned_size
Failures: 0
=>
Without your patch
=> ut dm
simply hangs. So I cannot judge if these are new errors.
Best regards
Heinrich
Quoted 99 lines
test/lib/lmb.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)test/lib/lmb.c +11
-12@@ -5,7 +5,8 @@#include <common.h> #include <lmb.h> -#include <dm/test.h> +#include <test/lib.h> +#include <test/test.h> #include <test/ut.h> static int check_lmb(struct unit_test_state *uts, struct lmb *lmb,@@ -197,7 +198,7 @@ static int lib_test_lmb_simple(struct unit_test_state *uts)return test_multi_alloc_512mb (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_simple,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_simple,0 );/* Create two memory regions with one reserved region and allocate */ static int lib_test_lmb_simple_x2 (struct unit_test_state *uts)@@ -213,7 +214,7 @@ static int lib_test_lmb_simple_x2(struct unit_test_state *uts)return test_multi_alloc_512mb_x2 (uts,0xE0000000 ,0x40000000 ); } -DM_TEST (lib_test_lmb_simple_x2,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_simple_x2,0 );/* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */ static int test_bigblock (struct unit_test_state *uts,const phys_addr_t ram)@@ -280,7 +281,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts)return test_bigblock (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_big,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_big,0 );/* Simulate 512 MiB RAM, allocate a block without previous reservation */ static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram,@@ -355,7 +356,7 @@ static int lib_test_lmb_noreserved(struct unit_test_state *uts)return test_noreserved (uts,0xE0000000 ,4 ,1 ); } -DM_TEST (lib_test_lmb_noreserved,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_noreserved,0 );static int lib_test_lmb_unaligned_size (struct unit_test_state *uts) {@@ -370,7 +371,7 @@ static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)return test_noreserved (uts,0xE0000000 ,5 ,8 ); } -DM_TEST (lib_test_lmb_unaligned_size,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_unaligned_size,0 );/* * Simulate a RAM that starts at 0 and allocate down to address 0, which must * fail as '0' means failure for the lmb_alloc functions. @@ -413,7 +414,7 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts)return 0 ; } -DM_TEST (lib_test_lmb_at_0,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_at_0,0 );/* Check that calling lmb_reserve with overlapping regions fails. */ static int lib_test_lmb_overlapping_reserve (struct unit_test_state *uts)@@ -451,8 +452,7 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)return 0 ; } -DM_TEST (lib_test_lmb_overlapping_reserve, -DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_overlapping_reserve,0 );/* * Simulate 512 MiB RAM, reserve 3 blocks, allocate addresses in between. @@ -582,7 +582,7 @@ static int lib_test_lmb_alloc_addr(struct unit_test_state *uts)return test_alloc_addr (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_alloc_addr,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_alloc_addr,0 );/* Simulate 512 MiB RAM, reserve 3 blocks, check addresses in between */ static int test_get_unreserved_size(struct unit_test_state *uts,@@ -653,5 +653,4 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts)return test_get_unreserved_size (uts,0xE0000000 ); } -DM_TEST (lib_test_lmb_get_free_size, -DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +LIB_TEST (lib_test_lmb_get_free_size,0 );
PATCH 1/1 test: call lmb tests vi 'ut lib'
Am Mo., 11. Feb. 2019, 22:27 hat Heinrich Schuchardt <[email protected]> geschrieben:
Quoted 25 lines · Simon Goldschmidt
Quoted 5 lines
The unit tests in
test/lib/lmb.care not related to the device tree. So they should be executed viaut liband not viaut dm.Signed-off-by Simon Goldschmidt <[email protected]>---
With
sandbox_defconfig:./u-boot -D
=> ut lib
Running 12 lib tests
Test:lib_memcpy
Test:lib_memmove
Test:lib_memset
Test:lib_test_lmb_alloc_addr
ERROR: Failed to allocate0x1bytes below0x0.
ERROR: Failed to allocate0x1bytes below0x0.
Test:lib_test_lmb_at_0
ERROR: Failed to allocate0x4bytes below0x0.
Test:lib_test_lmb_big
ERROR: Failed to allocate0x10000000bytes below0x0.
ERROR: Failed to allocate0x20000000bytes below0x0.
ERROR: Failed to allocate0x10000000bytes below0x0.
ERROR: Failed to allocate0x20000000bytes below0x0.
Quoted 9 lines
Test:
lib_test_lmb_get_free_size
Test:lib_test_lmb_noreserved
Test:lib_test_lmb_overlapping_reserve
Test:lib_test_lmb_simple
Test:lib_test_lmb_simple_x2
Test:lib_test_lmb_unaligned_size
Failures: 0
=>
Well, these are not test errors but output of the functions the test calls. That could be improved...
Quoted 6 lines
Without your patch
=> ut dm
simply hangs. So I cannot judge if these are new errors.
Hmm, I have no idea what's wrong when it hangs. I ran 'ut dm' about a week or two ago and it worked for me...
Regards,
Simon