sandbox: test: Show hex values on failure
authorSimon Glass <sjg@chromium.org>
Fri, 11 Oct 2019 22:16:46 +0000 (16:16 -0600)
committerSimon Glass <sjg@chromium.org>
Sun, 27 Oct 2019 16:56:41 +0000 (10:56 -0600)
Quite a few tests use addresses or hex values for comparisons. Add hex
output for test failures, e.g.:

   0x55ca22fa == reg: Expected 0x55ca22fa (1439310586),
got 0x55ea22fb (1441407739)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
include/test/ut.h

index 19bcb8c3748d7002abf10adecfb966c350bebdc4..fbfde10719f90f14dd7d714d5bfaa51c7204c251 100644 (file)
@@ -61,7 +61,8 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line,
        if (val1 != val2) {                                             \
                ut_failf(uts, __FILE__, __LINE__, __func__,             \
                         #expr1 " == " #expr2,                          \
-                        "Expected %d, got %d", val1, val2);            \
+                        "Expected %#x (%d), got %#x (%d)", val1, val1, \
+                        val2, val2);                                   \
                return CMD_RET_FAILURE;                                 \
        }                                                               \
 }