[for-linus][PATCH 2/2] ktest: Add logfile to failure directory

From: Steven Rostedt

Date: Mon Apr 20 2026 - 15:31:54 EST


From: Steven Rostedt <rostedt@xxxxxxxxxxx>

The logfile contains a lot of useful information about the tests being
run. Add it to the stored failure directory when the test fails.

Cc: John 'Warthog9' Hawley <warthog9@xxxxxxxxxx>
Link: https://patch.msgid.link/20260420142315.7bbc3624@fedora
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
tools/testing/ktest/ktest.pl | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index dd55eea15070..f94ed2e98887 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1878,6 +1878,12 @@ sub save_logs {
"testlog" => $testlog,
);

+ if (defined($opt{"LOG_FILE"})) {
+ if (-f $opt{"LOG_FILE"}) {
+ cp $opt{"LOG_FILE"}, "$dir/logfile";
+ }
+ }
+
while (my ($name, $source) = each(%files)) {
if (-f "$source") {
cp "$source", "$dir/$name" or
--
2.51.0