lkml.org 
[lkml]   [2022]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v6 1/3] kunit: Introduce KUNIT_EXPECT_MEMEQ and KUNIT_EXPECT_MEMNEQ macros
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

\
 
 \ /
  Last update: 2022-10-18 23:13    [W:0.059 / U:1.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site