]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/run_kselftest.sh: Allow choosing per-test log directory
authorRicardo B. Marlière <rbm@suse.com>
Fri, 20 Mar 2026 18:29:19 +0000 (15:29 -0300)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 13 Apr 2026 17:05:39 +0000 (11:05 -0600)
commitd6ea9f404b905ba7351d6b0e9ed611d9d0bf20f7
tree6e13c09be0fd1affa9a30ca9b0ca4955aeb1c77c
parenta82e076f4a0c084b2f5470db31dd9282ba3fcbb2
selftests/run_kselftest.sh: Allow choosing per-test log directory

The --per-test-log option currently hard-codes /tmp. However, the system
under test will most likely have tmpfs mounted there. Since it's not clear
which filenames the log files will have, the user should be able to specify
a persistent directory to store the logs. Keeping those logs are important
because the run_kselftest.sh runner will only yield KTAP output, trimming
information that is otherwise available through running individual tests
directly.

Allow --per-test-log to take an optional directory argument. Keep the
existing behaviour when the option is passed without an argument, but if
a directory is provided, create it if needed, reject non-directory paths
and non-writable directories, canonicalize it, and have runner.sh write
per-test logs there instead of /tmp.

This also makes relative paths safe by resolving them before the runner
changes into a collection directory.

Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Link: https://lore.kernel.org/r/20260320-selftests-fixes-v1-4-79144f76be01@suse.com
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kselftest/runner.sh
tools/testing/selftests/run_kselftest.sh