summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-03-27 18:22:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-03-27 18:22:46 -0700
commit68f090f09b7241a2f019191c5c737741f13a5c17 (patch)
tree073fe5f7d9b96ed7400d5ee15916183663997cee /tools
parent4fa118e5b79fcc537dcb1a860ed319a6106935eb (diff)
parent5a1bed232781d356f842576daacc260f0d0c8d2e (diff)
downloadlinux-68f090f09b7241a2f019191c5c737741f13a5c17.tar.gz
linux-68f090f09b7241a2f019191c5c737741f13a5c17.tar.bz2
linux-68f090f09b7241a2f019191c5c737741f13a5c17.zip
Merge tag 'ktest-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest
Pull ktest update from Steven Rostedt: - Fix failure of directory of log file not existing If a LOG_FILE option is set for ktest to log its messages, and the directory path does not exist. Then ktest fails. Have ktest attempt to create the directory where the log file exists and if that succeeds continue on testing. * tag 'ktest-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest: ktest: Fix Test Failures Due to Missing LOG_FILE Directories
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 8c8da966c641..a5f7fdd0c1fb 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
if ($opt{"CLEAR_LOG"}) {
unlink $opt{"LOG_FILE"};
}
+
+ if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
+ my $dir = $1;
+ if (! -d $dir) {
+ mkpath($dir) or die "Failed to create directories '$dir': $!";
+ print "\nThe log directory $dir did not exist, so it was created.\n";
+ }
+ }
open(LOG, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}";
LOG->autoflush(1);
}