Commit 4862c741 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ktest-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest

Pull ktest updates from Steven Rostedt:
 "No new features. Just a couple of fixes that I had in my local
  repository that fixed issues with sending the result emails"

* tag 'ktest-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
  ktest.pl: Fix the logic for truncating the size of the log file for email
  ktest.pl: If size of log is too big to email, email error message
parents c59c7588 170f4869
...@@ -1499,17 +1499,16 @@ sub dodie { ...@@ -1499,17 +1499,16 @@ sub dodie {
my $log_file; my $log_file;
if (defined($opt{"LOG_FILE"})) { if (defined($opt{"LOG_FILE"})) {
my $whence = 0; # beginning of file my $whence = 2; # End of file
my $pos = $test_log_start; my $log_size = tell LOG;
my $size = $log_size - $test_log_start;
if (defined($mail_max_size)) { if (defined($mail_max_size)) {
my $log_size = tell LOG; if ($size > $mail_max_size) {
$log_size -= $test_log_start; $size = $mail_max_size;
if ($log_size > $mail_max_size) {
$whence = 2; # end of file
$pos = - $mail_max_size;
} }
} }
my $pos = - $size;
$log_file = "$tmpdir/log"; $log_file = "$tmpdir/log";
open (L, "$opt{LOG_FILE}") or die "Can't open $opt{LOG_FILE} to read)"; open (L, "$opt{LOG_FILE}") or die "Can't open $opt{LOG_FILE} to read)";
open (O, "> $tmpdir/log") or die "Can't open $tmpdir/log\n"; open (O, "> $tmpdir/log") or die "Can't open $tmpdir/log\n";
...@@ -4253,7 +4252,12 @@ sub do_send_mail { ...@@ -4253,7 +4252,12 @@ sub do_send_mail {
$mail_command =~ s/\$SUBJECT/$subject/g; $mail_command =~ s/\$SUBJECT/$subject/g;
$mail_command =~ s/\$MESSAGE/$message/g; $mail_command =~ s/\$MESSAGE/$message/g;
run_command $mail_command; my $ret = run_command $mail_command;
if (!$ret && defined($file)) {
# try again without the file
$message .= "\n\n*** FAILED TO SEND LOG ***\n\n";
do_send_email($subject, $message);
}
} }
sub send_email { sub send_email {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment