mbox series

[RFC,0/4] kunit: more assertion reworking

Message ID 20220525154442.1438081-1-dlatypov@google.com
Headers show
Series kunit: more assertion reworking | expand

Message

Daniel Latypov May 25, 2022, 3:44 p.m. UTC
This is a follow up to these three series:
https://lore.kernel.org/all/20220113165931.451305-1-dlatypov@google.com/
https://lore.kernel.org/all/20220118223506.1701553-1-dlatypov@google.com/
https://lore.kernel.org/all/20220125210011.3817742-1-dlatypov@google.com/

The two goals of those series were
a) reduce the size of struct kunit_assert and friends.
   (struct kunit_assert went from 48 => 8 bytes on UML.)
b) simplify the internal code, mostly by deleting macros

This series goes further
a) sizeof(struct kunit_assert) = 0 now
b) e.g. we delete another class of macros (KUNIT_INIT_*_ASSERT_STRUCT)

Note: this does change the function signature of
kunit_do_failed_assertion, so we'd need to update the rust wrapper in https://github.com/Rust-for-Linux/linux/blob/rust/rust/kernel/kunit.rs
But otherwise, I don't think this series changes anything on the
rust-side.

Daniel Latypov (4):
  rfc: kunit: remove format func from struct kunit_assert, get it to 0
    bytes
  rfc: kunit: rename base KUNIT_ASSERTION macro to _KUNIT_FAILED
  rfc: kunit: eliminate KUNIT_INIT_*_ASSERT_STRUCT macros
  kunit: delcare kunit_assert structs as const

 include/kunit/assert.h |  74 ++-----------------------
 include/kunit/test.h   | 123 ++++++++++++++++++++++-------------------
 lib/kunit/test.c       |   7 ++-
 3 files changed, 76 insertions(+), 128 deletions(-)


base-commit: e7eaffce47b7db72b077630dbe836f0c4132496d

Comments

Miguel Ojeda May 25, 2022, 3:56 p.m. UTC | #1
Hi Daniel,

On Wed, May 25, 2022 at 5:44 PM Daniel Latypov <dlatypov@google.com> wrote:
>
> Note: this does change the function signature of
> kunit_do_failed_assertion, so we'd need to update the rust wrapper in https://github.com/Rust-for-Linux/linux/blob/rust/rust/kernel/kunit.rs
> But otherwise, I don't think this series changes anything on the
> rust-side.

Thanks for the heads up! I can take care of that.

Cheers,
Miguel