]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/fchmodat2: clean up temporary files and directories
authorMark Brown <broonie@kernel.org>
Thu, 26 Feb 2026 22:24:42 +0000 (22:24 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 28 Mar 2026 04:19:36 +0000 (21:19 -0700)
commit04e23830b8f312324f148ccd8289d9cc78992cc1
tree5ef8c3a5dad5b06fbae3b8fbf6bcf85bf73e4bfe
parentac2428c141c06528703b9f7ca182cf4b35d9d22e
selftests/fchmodat2: clean up temporary files and directories

Patch series "selftests/fchmodat2: Error handling and general", v4.

I looked at the fchmodat2() tests since I've been experiencing some random
intermittent segfaults with them in my test systems, while doing so I
noticed these two issues.  Unfortunately I didn't figure out the original
yet, unless I managed to fix it unwittingly.

This patch (of 2):

The fchmodat2() test program creates a temporary directory with a file and
a symlink for every test it runs but never cleans these up, resulting in
${TMPDIR} getting left with stale files after every run.  Restructure the
program a bit to ensure that we clean these up, this is more invasive than
it might otherwise be due to the extensive use of ksft_exit_fail_msg() in
the program.

As a side effect this also ensures that we report a consistent test name
for the tests and always try both tests even if they are skipped.

Link: https://lkml.kernel.org/r/20260226-selftests-fchmodat2-v4-0-a6419435f2e8@kernel.org
Link: https://lkml.kernel.org/r/20260226-selftests-fchmodat2-v4-1-a6419435f2e8@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Alexey Gladkov <legion@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/fchmodat2/fchmodat2_test.c