Skip to content

Commit

Permalink
Merge tag 'ktest-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Mar 28, 2025
2 parents 4fa118e + 5a1bed2 commit 68f090f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4303,6 +4303,14 @@ sub cancel_test {
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);
}
Expand Down

0 comments on commit 68f090f

Please sign in to comment.