FIXTURE(9)
π FIXTURE β the Kernel API Manual tea, bestie
okay so you found FIXTURE(9) from the Kernel API Manual and you're like "what is this, why is it yelling in all caps" β don't worry, we're gonna get through this together, hand in hand, like the main characters we are π«Άβ¨
β¨ NAME β¨
FIXTURE β it gets called once per fixture to set up the data and do the registering. that's literally its whole job. one fixture, one call, iconic behavior only π
πΈ SYNOPSIS πΈ
FIXTURE (fixture_name );
look at that. beautiful. no cap. π¦
π ARGUMENTS π
fixture_nameβ the name of the fixture π like. the name. of the fixture. that's the assignment and it ate.
π DESCRIPTION π
okay so here's the shape of the thing, and honestly it's giving struct-declaration-realness:
FIXTURE(fixture_name) {
type property1;
...
};
so what's actually happening here? FIXTURE(fixture_name) defines the data that gets handed to the tests made by TEST_F, and it shows up as *self*. that's it. that's the vibe. it's your little data bag π
but β and this is the important part, don't skip it β you gotta populate it and clean it up using FIXTURE_SETUP and FIXTURE_TEARDOWN. do not just leave it sitting there empty like an unread group chat. that's not the move. π
π₯ SEE ALSO π₯
okay bestie, buckle up, this list is long and lowkey glorious, every single one of these is here and we're not skipping a single one:
Kernel file ./tools/testing/selftests/kselftest_harness.hexample(9)TH_LOG(9),SKIP(9),TEST(9),TEST_SIGNAL(9),FIXTURE_DATA(9)FIXTURE_SETUP(9),FIXTURE_TEARDOWN(9),FIXTURE_TEARDOWN_PARENT(9)FIXTURE_VARIANT(9),FIXTURE_VARIANT_ADD(9)TEST_F(9),TEST_HARNESS_MAIN(9),operators(9)ASSERT_EQ(9),ASSERT_NE(9),ASSERT_LT(9),ASSERT_LE(9),ASSERT_GT(9),ASSERT_GE(9),ASSERT_NULL(9),ASSERT_TRUE(9),ASSERT_FALSE(9),ASSERT_STREQ(9),ASSERT_STRNE(9)EXPECT_EQ(9),EXPECT_NE(9),EXPECT_LT(9),EXPECT_LE(9),EXPECT_GT(9),EXPECT_GE(9),EXPECT_NULL(9),EXPECT_TRUE(9),EXPECT_FALSE(9),EXPECT_STREQ(9),EXPECT_STRNE(9)XFAIL_ADD(9)
like genuinely, that's the whole squad πβ¨
sign-off time π this lil page lives in ./tools/testing/selftests and it's dated October 2026 β screenshot it, frame it, put it on your wall, periodt. π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms