lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGS_qxof66Lbthg+bJHGWK2UQzovc4FLYVAHTdHP=QyfBBo6=w@mail.gmail.com>
Date:   Tue, 18 Oct 2022 14:12:32 -0700
From:   Daniel Latypov <dlatypov@...gle.com>
To:     Maíra Canal <mairacanal@...eup.net>
Cc:     Brendan Higgins <brendanhiggins@...gle.com>, davidgow@...gle.com,
        airlied@...il.com, daniel@...ll.ch, davem@...emloft.net,
        kuba@...nel.org, jose.exposito89@...il.com, javierm@...hat.com,
        andrealmeid@...eup.net, melissa.srw@...il.com,
        siqueirajordao@...eup.net, Isabella Basso <isabbasso@...eup.net>,
        magalilemes00@...il.com, tales.aparecida@...il.com,
        linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
        linux-kernel@...r.kernel.org,
        Muhammad Usama Anjum <usama.anjum@...labora.com>
Subject: Re: [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@...eup.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ