ktest updates for v7.1:

- Fix month in date timestamp used to create failure directories
 
   On failure, a directory is created to store the logs and config file to
   analyze the failure. The Perl function localtime is used to create the
   data timestamp of the directory. The month passed back from that
   function starts at 0 and not 1, but the timestamp used does not account
   for that. Thus for April 20, 2026, the timestamp of 20260320 is used,
   instead of 20260420.
 
 - Save the logfile to the failure directory
 
   Just the test log is saved to the directory on failure, but there's
   useful information in the full logfile that can be helpful to analyzing
   the failure. Save the logfile as well.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCaeknTxQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qm9hAP9jPNvXaCqvcGfz9QN2fEOs7sWWVOAQ
 gryZ8Nyqn4CmswD/aQkYBVRSeWsvUrbw7WYrFvEOH0hUfKD6CaFLaA6EigE=
 =ONM2
 -----END PGP SIGNATURE-----

Merge tag 'ktest-v7.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest

Pull ktest updates from Steven Rostedt:

 - Fix month in date timestamp used to create failure directories

   On failure, a directory is created to store the logs and config file
   to analyze the failure. The Perl function localtime is used to create
   the data timestamp of the directory. The month passed back from that
   function starts at 0 and not 1, but the timestamp used does not
   account for that. Thus for April 20, 2026, the timestamp of 20260320
   is used, instead of 20260420.

 - Save the logfile to the failure directory

   Just the test log was saved to the directory on failure, but there's
   useful information in the full logfile that can be helpful to
   analyzing the failure. Save the logfile as well.

* tag 'ktest-v7.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
  ktest: Add logfile to failure directory
  ktest: Fix the month in the name of the failure directory
master
Linus Torvalds 2026-04-22 15:06:40 -07:00
commit 66a7974a39
1 changed files with 7 additions and 1 deletions

View File

@ -1855,7 +1855,7 @@ sub save_logs {
my ($result, $basedir) = @_;
my @t = localtime;
my $date = sprintf "%04d%02d%02d%02d%02d%02d",
1900+$t[5],$t[4],$t[3],$t[2],$t[1],$t[0];
1900+$t[5],$t[4]+1,$t[3],$t[2],$t[1],$t[0];
my $type = $build_type;
if ($type =~ /useconfig/) {
@ -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