On Tue, Oct 18, 2022 at 12:06 PM MaĆra Canal mairacanal@riseup.net wrote:
diff --git a/include/kunit/test.h b/include/kunit/test.h index b1ab6b32216d..cde97dc4eed5 100644 --- a/include/kunit/test.h +++ b/include/kunit/test.h @@ -658,6 +658,39 @@ do { \ ##__VA_ARGS__); \ } while (0)
+#define KUNIT_MEM_ASSERTION(test, \
assert_type, \
left, \
op, \
right, \
size, \
fmt, \
...) \
+do { \
const void *__left = (left); \
const void *__right = (right); \
const size_t __size = (size); \
static const struct kunit_binary_assert_text __text = { \
.operation = #op, \
.left_text = #left, \
.right_text = #right, \
}; \
\
if (likely(memcmp(__left, __right, __size) op 0)) \
break; \
\
_KUNIT_FAILED(test, \
assert_type, \
kunit_mem_assert, \
kunit_mem_assert_format, \
KUNIT_INIT_MEM_ASSERT_STRUCT(&__text, \
__left, \
__right, \
__size), \
fmt, \
##__VA_ARGS__); \
+} while (0)
I think this should have been the only real change we needed to make (to resolve the merge conflict I created). Looks good to me. I think this series is still good to go.
Sorry for changing the assertion internals out from under you!
Daniel