FIXTURE_VARIANT(9)
β¨ FIXTURE_VARIANT(9) β¨
okay so bestie, we're in the Kernel API Manual and this little icon is FIXTURE_VARIANT(9) β and honestly? she's giving options energy. like, plural. multiple vibes of the same test. obsessed. π
πΈ NAME πΈ
FIXTURE_VARIANT β optionally called once per fixture to declare fixture variant π
like, optionally. nobody's forcing you. but if you want variants, this is the one who introduces them.
π¦ SYNOPSIS π¦
FIXTURE_VARIANT (fixture_name );
π ARGUMENTS π
fixture_nameβ the fixture name. that's her. that's the whole argument. one (1) name, no cap. β¨
π DESCRIPTION π
so here's the shape of it, literally:
FIXTURE_VARIANT(fixture_name) {
type property1;
...
};
what she does: she defines the type of constant parameters that get provided to FIXTURE_SETUP, TEST_F and FIXTURE_TEARDOWN as variant. π«Ά
and why do we care? because variants allow the same tests to be run with different arguments. same test, different lewk. main character energy, multiple outfits. πβ¨
ngl this is the glue that makes one test file serve a whole rainbow of argument sets β you declare the shape here, and the rest of the harness does the passing. π
π SEE ALSO π
like the whole group chat shows up for this one:
- Kernel file
./tools/testing/selftests/kselftest_harness.hexample(9),TH_LOG(9),SKIP(9),TEST(9),TEST_SIGNAL(9),FIXTURE_DATA(9),FIXTURE(9),FIXTURE_SETUP(9),FIXTURE_TEARDOWN(9),FIXTURE_TEARDOWN_PARENT(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)
okay that's the whole page, you ate that π go declare a variant, bestie, iykyk π¦
β from ./tools/testing/selftests, dated October 2026, with love ππ
π¦ 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