FIXTURE_TEARDOWN_PARENT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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.h example(9)

the harness fam:

the ASSERT squad (hard fails, they do NOT play 😀):

the EXPECT squad (soft fails, they're chill 🌈):


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