bloblist: Compare addresses rather than pointers in tests
When running these tests on sandbox any failures result in very large or long pointer values which are a pain to work with. Map them to an address so it is easier to diagnose failures. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -224,6 +224,19 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes);
|
||||
} \
|
||||
}
|
||||
|
||||
/* Assert that two addresses (converted from pointers) are equal */
|
||||
#define ut_asserteq_addr(expr1, expr2) { \
|
||||
ulong _val1 = map_to_sysmem(expr1); \
|
||||
ulong _val2 = map_to_sysmem(expr2); \
|
||||
\
|
||||
if (_val1 != _val2) { \
|
||||
ut_failf(uts, __FILE__, __LINE__, __func__, \
|
||||
#expr1 " = " #expr2, \
|
||||
"Expected %lx, got %lx", _val1, _val2); \
|
||||
return CMD_RET_FAILURE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Assert that a pointer is NULL */
|
||||
#define ut_assertnull(expr) { \
|
||||
const void *_val = (expr); \
|
||||
|
||||
Reference in New Issue
Block a user