STRUCT KUNIT_BINARY_PTR_ASSERT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct kunit_binary_ptr_assert(9)

okay so this is from the Kernel API Manual and it's genuinely one of those little structs that makes kernel testing not a total nightmare, so let's get into it 🫢

✨ NAME ✨

struct kunit_binary_ptr_assert β€” it's the expectation/assertion type that compares two pointer values, like when you write KUNIT_EXPECT_PTR_EQ(test, foo, bar) πŸ’–

🌸 SYNOPSIS 🌸

struct kunit_binary_ptr_assert {
    struct kunit_assert assert;
    const struct kunit_binary_assert_text *text;
    const void *left_value;
    const void *right_value;
 };

πŸŽ€ Members πŸŽ€

  • assert β€” the parent of this type, it's giving "I inherited this, respectfully" 🌈
  • text β€” holds the textual representations of the operands and the op (e.g. "==") ✨
  • left_value β€” the actual evaluated value of the expression in the left slot πŸ‘ˆ
  • right_value β€” the actual evaluated value of the expression in the right slot πŸ‘‰

πŸ¦‹ Description πŸ¦‹

so this struct represents an expectation/assertion that compares two pointer values, no cap πŸ’€

for example, if you wanna expect that foo and bar point to the same thing, you can use the expectation KUNIT_EXPECT_PTR_EQ(test, foo, bar); β€” literally that simple, slay πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./include/kunit/assert.h β€” plus all these besties:

  • enum kunit_assert_type(9)
  • struct kunit_loc(9)
  • struct kunit_assert(9)
  • struct kunit_fail_assert(9)
  • struct kunit_unary_assert(9)
  • struct kunit_ptr_not_err_assert(9)
  • struct kunit_binary_assert_text(9)
  • struct kunit_binary_assert(9)
  • struct kunit_binary_str_assert(9)
  • struct kunit_mem_assert(9)

k bye bestie, go forth and assert your pointers πŸ’œ

and that's the whole vibe check β€” brought to you by ./include/kunit, dated October 2026, signing off from the struct kunit...y_ptr_assert(9) era πŸ§šβ€β™€οΈβ­πŸ’–

πŸ“¦ where this page comes from