KUNIT_CASE_PARAM_WITH_INIT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– KUNIT_CASE_PARAM_WITH_INIT(9) πŸ’–

okay bestie, welcome to the Kernel API Manual entry for KUNIT_CASE_PARAM_WITH_INIT(9) β€” yes, that whole mouthful πŸ’…. We are defining a parameterized KUnit test case with custom param_init() and param_exit() functions, and honestly? iconic setup energy.


✨ NAME ✨

KUNIT_CASE_PARAM_WITH_INIT β€” Define a parameterized KUnit test case with custom param_init() and param_exit() functions.


πŸŽ€ SYNOPSIS πŸŽ€

KUNIT_CASE_PARAM_WITH_INIT (test_name , gen_params , init , exit );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • test_name β€” The function implementing the test case. That's the main character test function, fr fr.
  • gen_params β€” The function to generate parameters for the test case. This is the parameter generator, no cap.
  • init β€” A reference to the param_init function to run before a parameterized test. Setup bestie πŸ’–.
  • exit β€” A reference to the param_exit function to run after a parameterized test. Teardown bestie 🧹.

🌸 DESCRIPTION 🌸

This macro provides the option to register param_init and param_exit functions. The param_init/exit functions will be passed the parameterized test context and run once before and once after the parameterized test. Periodt.

The init function can be used to add resources to share between parameter runs, pass parameter arrays, and any other setup logic. Very β€œgetting the group chat ready before the main event” energy 🫢.

The exit function can be used to clean up resources that were not managed by the parameterized test, and any other teardown logic. Basically the β€œokay bestie, let’s pack up and go home” function πŸŽ€.


πŸ’… NOTE πŸ’…

If you are registering a parameter array in param_init with kunit_register_param_array then you need to pass kunit_array_gen_params to this as the generator function. iykyk πŸ‘‘.

🌈 SEE ALSO 🌈


mwah πŸ’‹ this page lives in ./include/kunit, it’s giving October 2026 era, and the title card still says KUNIT_CASE_PARAM_WITH_INIT(9) β€” bye bestie, go write some slay tests 🫢✨

πŸ“¦ where this page comes from