diff options
author | Simon Glass <sjg@chromium.org> | 2014-12-10 08:55:55 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-12-11 13:18:43 -0700 |
commit | ecc2ed55ee09814d16e81a9d1030a95f98eaf940 (patch) | |
tree | 392c8aefb983944806d72a284c8a35c8ec0b680e /include/dm/ut.h | |
parent | 20142019a96a72bf1516be93a86fc10d028fd136 (diff) | |
download | blackbird-obmc-uboot-ecc2ed55ee09814d16e81a9d1030a95f98eaf940.tar.gz blackbird-obmc-uboot-ecc2ed55ee09814d16e81a9d1030a95f98eaf940.zip |
dm: i2c: Add tests for I2C
Add some basic tests to check that the system works as expected.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'include/dm/ut.h')
-rw-r--r-- | include/dm/ut.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/dm/ut.h b/include/dm/ut.h index fa9eac0226..ec6146545b 100644 --- a/include/dm/ut.h +++ b/include/dm/ut.h @@ -89,6 +89,18 @@ void ut_failf(struct dm_test_state *dms, const char *fname, int line, } \ } +/* Assert that a pointer is not NULL */ +#define ut_assertnonnull(expr) { \ + const void *val = (expr); \ + \ + if (val == NULL) { \ + ut_failf(dms, __FILE__, __LINE__, __func__, \ + #expr " = NULL", \ + "Expected non-null, got NULL"); \ + return -1; \ + } \ +} + /* Assert that an operation succeeds (returns 0) */ #define ut_assertok(cond) ut_asserteq(0, cond) |