Skip to content

Commit

Permalink
ktest.pl: If size of log is too big to email, email error message
Browse files Browse the repository at this point in the history
commit 8cd6bc0 upstream.

If the size of the error log is too big to send via email, and the sending
fails, it wont email any result. This can be confusing for the user who is
waiting for an email on the completion of the tests.

If it fails to send email, then try again without the log file stating that
it failed to send an email. Obviously this will not be of use if the sending
of email failed for some other reasons, but it will at least give the user
some information when it fails for the most common reason.

Cc: stable@vger.kernel.org
Fixes: c2d84dd ("ktest.pl: Add MAIL_COMMAND option to define how to send email")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
rostedt authored and gregkh committed Dec 21, 2020
1 parent d3f4117 commit 4e282a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/testing/ktest/ktest.pl
Expand Up @@ -4253,7 +4253,12 @@ sub do_send_mail {
$mail_command =~ s/\$SUBJECT/$subject/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 {
Expand Down

0 comments on commit 4e282a8

Please sign in to comment.