linux/tools/testing/ktest
Ricardo B. Marlière a93127766f ktest: Run POST_KTEST hooks on failure and cancellation
[ Upstream commit bc6e165a45 ]

PRE_KTEST can be useful for setting up the environment and POST_KTEST to
tear it down, however POST_KTEST only runs on the normal end-of-run path.
It is skipped when ktest exits through dodie() or cancel_test(). Final
cleanup hooks are skipped.

Factor the final hook execution into run_post_ktest(), call it from the
normal exit path and from the early exit paths, and guard it so the hook
runs at most once.

Cc: John Hawley <warthog9@eaglescrag.net>
Cc: Andrea Righi <arighi@nvidia.com>
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Cc: Matthieu Baerts <matttbe@kernel.org>
Cc: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: Pedro Falcato <pfalcato@suse.de>
Link: https://patch.msgid.link/20260307-ktest-fixes-v1-8-565d412f4925@suse.com
Fixes: 921ed4c720 ("ktest: Add PRE/POST_KTEST and TEST options")
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-06-01 17:35:32 +02:00
..
examples bootconfig/tracing/ktest: Update ktest example for boot-time tracing 2021-08-16 11:39:51 -04:00
compare-ktest-sample.pl tweewide: Fix most Shebang lines 2020-12-08 23:30:04 +09:00
config-bisect.pl ktest.pl: Fix uninitialized var in config-bisect.pl 2026-01-19 13:09:49 +01:00
ktest.pl ktest: Run POST_KTEST hooks on failure and cancellation 2026-06-01 17:35:32 +02:00
sample.conf ktest.pl: Add RUN_TIMEOUT option with default unlimited 2023-03-10 09:40:10 +01:00