diff options
author | Simon Glass <sjg@chromium.org> | 2020-09-19 18:49:27 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-10-06 09:07:54 -0600 |
commit | cdd4e30dfcaba706120df340c0c8757d56e48b7a (patch) | |
tree | a3e8de88ec394d7c628527a1d54c698c1ccf5b34 /include/test | |
parent | 4aed22762303755f8f26d14f0ad2608d63550e72 (diff) | |
download | u-boot-cdd4e30dfcaba706120df340c0c8757d56e48b7a.tar.gz |
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>
Diffstat (limited to 'include/test')
-rw-r--r-- | include/test/ut.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/test/ut.h b/include/test/ut.h index 3295cd4e548..3f2ee7514b8 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -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); \ |