FIXTURE_TEARDOWN_PARENT(9)
π FIXTURE_TEARDOWN_PARENT(9) π
okay bestie, welcome to the Kernel API Manual β yes, the whole manual name, we're doing this properly β¨ This one's about FIXTURE_TEARDOWN_PARENT, and it's lowkey one of those macros that eats. Let's get into it π«Ά
πΈ NAME πΈ
FIXTURE_TEARDOWN_PARENT β and ngl, the manpage literally gives you nothing after the dash. Empty. A whole blank. The name is the whole personality here π (no cap, that's genuinely all the NAME section says)
β¨ SYNOPSIS β¨
FIXTURE_TEARDOWN_PARENT (fixture_name );
that's it, that's the whole call π (yes the spacing is weird, that's just how it's printed, leave it alone π)
π¦ ARGUMENTS π¦
fixture_nameβ the fixture name. that's the entire description. it's giving "minimalist", it's giving "I said what I said" π
π DESCRIPTION π
okay so here's the tea, and this first part is important so listen up π:
*_metadata* is included so that EXPECT_*, ASSERT_* etc. work correctly.
like, the metadata is there on purpose. don't come for it. if you mess with it, your EXPECT_* and ASSERT_* friends stop working and you'll be sad π
the shape of it is:
FIXTURE_TEARDOWN_PARENT(fixture_name) { implementation }
and what does it actually do? it's the same as FIXTURE_TEARDOWN, but β and this is the iconic part β it runs this code in a parent process π
why do we care? because that lets the test process drop its privileges without impacting the related FIXTURE_TEARDOWN_PARENT π₯ for example: removing files from a directory where write access was dropped. the test lost its power, the parent still has it, everyone wins. that's main character energy fr fr.
and one more thing, super important, don't skip it β: to make it possible for the parent process to use *self*, you gotta share (MAP_SHARED) the fixture data between all forked processes. that's the vibe check. do it or the parent can't see *self*.
β οΈ heads up bestie: this whole "drop privileges" thing is the point of using this macro over plain FIXTURE_TEARDOWN β if you don't actually need the parent process, you're just doing extra work for the aesthetic π
π SEE ALSO π
literally the entire kselftest friend group, they all showed up π«Ά
the source file itself:
- Kernel file
./tools/testing/selftests/kselftest_harness.hexample(9)
the harness fam:
- TH_LOG(9)
- SKIP(9)
- TEST(9)
- TEST_SIGNAL(9)
- FIXTURE_DATA(9)
- FIXTURE(9)
- FIXTURE_SETUP(9)
- FIXTURE_TEARDOWN(9)
- FIXTURE_VARIANT(9)
- FIXTURE_VARIANT_ADD(9)
- TEST_F(9)
- TEST_HARNESS_MAIN(9)
- operators(9)
- XFAIL_ADD(9)
the ASSERT squad (hard fails, they do NOT play π€):
- 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)
the EXPECT squad (soft fails, they're chill π):
- 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)
aaaand that's the page! π
cute little sign-off for the credits section: this one lives in ./tools/testing/selftests, it's dated October 2026, and it's filed under FIXTURE_TEARDOWN_PARENT(9) β okay love u bye bestie, go share your fixture data with MAP_SHARED πΈπ§ββοΈ
π¦ 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