Skip to content

Commit 68f090f

Browse files
committed
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
2 parents 4fa118e + 5a1bed2 commit 68f090f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/testing/ktest/ktest.pl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4303,6 +4303,14 @@ sub cancel_test {
43034303
if ($opt{"CLEAR_LOG"}) {
43044304
unlink $opt{"LOG_FILE"};
43054305
}
4306+
4307+
if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
4308+
my $dir = $1;
4309+
if (! -d $dir) {
4310+
mkpath($dir) or die "Failed to create directories '$dir': $!";
4311+
print "\nThe log directory $dir did not exist, so it was created.\n";
4312+
}
4313+
}
43064314
open(LOG, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}";
43074315
LOG->autoflush(1);
43084316
}

0 commit comments

Comments
 (0)