linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] kunit: more assertion reworking
@ 2022-10-01  0:26 Daniel Latypov
  2022-10-01  0:26 ` [PATCH 1/4] kunit: remove format func from struct kunit_assert, get it to 0 bytes Daniel Latypov
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Daniel Latypov @ 2022-10-01  0:26 UTC (permalink / raw)
  To: brendanhiggins, davidgow
  Cc: linux-kernel, kunit-dev, linux-kselftest, skhan,
	miguel.ojeda.sandonis, Daniel Latypov

RFC: https://lore.kernel.org/linux-kselftest/20220525154442.1438081-1-dlatypov@google.com/
Changes since then: tweak commit messages, reformatting to make
  checkpatch.pl happy. Nothing substantial.
Why send this out again now: the initial Rust patchset no longer
  contains the Kunit changes, so hopefully both series can go into 6.1
  and later we can coordinate the update the kunit.rs wrapper.

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 hopefully it's just a simple change, e.g. maybe just like:
@@ -38,9 +38,7 @@
             });
             static CONDITION: &'static $crate::str::CStr =
$crate::c_str!(stringify!($cond));
             static ASSERTION: UnaryAssert =
UnaryAssert($crate::bindings::kunit_unary_assert {
-                assert: $crate::bindings::kunit_assert {
-                    format: Some($crate::bindings::kunit_unary_assert_format),
-                },
+                assert: $crate::bindings::kunit_assert {},
                 condition: CONDITION.as_char_ptr(),
                 expected_true: true,
             });
@@ -67,6 +65,7 @@
                     core::ptr::addr_of!(LOCATION.0),
                     $crate::bindings::kunit_assert_type_KUNIT_ASSERTION,
                     core::ptr::addr_of!(ASSERTION.0.assert),
+                    Some($crate::bindings::kunit_unary_assert_format),
                     core::ptr::null(),
                 );
             }


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

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


base-commit: 511cce163b75bc3933fa3de769a82bb7e8663f2b
-- 
2.38.0.rc1.362.ged0d419d3c-goog


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-10-18 23:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-01  0:26 [PATCH 0/4] kunit: more assertion reworking Daniel Latypov
2022-10-01  0:26 ` [PATCH 1/4] kunit: remove format func from struct kunit_assert, get it to 0 bytes Daniel Latypov
2022-10-01  3:26   ` David Gow
2022-10-01  0:26 ` [PATCH 2/4] kunit: rename base KUNIT_ASSERTION macro to _KUNIT_FAILED Daniel Latypov
2022-10-01  3:26   ` David Gow
2022-10-01  3:50     ` Daniel Latypov
2022-10-01  4:13       ` David Gow
2022-10-01  0:26 ` [PATCH 3/4] kunit: eliminate KUNIT_INIT_*_ASSERT_STRUCT macros Daniel Latypov
2022-10-01  3:26   ` David Gow
2022-10-01 10:12   ` Miguel Ojeda
2022-10-01 17:48     ` Daniel Latypov
2022-10-01  0:26 ` [PATCH 4/4] kunit: declare kunit_assert structs as const Daniel Latypov
2022-10-01  3:26   ` David Gow
2022-10-01 10:06   ` Miguel Ojeda
2022-10-01 10:15 ` [PATCH 0/4] kunit: more assertion reworking Miguel Ojeda
2022-10-01 18:00   ` Daniel Latypov
2022-10-18 23:20     ` Miguel Ojeda
2022-10-18 23:26       ` Daniel Latypov
2022-10-18 23:39         ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).