STRUCT KUNIT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

struct kunit β€” bestie, it literally represents a running instance of a test ✨

so like, it's the struct that holds the whole vibe of a test while it's actually running, iykyk.


πŸŽ€ SYNOPSIS πŸŽ€

struct kunit {
    void *priv;
    struct kunit *parent;
    struct kunit_params params_array;
 };

like, that's the whole shape of it πŸ’– three little fields, one big job.


πŸ¦‹ Members πŸ¦‹

  • priv β€” this one's yours, bestie πŸ’… it's for you to store arbitrary data in. the classic move is passing in data you created in the init function (peep struct kunit_suite for that one 🫢).
  • parent β€” a reference to the parent context, and it's of type struct kunit, so it's the same vibe one level up πŸ’« use it for storing shared resources, iconic.
  • params_array β€” for storing the parameter array. that's it, that's the whole job, no cap πŸ“

🌸 Description 🌸

okay so listen πŸ‘‘ this struct is where all the info about the current context your test is running under lives. most of that data is private β€” like, not for you, you gotta go through the public functions to touch it, respectfully πŸ™ˆ

the exceptions (the ones you're actually allowed to play with) are priv, parent, and params_array ✨ and what they do is: store arbitrary data, access the parent context, and store the parameter array β€” respectively, in that exact order, slay πŸ’…

so basically: if it's not one of those three, hands off, use the public API, periodt.


⭐ SEE ALSO ⭐

the whole friend group, fr fr πŸ’– kernel file ./include/kunit/test.h and all of these icons:


like, that's a lot of friends but they're all real, bestie, don't skip any of them πŸ’€

and that's the page!! mwah πŸ’‹ this gem lives at ./include/kunit, dated October 2026, and it's the struct kunit(9) page β€” go write some tests, you're gonna ate 🧚✨

πŸ“¦ where this page comes from