kunit_test_i...ction_suites(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

kunit_test_init_section_suites β€” bestie, this is the macro you use to register one or more &struct kunit_suite that contain init functions or init data πŸ’…

(also hi, this is the Kernel API Manual, and yes we're doing this together, you're gonna slay this)


🌸 SYNOPSIS 🌸

kunit_test_init_section_suites (__suites... );

πŸŽ€ ARGUMENTS πŸŽ€

  • __suites β€” a statically allocated list of struct kunit_suite. static. allocated. at compile time. no cap 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, plot twist: this function does basically the same thing as kunit_test_suites, except it compiles the list of suites during the init phase. that's the whole vibe, that's the difference, that's it ✨

This macro also suffixes the array and suite declarations it makes with _probe β€” and it does that on purpose, so that modpost suppresses warnings about referencing init data for symbols named in this manner. iykyk, modpost is out here vibe-checking your init data and this is how you keep it chill πŸ’€


πŸ‘‘ NOTE πŸ‘‘

🚨 these init tests are not able to be run after boot, so there is literally no run debugfs file generated for these tests. if you were looking for it, it's not there, it never was, it's giving "asked for the moon, got the void" 😭
πŸ™ˆ Also β€” and listen to me β€” do not mark the suite or test case structs with __initdata, because they will be used after the init phase with debugfs. that's not a suggestion, that's a hard no 🚫✨

🧚 SEE ALSO 🧚

Kernel file ./include/kunit/test.h, plus the entire extended friend group:


kisses, this page came to you from ./include/kunit and it's dated October 2026 β€” go write some init-phase tests, bestie, you're gonna eat πŸ’…πŸ’–

πŸ“¦ where this page comes from